고원빈

Merge branch 'frontend'

Showing 102 changed files with 3458 additions and 0 deletions
{
// IntelliSense를 사용하여 가능한 특성에 대해 알아보세요.
// 기존 특성에 대한 설명을 보려면 가리킵니다.
// 자세한 내용을 보려면 https://go.microsoft.com/fwlink/?linkid=830387을(를) 방문하세요.
"version": "0.2.0",
"configurations": [
{
"name": "flutter_application_1",
"cwd": "frontend\\flutter_application_1",
"request": "launch",
"type": "dart"
}
]
}
\ No newline at end of file
{
"dart.previewFlutterUiGuides": true
}
\ No newline at end of file
# 스마트 약병 IoT FRONTEND 개발
## 지도교수
+ 유인태 교수님
## 팀원
+ 2016104102 컴퓨터공학과 고원빈
## 일정
+ 2021-04-27 : Flutter 앱 생성 및 개발 환경 설정
+ 2021-04-27 : 시작화면 router 생성
### 2021-04-28
+ flutter version 변경 작업
### 2021-04-29
+ Main 화면 작업 완료
![로그인_화면](/uploads/d12f35739c9263e37009cc9b3bbe06d4/로그인_화면.PNG)
+ 로그인 페이지 작업 완료
![222](/uploads/8cc867cd159e28c04ff2a09e3a42c2d6/222.PNG)
### 2021-05-09
+ Appbar 기능 구현
appbar 관련 디자인은 추후 구현 예정
### 2021-05-10
+ Appbar 디자인 변경 및 Navgation Bar 구현
+ Setting은 별도의 페이지로 구성
### 2021-05-11
+ Inside Information 화면 구성
<img src = "https://user-images.githubusercontent.com/56704722/117849827-aadc6400-b2bf-11eb-8cdb-2c7f37833d01.png" width="400">
+ Outside Information 화면 구성
<img src ="https://user-images.githubusercontent.com/56704722/117849959-cd6e7d00-b2bf-11eb-86b7-bc97356c7665.png" width="400">
+ Setting Page 화면 구성
<img src = "https://user-images.githubusercontent.com/56704722/117850038-e24b1080-b2bf-11eb-8dcd-5cb96a9056e0.png" width="400">
### 2021-05-13
+ flutter notification 추가 알람 설정 완료
+ datetime picker widget을 이용하여 시간 선택 구현 예정
+ 알람 설정을 위한 Android Mainfest 설정 , 사용자 권한 요구
### 2021-05-14
+ datetime picker 를 이용하여 알람 설정 완료
+ 현재 알람 페이지와 알람 수정 페이지가 같은 곳에 위치 이에 따라 보이는 데이터만 존재하고 수정 여부를 묻는 것을 만들지 고민중
### 2021-05-15
+ 회원 정보 수정 Page 구현
+ API 연동 중에 추가로 개발 예정
+ build용 파일 구현
### 2021-05-17
+ server test 완료
### 2021-05-18
+ 회원 가입 SERVER 연동
### 2021-05-19
+ Login 연동
+ 약병 등록 ,허브 등록 구현
### 2021-05-20
+ 시나리오 수정
### 2021-05-21
+ 약병 ,허브 리스트 출력 구현
### 2021-05-22
+ 약병 검색 기능 구현 중
### 2021-05-23
+ 로그인 하여 메인페이지 과정 구현 완료
+ 폴더 정리
### 2021-05-24
회원 가입 --> 허브 등록 --> 약병 등록 -->로그인 페이지로
로그인 --> 허브 리스트 --> 약병 리스트 --> 메인 페이지
+ 시나리오 수정 완료
+ 메인 페이지 데이터 출력 완료
### 2021-05-25
+ 로그인 권한 문제 해결
### 2021-05-26
+ future buillder 변경
### 2021-05-27
+ app 뒤로가기 설정 변경
### 2021-05-29
+ 약병 리스트 ui 변경
+ DashBoard 새로고침
### 2021-05-30
+ Sqlite 생성
### 2021-06-01
+ datetime 형식 한국 시간으로 변경
### 2021-06-02
+ 약병 , 허브 추가 제거 관리 페이지 구현
SERVER_URL=http://192.168.0.3:4717/api/
\ No newline at end of file
# Miscellaneous
*.class
*.log
*.pyc
*.swp
.DS_Store
.atom/
.buildlog/
.history
.svn/
# IntelliJ related
*.iml
*.ipr
*.iws
.idea/
# The .vscode folder contains launch configuration and tasks you configure in
# VS Code which you may wish to be included in version control, so this line
# is commented out by default.
#.vscode/
# Flutter/Dart/Pub related
**/doc/api/
**/ios/Flutter/.last_build_id
.dart_tool/
.flutter-plugins
.flutter-plugins-dependencies
.packages
.pub-cache/
.pub/
/build/
# Web related
lib/generated_plugin_registrant.dart
# Symbolication related
app.*.symbols
# Obfuscation related
app.*.map.json
# This file tracks properties of this Flutter project.
# Used by Flutter tool to assess capabilities and perform upgrades etc.
#
# This file should be version controlled and should not be manually edited.
version:
revision: 9b2d32b605630f28625709ebd9d78ab3016b2bf6
channel: stable
project_type: app
# flutter_application_1
A new Flutter project.
## Getting Started
This project is a starting point for a Flutter application.
A few resources to get you started if this is your first Flutter project:
- [Lab: Write your first Flutter app](https://flutter.dev/docs/get-started/codelab)
- [Cookbook: Useful Flutter samples](https://flutter.dev/docs/cookbook)
For help getting started with Flutter, view our
[online documentation](https://flutter.dev/docs), which offers tutorials,
samples, guidance on mobile development, and a full API reference.
gradle-wrapper.jar
/.gradle
/captures/
/gradlew
/gradlew.bat
/local.properties
GeneratedPluginRegistrant.java
# Remember to never publicly share your keystore.
# See https://flutter.dev/docs/deployment/android#reference-the-keystore-from-the-app
key.properties
def localProperties = new Properties()
def localPropertiesFile = rootProject.file('local.properties')
if (localPropertiesFile.exists()) {
localPropertiesFile.withReader('UTF-8') { reader ->
localProperties.load(reader)
}
}
def flutterRoot = localProperties.getProperty('flutter.sdk')
if (flutterRoot == null) {
throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
}
def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
if (flutterVersionCode == null) {
flutterVersionCode = '1'
}
def flutterVersionName = localProperties.getProperty('flutter.versionName')
if (flutterVersionName == null) {
flutterVersionName = '1.0'
}
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
android {
compileSdkVersion 29
sourceSets {
main.java.srcDirs += 'src/main/kotlin'
}
lintOptions {
disable 'InvalidPackage'
}
defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "com.example.Smart_Medicine_Box"
minSdkVersion 19
targetSdkVersion 29
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
}
buildTypes {
release {
// TODO: Add your own signing config for the release build.
// Signing with the debug keys for now, so `flutter run --release` works.
signingConfig signingConfigs.debug
}
}
}
flutter {
source '../..'
}
dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
}
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.flutter_application_1">
<!-- Flutter needs it to communicate with the running application
to allow setting breakpoints, to provide hot reload, etc.
-->
<uses-permission android:name="android.permission.INTERNET"/>
</manifest>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.flutter_application_1">
<!-- io.flutter.app.FlutterApplication is an android.app.Application that
calls FlutterMain.startInitialization(this); in its onCreate method.
In most cases you can leave this as-is, but you if you want to provide
additional functionality it is fine to subclass or reimplement
FlutterApplication and put your custom class here. -->
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED"/>
<uses-permission android:name="android.permission.VIBRATE" />
<uses-permission android:name="android.permission.BLUETOOTH" />
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
<application
android:name="io.flutter.app.FlutterApplication"
android:label="Smart_Medicine_Box"
android:icon="@mipmap/ic_launcher">
<activity
android:name=".MainActivity"
android:launchMode="singleTop"
android:theme="@style/LaunchTheme"
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
android:hardwareAccelerated="true"
android:windowSoftInputMode="adjustResize">
<!-- Specifies an Android theme to apply to this Activity as soon as
the Android process has started. This theme is visible to the user
while the Flutter UI initializes. After that, this theme continues
to determine the Window background behind the Flutter UI. -->
<meta-data
android:name="io.flutter.embedding.android.NormalTheme"
android:resource="@style/NormalTheme"
/>
<!-- Displays an Android View that continues showing the launch screen
Drawable until Flutter paints its first frame, then this splash
screen fades out. A splash screen is useful to avoid any visual
gap between the end of Android's launch screen and the painting of
Flutter's first frame. -->
<meta-data
android:name="io.flutter.embedding.android.SplashScreenDrawable"
android:resource="@drawable/launch_background"
/>
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
<receiver android:name="com.dexterous.flutterlocalnotifications.ScheduledNotificationBootReceiver">
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED"/>
<action android:name="android.intent.action.MY_PACKAGE_REPLACED"/>
</intent-filter>
</receiver>
<receiver android:name="com.dexterous.flutterlocalnotifications.ScheduledNotificationReceiver" />
<!-- Don't delete the meta-data below.
This is used by the Flutter tool to generate GeneratedPluginRegistrant.java -->
<meta-data
android:name="flutterEmbedding"
android:value="2" />
</application>
</manifest>
package com.example.flutter_application_1
import io.flutter.embedding.android.FlutterActivity
class MainActivity: FlutterActivity() {
}
<?xml version="1.0" encoding="utf-8"?>
<!-- Modify this file to customize your launch splash screen -->
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@android:color/white" />
<!-- You can insert your own image assets here -->
<!-- <item>
<bitmap
android:gravity="center"
android:src="@mipmap/launch_image" />
</item> -->
</layer-list>
<?xml version="1.0" encoding="utf-8"?>
<resources>
<!-- Theme applied to the Android Window while the process is starting -->
<style name="LaunchTheme" parent="@android:style/Theme.Black.NoTitleBar">
<!-- Show a splash screen on the activity. Automatically removed when
Flutter draws its first frame -->
<item name="android:windowBackground">@drawable/launch_background</item>
</style>
<!-- Theme applied to the Android Window as soon as the process has started.
This theme determines the color of the Android Window while your
Flutter UI initializes, as well as behind your Flutter UI while its
running.
This Theme is only used starting with V2 of Flutter's Android embedding. -->
<style name="NormalTheme" parent="@android:style/Theme.Black.NoTitleBar">
<item name="android:windowBackground">@android:color/white</item>
</style>
</resources>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.flutter_application_1">
<!-- Flutter needs it to communicate with the running application
to allow setting breakpoints, to provide hot reload, etc.
-->
<uses-permission android:name="android.permission.INTERNET"/>
</manifest>
buildscript {
ext.kotlin_version = '1.3.50'
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.5.0'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}
allprojects {
repositories {
google()
jcenter()
}
}
rootProject.buildDir = '../build'
subprojects {
project.buildDir = "${rootProject.buildDir}/${project.name}"
}
subprojects {
project.evaluationDependsOn(':app')
}
task clean(type: Delete) {
delete rootProject.buildDir
}
org.gradle.jvmargs=-Xmx1536M
android.useAndroidX=true
android.enableJetifier=true
android.enableR8=true
#Fri Jun 23 08:50:38 CEST 2017
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.2-all.zip
include ':app'
def localPropertiesFile = new File(rootProject.projectDir, "local.properties")
def properties = new Properties()
assert localPropertiesFile.exists()
localPropertiesFile.withReader("UTF-8") { reader -> properties.load(reader) }
def flutterSdkPath = properties.getProperty("flutter.sdk")
assert flutterSdkPath != null, "flutter.sdk not set in local.properties"
apply from: "$flutterSdkPath/packages/flutter_tools/gradle/app_plugin_loader.gradle"
*.mode1v3
*.mode2v3
*.moved-aside
*.pbxuser
*.perspectivev3
**/*sync/
.sconsign.dblite
.tags*
**/.vagrant/
**/DerivedData/
Icon?
**/Pods/
**/.symlinks/
profile
xcuserdata
**/.generated/
Flutter/App.framework
Flutter/Flutter.framework
Flutter/Flutter.podspec
Flutter/Generated.xcconfig
Flutter/app.flx
Flutter/app.zip
Flutter/flutter_assets/
Flutter/flutter_export_environment.sh
ServiceDefinitions.json
Runner/GeneratedPluginRegistrant.*
# Exceptions to above rules.
!default.mode1v3
!default.mode2v3
!default.pbxuser
!default.perspectivev3
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>$(DEVELOPMENT_LANGUAGE)</string>
<key>CFBundleExecutable</key>
<string>App</string>
<key>CFBundleIdentifier</key>
<string>io.flutter.flutter.app</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>App</string>
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1.0</string>
<key>MinimumOSVersion</key>
<string>8.0</string>
</dict>
</plist>
<?xml version="1.0" encoding="UTF-8"?>
<Workspace
version = "1.0">
<FileRef
location = "group:Runner.xcodeproj">
</FileRef>
</Workspace>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>IDEDidComputeMac32BitWarning</key>
<true/>
</dict>
</plist>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>PreviewsEnabled</key>
<false/>
</dict>
</plist>
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1020"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "97C146ED1CF9000F007C117D"
BuildableName = "Runner.app"
BlueprintName = "Runner"
ReferencedContainer = "container:Runner.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
</Testables>
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "97C146ED1CF9000F007C117D"
BuildableName = "Runner.app"
BlueprintName = "Runner"
ReferencedContainer = "container:Runner.xcodeproj">
</BuildableReference>
</MacroExpansion>
<AdditionalOptions>
</AdditionalOptions>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "97C146ED1CF9000F007C117D"
BuildableName = "Runner.app"
BlueprintName = "Runner"
ReferencedContainer = "container:Runner.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
<AdditionalOptions>
</AdditionalOptions>
</LaunchAction>
<ProfileAction
buildConfiguration = "Profile"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "97C146ED1CF9000F007C117D"
BuildableName = "Runner.app"
BlueprintName = "Runner"
ReferencedContainer = "container:Runner.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>
<?xml version="1.0" encoding="UTF-8"?>
<Workspace
version = "1.0">
<FileRef
location = "group:Runner.xcodeproj">
</FileRef>
</Workspace>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>IDEDidComputeMac32BitWarning</key>
<true/>
</dict>
</plist>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>PreviewsEnabled</key>
<false/>
</dict>
</plist>
import UIKit
import Flutter
@UIApplicationMain
@objc class AppDelegate: FlutterAppDelegate {
override func application(
_ application: UIApplication,
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
) -> Bool {
GeneratedPluginRegistrant.register(with: self)
return super.application(application, didFinishLaunchingWithOptions: launchOptions)
}
}
{
"images" : [
{
"size" : "20x20",
"idiom" : "iphone",
"filename" : "Icon-App-20x20@2x.png",
"scale" : "2x"
},
{
"size" : "20x20",
"idiom" : "iphone",
"filename" : "Icon-App-20x20@3x.png",
"scale" : "3x"
},
{
"size" : "29x29",
"idiom" : "iphone",
"filename" : "Icon-App-29x29@1x.png",
"scale" : "1x"
},
{
"size" : "29x29",
"idiom" : "iphone",
"filename" : "Icon-App-29x29@2x.png",
"scale" : "2x"
},
{
"size" : "29x29",
"idiom" : "iphone",
"filename" : "Icon-App-29x29@3x.png",
"scale" : "3x"
},
{
"size" : "40x40",
"idiom" : "iphone",
"filename" : "Icon-App-40x40@2x.png",
"scale" : "2x"
},
{
"size" : "40x40",
"idiom" : "iphone",
"filename" : "Icon-App-40x40@3x.png",
"scale" : "3x"
},
{
"size" : "60x60",
"idiom" : "iphone",
"filename" : "Icon-App-60x60@2x.png",
"scale" : "2x"
},
{
"size" : "60x60",
"idiom" : "iphone",
"filename" : "Icon-App-60x60@3x.png",
"scale" : "3x"
},
{
"size" : "20x20",
"idiom" : "ipad",
"filename" : "Icon-App-20x20@1x.png",
"scale" : "1x"
},
{
"size" : "20x20",
"idiom" : "ipad",
"filename" : "Icon-App-20x20@2x.png",
"scale" : "2x"
},
{
"size" : "29x29",
"idiom" : "ipad",
"filename" : "Icon-App-29x29@1x.png",
"scale" : "1x"
},
{
"size" : "29x29",
"idiom" : "ipad",
"filename" : "Icon-App-29x29@2x.png",
"scale" : "2x"
},
{
"size" : "40x40",
"idiom" : "ipad",
"filename" : "Icon-App-40x40@1x.png",
"scale" : "1x"
},
{
"size" : "40x40",
"idiom" : "ipad",
"filename" : "Icon-App-40x40@2x.png",
"scale" : "2x"
},
{
"size" : "76x76",
"idiom" : "ipad",
"filename" : "Icon-App-76x76@1x.png",
"scale" : "1x"
},
{
"size" : "76x76",
"idiom" : "ipad",
"filename" : "Icon-App-76x76@2x.png",
"scale" : "2x"
},
{
"size" : "83.5x83.5",
"idiom" : "ipad",
"filename" : "Icon-App-83.5x83.5@2x.png",
"scale" : "2x"
},
{
"size" : "1024x1024",
"idiom" : "ios-marketing",
"filename" : "Icon-App-1024x1024@1x.png",
"scale" : "1x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
{
"images" : [
{
"idiom" : "universal",
"filename" : "LaunchImage.png",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "LaunchImage@2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "LaunchImage@3x.png",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
# Launch Screen Assets
You can customize the launch screen with your own desired assets by replacing the image files in this directory.
You can also do it by opening your Flutter project's Xcode project with `open ios/Runner.xcworkspace`, selecting `Runner/Assets.xcassets` in the Project Navigator and dropping in the desired images.
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="12121" systemVersion="16G29" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" colorMatched="YES" initialViewController="01J-lp-oVM">
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="12089"/>
</dependencies>
<scenes>
<!--View Controller-->
<scene sceneID="EHf-IW-A2E">
<objects>
<viewController id="01J-lp-oVM" sceneMemberID="viewController">
<layoutGuides>
<viewControllerLayoutGuide type="top" id="Ydg-fD-yQy"/>
<viewControllerLayoutGuide type="bottom" id="xbc-2k-c8Z"/>
</layoutGuides>
<view key="view" contentMode="scaleToFill" id="Ze5-6b-2t3">
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<imageView opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" image="LaunchImage" translatesAutoresizingMaskIntoConstraints="NO" id="YRO-k0-Ey4">
</imageView>
</subviews>
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<constraint firstItem="YRO-k0-Ey4" firstAttribute="centerX" secondItem="Ze5-6b-2t3" secondAttribute="centerX" id="1a2-6s-vTC"/>
<constraint firstItem="YRO-k0-Ey4" firstAttribute="centerY" secondItem="Ze5-6b-2t3" secondAttribute="centerY" id="4X2-HB-R7a"/>
</constraints>
</view>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="iYj-Kq-Ea1" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="53" y="375"/>
</scene>
</scenes>
<resources>
<image name="LaunchImage" width="168" height="185"/>
</resources>
</document>
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="10117" systemVersion="15F34" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" initialViewController="BYZ-38-t0r">
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="10085"/>
</dependencies>
<scenes>
<!--Flutter View Controller-->
<scene sceneID="tne-QT-ifu">
<objects>
<viewController id="BYZ-38-t0r" customClass="FlutterViewController" sceneMemberID="viewController">
<layoutGuides>
<viewControllerLayoutGuide type="top" id="y3c-jy-aDJ"/>
<viewControllerLayoutGuide type="bottom" id="wfy-db-euE"/>
</layoutGuides>
<view key="view" contentMode="scaleToFill" id="8bC-Xf-vdC">
<rect key="frame" x="0.0" y="0.0" width="600" height="600"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
</view>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="dkx-z0-nzr" sceneMemberID="firstResponder"/>
</objects>
</scene>
</scenes>
</document>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>$(DEVELOPMENT_LANGUAGE)</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>flutter_application_1</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>$(FLUTTER_BUILD_NAME)</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>$(FLUTTER_BUILD_NUMBER)</string>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>UILaunchStoryboardName</key>
<string>LaunchScreen</string>
<key>UIMainStoryboardFile</key>
<string>Main</string>
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>UISupportedInterfaceOrientations~ipad</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationPortraitUpsideDown</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>UIViewControllerBasedStatusBarAppearance</key>
<false/>
</dict>
</plist>
import 'package:flutter/material.dart';
import './src/screens/Homepage.dart';
import 'package:flutter_dotenv/flutter_dotenv.dart';
Future main() async {
await DotEnv().load('.env');
runApp(MyApp());
}
class MyApp extends StatelessWidget {
// This widget is the root of your application.
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'SMART MEDICINE BOX',
theme: ThemeData(
primarySwatch: Colors.blue,
),
home: HomePage(),
);
}
}
This diff is collapsed. Click to expand it.
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import '../shared/colors.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import './Register/SignInPage.dart';
import 'Register/SignUpLocal.dart';
class HomePage extends StatefulWidget {
HomePage({Key key}) : super(key: key);
@override
_HomePageState createState() => _HomePageState();
}
/// first page class
class _HomePageState extends State<HomePage> {
@override
void initState() {
super.initState();
}
@override
Widget build(BuildContext context) {
final Size size = MediaQuery.of(context).size;
return Scaffold(
body: GestureDetector(
child: Container(
color: Colors.white,
height: size.height,
child: Center(
child: MediaQuery(
data: MediaQuery.of(context).copyWith(textScaleFactor: 1.0),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
Container(
height: size.height * 0.5,
child: Column(
mainAxisAlignment: MainAxisAlignment.end,
children: <Widget>[
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Text(
'SMART MEDICINE BOX',
textScaleFactor: 1.0,
style: TextStyle(
color: Color(0xff004ca2),
fontSize: 30,
fontFamily: 'Noto',
fontWeight: FontWeight.bold),
),
],
),
AnimatedOpacity(
opacity: 1,
duration: Duration(milliseconds: 500),
child: Container(
padding: EdgeInsets.fromLTRB(0, 0, 0, 20),
child: Image.asset('images/main_logo.png',
width: 200, height: 250)),
),
],
),
),
Container(
height: size.height * 0.3,
child: Column(
mainAxisAlignment: MainAxisAlignment.end,
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisSize: MainAxisSize.max,
children: <Widget>[
GestureDetector(
child: Container(
width: size.width * 0.8,
height: 46,
margin: EdgeInsets.only(bottom: 0),
child: FlatButton(
padding: EdgeInsets.fromLTRB(0, 5, 0, 5),
onPressed: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (BuildContext context) =>
SignInPage(),
),
);
},
child: Text(
'로그인',
textScaleFactor: 1.0,
style: TextStyle(
color: Colors.white,
fontSize: 16,
fontFamily: 'Noto',
fontWeight: FontWeight.bold),
),
color: Color(0xff1674f6),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(50)),
),
),
),
GestureDetector(
child: Container(
width: size.width * 0.8,
padding: EdgeInsets.all(0),
child: OutlineButton(
padding: EdgeInsets.fromLTRB(0, 25, 0, 15),
onPressed: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (BuildContext context) =>
SignUpLocal(),
),
);
},
child: Text(
'회원 가입',
textScaleFactor: 1.0,
style:
TextStyle(fontSize: 16, fontFamily: 'Noto'),
),
textColor: Colors.black,
highlightedBorderColor: highlightColor,
borderSide: BorderSide.none,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(50)),
),
),
),
],
),
),
],
),
)),
),
),
backgroundColor: bgColor,
);
}
}
import 'dart:convert';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:http/http.dart' as http;
import 'package:flutter_dotenv/flutter_dotenv.dart';
import '../models/Bottle.dart';
import '../DashBoard.dart';
import '../../utils/user_secure_stoarge.dart';
class BottleList extends StatefulWidget {
BottleList({Key key}) : super(key: key);
@override
_BottleListState createState() => _BottleListState();
}
class _BottleListState extends State<BottleList> {
String valueText;
List<Bottle> _bottleList = new List<Bottle>();
TextEditingController _textFieldController = TextEditingController();
Future<String> getBottleList() async {
String hubid = await UserSecureStorage.getHubId();
String usertoken = await UserSecureStorage.getUserToken();
http.Response response = await http.get(
Uri.encodeFull(
DotEnv().env['SERVER_URL'] + 'bottle/hub/' + hubid.toString()),
headers: {"authorization": usertoken},
);
if (_bottleList.length != 0) {
_bottleList.clear();
}
if (response.statusCode == 200) {
List<dynamic> values = new List<dynamic>();
values = json.decode(response.body);
for (int i = 0; i < values.length; i++) {
Map<String, dynamic> map = values[i];
_bottleList.add(Bottle.fromJson(map));
}
return "GET";
} else if (response.statusCode == 404) {
return "Not Found";
} else {
return "Error";
}
}
Widget build(BuildContext context) {
final Size size = MediaQuery.of(context).size;
return WillPopScope(
child: Scaffold(
appBar: AppBar(
backgroundColor: Colors.white,
leading: new Icon(Icons.medical_services_rounded,
color: Colors.black, size: 45.0),
title: Text(
'Smart Medicine Box',
style: TextStyle(
color: Colors.black,
fontSize: 23,
fontFamily: 'Noto',
fontWeight: FontWeight.bold),
),
),
body: FutureBuilder(
future: getBottleList(),
builder: (BuildContext context, AsyncSnapshot snapshot) {
if (snapshot.hasData == false) {
return CircularProgressIndicator();
} else if (snapshot.hasError) {
return Padding(
padding: const EdgeInsets.all(8.0),
child: Text(
'Error: ${snapshot.error}',
style: TextStyle(fontSize: 15),
),
);
} else {
return Container(
height: size.height,
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
SizedBox(height: 10),
Container(
height: size.height * 0.07,
width: size.width,
child: Center(
child: Text(
'등록된 약병 리스트',
textScaleFactor: 1.0,
style: TextStyle(
fontSize: 28,
fontFamily: 'Noto',
fontWeight: FontWeight.bold),
),
),
),
SizedBox(height: 10),
Expanded(
child: GridView.builder(
padding: const EdgeInsets.all(30),
itemCount:
_bottleList.length == null ? 0 : _bottleList.length,
gridDelegate: SliverGridDelegateWithMaxCrossAxisExtent(
maxCrossAxisExtent: 200,
crossAxisSpacing: 10,
mainAxisSpacing: 10,
),
itemBuilder: (BuildContext context, int index) {
return InkResponse(
splashColor: Colors.transparent,
child: Container(
height: 140,
padding: const EdgeInsets.all(10),
decoration: BoxDecoration(
border: Border.all(),
borderRadius: BorderRadius.all(
Radius.circular(16.0),
),
),
child: Column(
children: [
Container(
decoration: BoxDecoration(
border: Border(
bottom: BorderSide(
color: Colors.black,
width: 1,
style: BorderStyle.solid),
),
),
height: 40,
child: Row(
mainAxisAlignment:
MainAxisAlignment.spaceBetween,
children: [
Container(
height: 40,
child: Center(
child: Text(
'${_bottleList[index].bottleId}',
style: TextStyle(
color: Colors.black,
fontSize: 20,
fontFamily: 'Noto',
fontWeight: FontWeight.bold),
),
),
),
Container(
child: IconButton(
alignment: Alignment(0.9, 0),
icon: Icon(
Icons.create_sharp,
color: Colors.black,
),
onPressed: () {},
),
),
],
),
),
SizedBox(height: 10),
Container(
height: 90,
child: Icon(
Icons.medical_services_outlined,
size: 100,
),
)
],
),
),
onTap: () {
UserSecureStorage.setBottleId(
_bottleList[index].bottleId.toString());
UserSecureStorage.setMedicineId(
_bottleList[index].medicineId.toString());
Navigator.push(
context,
MaterialPageRoute(
builder: (BuildContext context) => DashBoard(
pageNumber: 0,
),
),
);
},
);
},
),
)
],
),
);
}
},
),
),
onWillPop: () {
SystemNavigator.pop();
},
);
}
}
import 'package:Smart_Medicine_Box/src/screens/DashBoard.dart';
import 'package:Smart_Medicine_Box/src/screens/Homepage.dart';
import 'package:flutter/material.dart';
import 'package:flutter/cupertino.dart';
import 'dart:convert';
import 'package:http/http.dart' as http;
import 'package:flutter_dotenv/flutter_dotenv.dart';
import '../models/Medicine.dart';
import '../../utils/user_secure_stoarge.dart';
class DetailMedicine extends StatefulWidget {
Medicine searchMedicine;
String bottleId;
DetailMedicine({Key key, this.searchMedicine, this.bottleId})
: super(key: key);
@override
_DetailMedicineState createState() => _DetailMedicineState();
}
class _DetailMedicineState extends State<DetailMedicine> {
final medicineDosageController = TextEditingController();
//약 등록
Future<String> patchMedcine() async {
String usertoken = await UserSecureStorage.getUserToken();
http.Response response = await http.patch(
Uri.encodeFull(
DotEnv().env['SERVER_URL'] + 'bottle/' + widget.bottleId),
headers: {
"Content-Type": "application/json",
"authorization": usertoken
},
body: jsonEncode({
'medicineId': widget.searchMedicine.medicineId,
'dosage': medicineDosageController.text
}));
if (response.statusCode == 200) {
String usertoken = await UserSecureStorage.setMedicineId(
widget.searchMedicine.medicineId.toString());
return "Complete";
} else if (response.statusCode == 404) {
return "약병이 존재하지 않습니다.";
} else if (response.statusCode == 403) {
return "약병에 접근할 권한이 없습니다.";
} else {
return "알 수 없는 오류";
}
}
Widget build(BuildContext context) {
final Size size = MediaQuery.of(context).size;
return MaterialApp(
home: Scaffold(
appBar: AppBar(
backgroundColor: Colors.white,
leading: new Icon(Icons.medical_services_rounded,
color: Colors.black, size: 45.0),
title: Text(
'Smart Medicine Box',
style: TextStyle(
color: Colors.black,
fontSize: 23,
fontFamily: 'Noto',
fontWeight: FontWeight.bold),
),
),
body: SingleChildScrollView(
scrollDirection: Axis.vertical,
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
SizedBox(height: 30),
Container(
padding: EdgeInsets.fromLTRB(5, 5, 5, 5),
height: size.height * 0.08,
width: size.width,
child: Center(
child: Text(
'세부 약 정보',
textAlign: TextAlign.center,
textScaleFactor: 1.0,
style: TextStyle(
color: Colors.black,
fontSize: 36,
fontFamily: 'NotoSansKR',
fontWeight: FontWeight.w700),
),
),
),
SizedBox(height: 5),
Container(
width: size.width,
padding: EdgeInsets.fromLTRB(5, 0, 5, 5),
margin: EdgeInsets.all(15),
decoration: BoxDecoration(
border: Border.all(),
borderRadius: BorderRadius.all(
Radius.circular(25.0) // <--- border radius here
),
),
child: Column(
children: [
SizedBox(height: 40),
Container(
child: Center(
child: Text(widget.searchMedicine.name,
style: TextStyle(
color: Colors.black,
fontSize: 24,
fontFamily: 'NotoSansKR',
fontWeight: FontWeight.w700)),
),
),
SizedBox(height: 15),
Container(
width: size.width,
alignment: Alignment(0.9, 0),
child: Text(
'제조사: ' + widget.searchMedicine.company,
style: TextStyle(
color: Colors.grey,
fontSize: 20,
),
),
),
SizedBox(height: 30),
Container(
width: size.width,
padding: EdgeInsets.fromLTRB(5, 0, 5, 0),
alignment: Alignment(-1, 0),
child: Text(
'타겟 층 : ' + widget.searchMedicine.target,
style: TextStyle(color: Colors.black, fontSize: 16),
),
),
SizedBox(height: 15),
Container(
width: size.width,
padding: EdgeInsets.fromLTRB(5, 0, 5, 0),
alignment: Alignment(-1, 0),
child: Text(
'복약 정보 : ' + widget.searchMedicine.dosage,
style: TextStyle(color: Colors.black, fontSize: 16),
),
),
SizedBox(height: 10),
Container(
width: size.width,
padding: EdgeInsets.fromLTRB(5, 10, 5, 10),
alignment: Alignment(-1, 0),
child: Column(
children: [
SizedBox(
height: 12,
),
Container(
width: size.width,
child: Text(
'경고',
style: TextStyle(
color: Colors.redAccent, fontSize: 14),
),
),
SizedBox(height: 12),
Container(
width: size.width,
child: Text(
widget.searchMedicine.warn,
style: TextStyle(
color: Colors.redAccent, fontSize: 14),
),
),
],
),
),
],
),
),
SizedBox(height: 12),
Container(
height: size.height * 0.1,
padding: const EdgeInsets.fromLTRB(20, 10, 20, 5),
child: TextFormField(
keyboardType: TextInputType.text,
controller: medicineDosageController,
decoration: InputDecoration(
border: OutlineInputBorder(),
errorBorder: InputBorder.none,
disabledBorder: InputBorder.none,
hintText: '하루에 섭취할 적정 복용량을 숫자만 입력하세요',
),
style: TextStyle(
fontSize: 16,
fontFamily: 'NotoSansKR',
fontWeight: FontWeight.w600)),
),
SizedBox(height: 12),
Container(
height: size.height * 0.07,
width: size.width * 0.8,
child: FlatButton(
padding: EdgeInsets.fromLTRB(0, 5, 0, 5),
onPressed: () async {
String saveMessage = await patchMedcine();
if (saveMessage == "Complete") {
showDialog(
context: context,
builder: (BuildContext context) {
return AlertDialog(
title: new Text('약 등록'),
content: new Text('약 등록이 완료 되었습니다.'),
actions: <Widget>[
new FlatButton(
child: new Text('Close'),
onPressed: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (BuildContext context) =>
DashBoard(
pageNumber: 1,
),
),
);
})
],
);
});
}
},
child: Text(
'약 등록',
textScaleFactor: 1.0,
style: TextStyle(
color: Colors.white,
fontSize: 20,
fontFamily: 'Noto',
fontWeight: FontWeight.bold),
),
color: Color(0xff1674f6),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(50)),
),
),
SizedBox(height: 30)
],
),
),
),
);
}
}
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'dart:convert';
import 'package:http/http.dart' as http;
import 'package:flutter_dotenv/flutter_dotenv.dart';
// Screen import
import 'RegisterBottle.dart';
import '../models/Bottle.dart';
import 'BottleList.dart';
import '../../utils/user_secure_stoarge.dart';
class HubList extends StatefulWidget {
List<int> hublist;
HubList({Key key, this.hublist}) : super(key: key);
@override
_HubListState createState() => _HubListState();
}
class _HubListState extends State<HubList> {
List<Bottle> _bottleList = new List<Bottle>();
//Get BottleList
Future<String> getBottleList(int hubid) async {
String usertoken = await UserSecureStorage.getUserToken();
http.Response response = await http.get(
Uri.encodeFull(
DotEnv().env['SERVER_URL'] + 'bottle/hub/' + hubid.toString()),
headers: {"authorization": usertoken},
);
if (_bottleList.length != 0) {
_bottleList.clear();
}
if (response.statusCode == 200) {
List<dynamic> values = new List<dynamic>();
values = json.decode(response.body);
for (int i = 0; i < values.length; i++) {
Map<String, dynamic> map = values[i];
_bottleList.add(Bottle.fromJson(map));
return "GET";
}
} else if (response.statusCode == 404) {
return "Not Found";
} else {
return "Error";
}
return "Error";
}
Widget build(BuildContext context) {
final Size size = MediaQuery.of(context).size;
return Scaffold(
appBar: AppBar(
backgroundColor: Colors.white,
leading: new Icon(Icons.medical_services_rounded,
color: Colors.black, size: 45.0),
title: Text(
'Smart Medicine Box',
style: TextStyle(
color: Colors.black,
fontSize: 23,
fontFamily: 'Noto',
fontWeight: FontWeight.bold),
),
),
body: Container(
height: size.height,
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Container(
height: size.height * 0.1,
width: size.width,
child: Center(
child: Text(
'등록된 허브 리스트',
textScaleFactor: 1.0,
style: TextStyle(
fontSize: 28,
fontFamily: 'Noto',
fontWeight: FontWeight.bold),
),
),
decoration: BoxDecoration(border: Border.all()),
),
SizedBox(height: 30),
Expanded(
child: ListView.separated(
padding: const EdgeInsets.all(30),
itemCount: widget.hublist.length,
itemBuilder: (BuildContext context, int index) {
return Container(
padding: EdgeInsets.all(8.0),
decoration: BoxDecoration(
border: Border.all(),
borderRadius: BorderRadius.all(Radius.circular(25.0)),
),
child: ListTile(
title: Text(
'HUB ID: ' + '${widget.hublist[index]}',
style: TextStyle(
color: Colors.black,
fontSize: 20,
fontFamily: 'Noto',
fontWeight: FontWeight.bold),
),
trailing: Icon(Icons.arrow_forward),
onTap: () async {
//허브 id로 가져와서 있으면 바로 넘기기
var result =
await getBottleList(widget.hublist[index]);
if (result == "GET") {
UserSecureStorage.setHubId(
widget.hublist[index].toString());
Navigator.push(
context,
MaterialPageRoute(
builder: (BuildContext context) =>
BottleList(),
));
} else if (result == "Not Found") {
showDialog(
context: context,
builder: (BuildContext context) {
return AlertDialog(
title: new Text('Error'),
content: new Text('등록된 약병이 없습니다.'),
actions: <Widget>[
new FlatButton(
child: new Text('등록'),
onPressed: () {
UserSecureStorage.setHubId(
widget.hublist[index].toString());
Navigator.push(
context,
MaterialPageRoute(
builder:
(BuildContext context) =>
RegisterBottle(),
));
})
],
);
},
);
}
},
),
);
},
separatorBuilder: (BuildContext contetx, int index) =>
const Divider(),
),
)
],
)),
);
}
}
import 'package:Smart_Medicine_Box/src/screens/DashBoard.dart';
import 'package:Smart_Medicine_Box/src/screens/Register/BottleList.dart';
import 'package:flutter/cupertino.dart';
import 'dart:convert';
import 'package:flutter/material.dart';
import 'package:http/http.dart' as http;
import 'package:flutter_dotenv/flutter_dotenv.dart';
import 'SearchMedicine.dart';
import '../../utils/user_secure_stoarge.dart';
class RegisterBottle extends StatefulWidget {
final String hubid;
final bool modify_bottle;
RegisterBottle({Key key, this.hubid, this.modify_bottle}) : super(key: key);
@override
_RegisterBottleState createState() => _RegisterBottleState();
}
class _RegisterBottleState extends State<RegisterBottle> {
final medicineBottleIDController = TextEditingController();
Future<String> registerhub_Validate() async {
String usertoken = await UserSecureStorage.getUserToken();
String hubid = await UserSecureStorage.getHubId();
http.Response bottleresponse = await http.post(
Uri.encodeFull(DotEnv().env['SERVER_URL'] + 'bottle'),
headers: {
"Content-Type": "application/json",
"authorization": usertoken
},
body: jsonEncode(
{'bottleId': medicineBottleIDController.text, 'hubId': hubid}));
if (bottleresponse.statusCode == 201) {
return "등록 완료";
} else if (bottleresponse.statusCode == 404) {
return "Hub 없음";
} else if (bottleresponse.statusCode == 403) {
return "유저 정보 없음 ";
} else if (bottleresponse.statusCode == 404) {
return "HOST 없음";
} else {
return "오류";
}
}
Widget build(BuildContext context) {
final Size size = MediaQuery.of(context).size;
// int goals = 60;
// int points = 75;
return Scaffold(
backgroundColor: Colors.white,
body: ListView(
children: <Widget>[
Padding(
padding: const EdgeInsets.fromLTRB(20, 25, 20, 0),
child: Row(
children: <Widget>[
Text(
'약병 등록',
textScaleFactor: 1.0,
style: TextStyle(fontSize: 34),
)
],
),
),
Padding(
padding: const EdgeInsets.fromLTRB(20, 10, 20, 0),
child: Row(
children: <Widget>[
Text(
'SmartMedicine 회원가입',
textScaleFactor: 1.0,
style: TextStyle(fontSize: 16),
)
],
),
),
MediaQuery(
data: MediaQuery.of(context).copyWith(textScaleFactor: 1.0),
child: Container(
height: size.height * 0.6,
child: Padding(
padding: const EdgeInsets.fromLTRB(20, 5, 20, 20),
child: new Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
TextFormField(
keyboardType: TextInputType.text,
controller: medicineBottleIDController,
decoration: InputDecoration(
labelText: '약병 ID',
helperText: '현재 사용하시는 약병의 고유번호를 입력하세요',
),
),
],
),
),
),
),
Container(
height: 80,
padding: const EdgeInsets.fromLTRB(20, 20, 20, 20),
child: RaisedButton(
onPressed: () async {
String saveMessage = await registerhub_Validate();
print(saveMessage);
print(widget.modify_bottle);
if (saveMessage == "등록 완료" && widget.modify_bottle == false) {
showDialog(
context: context,
builder: (BuildContext context) {
return AlertDialog(
title: new Text('약병 등록'),
content: new Text('약병 등록이 완료 되었습니다.'),
actions: <Widget>[
new FlatButton(
child: new Text('Close'),
onPressed: () {
UserSecureStorage.setBottleId(
medicineBottleIDController.text);
Navigator.push(
context,
MaterialPageRoute(
builder: (BuildContext context) =>
SearchMedicine(
bottleId: medicineBottleIDController.text,
),
),
);
},
),
],
);
},
);
} else if (saveMessage == "등록 완료" &&
widget.modify_bottle == true) {
print('asdg');
await showDialog(
context: context,
builder: (BuildContext context) {
return AlertDialog(
title: new Text('약병 등록'),
content: new Text('약병 등록이 완료 되었습니다.'),
actions: <Widget>[
new FlatButton(
child: new Text('Close'),
onPressed: () {
Navigator.of(context).pop();
},
),
],
);
},
);
Navigator.of(context).pop();
} else {
showDialog(
context: context,
builder: (BuildContext context) {
return AlertDialog(
title: new Text('오류'),
content: new Text(saveMessage),
actions: <Widget>[
new FlatButton(
child: new Text('Close'),
onPressed: () {
Navigator.of(context).pop();
},
)
],
);
},
);
}
},
shape: RoundedRectangleBorder(
borderRadius: new BorderRadius.circular(18.0),
side: BorderSide(color: Colors.blue)),
color: Color(0xff1674f6),
child: Text(
'약병 등록',
textScaleFactor: 1.0,
style: TextStyle(
fontSize: 16,
color: Colors.white,
fontWeight: FontWeight.bold),
),
),
)
],
),
);
}
}
import 'package:Smart_Medicine_Box/src/screens/SettingPage/HubModifyList.dart';
import 'package:flutter/cupertino.dart';
import 'dart:convert';
import 'package:flutter/material.dart';
import 'package:http/http.dart' as http;
import 'package:flutter_dotenv/flutter_dotenv.dart';
import 'RegisterBottle.dart';
import '../../utils/user_secure_stoarge.dart';
class RegisterHub extends StatefulWidget {
final int modify_hub;
RegisterHub({Key key, this.modify_hub}) : super(key: key);
@override
_RegisterHubState createState() => _RegisterHubState();
}
class _RegisterHubState extends State<RegisterHub> {
final medicineBottleIDController = TextEditingController();
final medicineHubIDController = TextEditingController();
final medicineHubPortController = TextEditingController();
final medicineHubHostController = TextEditingController();
Future<String> registerhub_Validate() async {
String usertoken = await UserSecureStorage.getUserToken();
http.Response hubresponse = await http.post(
Uri.encodeFull(DotEnv().env['SERVER_URL'] + 'hub'),
headers: {
"Content-Type": "application/json",
"authorization": usertoken
},
body: jsonEncode({
'hubId': medicineHubIDController.text,
'host': medicineHubHostController.text,
'port': medicineHubPortController.text,
}));
print(hubresponse.statusCode);
if (hubresponse.statusCode == 201) {
return "허브 등록 완료";
} else if (hubresponse.statusCode == 409) {
return "이미 존재하는 hub";
} else {
return "오류";
}
}
Widget build(BuildContext context) {
final Size size = MediaQuery.of(context).size;
// int goals = 60;
// int points = 75;
return Scaffold(
backgroundColor: Colors.white,
body: ListView(
children: <Widget>[
Padding(
padding: const EdgeInsets.fromLTRB(20, 25, 20, 0),
child: Row(
children: <Widget>[
Text(
'허브 등록',
textScaleFactor: 1.0,
style: TextStyle(fontSize: 34),
)
],
),
),
Padding(
padding: const EdgeInsets.fromLTRB(20, 10, 20, 0),
child: Row(
children: <Widget>[
Text(
'SmartMedicine 허브 등록',
textScaleFactor: 1.0,
style: TextStyle(fontSize: 16),
)
],
),
),
MediaQuery(
data: MediaQuery.of(context).copyWith(textScaleFactor: 1.0),
child: Container(
height: size.height * 0.6,
child: Padding(
padding: const EdgeInsets.fromLTRB(20, 5, 20, 20),
child: new Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
TextFormField(
keyboardType: TextInputType.text,
controller: medicineHubIDController,
decoration: InputDecoration(
labelText: '허브 ID',
helperText: '현자 등록하시는 허브의 고유 번호를 입력하세요',
),
),
TextFormField(
keyboardType: TextInputType.text,
controller: medicineHubHostController,
decoration: InputDecoration(
labelText: 'Host',
helperText: '현재 사용하시는 허브의 HOST를 입력하세요',
),
),
TextFormField(
keyboardType: TextInputType.text,
controller: medicineHubPortController,
decoration: InputDecoration(
labelText: 'Port',
helperText: '현재 사용하시는 허브의 PORT를 입력하세요',
),
),
],
),
),
),
),
Container(
height: 80,
padding: const EdgeInsets.fromLTRB(20, 20, 20, 20),
child: RaisedButton(
onPressed: () async {
String saveMessage = await registerhub_Validate();
print(saveMessage);
print(widget.modify_hub);
if (saveMessage == "허브 등록 완료" && widget.modify_hub == 0) {
UserSecureStorage.setHubId(medicineHubIDController.text);
Navigator.push(
context,
MaterialPageRoute(
builder: (BuildContext context) => RegisterBottle(
hubid: medicineHubIDController.text,
modify_bottle: false,
),
),
);
} else if (saveMessage == "허브 등록 완료" &&
widget.modify_hub == 1) {
Navigator.of(context).pop();
} else {
showDialog(
context: context,
builder: (BuildContext context) {
return AlertDialog(
title: new Text('오류'),
content: new Text(saveMessage),
actions: <Widget>[
new FlatButton(
child: new Text('close'),
onPressed: () {
Navigator.of(context).pop();
},
)
],
);
},
);
}
},
shape: RoundedRectangleBorder(
borderRadius: new BorderRadius.circular(18.0),
side: BorderSide(color: Colors.blue)),
color: Color(0xff1674f6),
child: Text(
'허브 등록 ',
textScaleFactor: 1.0,
style: TextStyle(
fontSize: 16,
color: Colors.white,
fontWeight: FontWeight.bold),
),
),
)
],
),
);
}
}
import 'dart:convert';
import 'package:Smart_Medicine_Box/src/screens/Homepage.dart';
import 'package:flutter/material.dart';
import 'package:http/http.dart' as http;
import 'package:flutter_dotenv/flutter_dotenv.dart';
import 'RegsiterHub.dart';
class SignUpLocal extends StatefulWidget {
@override
_SignUpLocalState createState() => _SignUpLocalState();
}
class _SignUpLocalState extends State<SignUpLocal> {
final emailController = TextEditingController();
final passwordController = TextEditingController();
final passwordValidController = TextEditingController();
bool _validate = false;
int userRole = 0;
// Initially password is obscure
bool passwordVisible = false;
bool passwordValidationVisible = false;
Future<String> signup_Validate() async {
http.Response response = await http.post(
Uri.encodeFull(DotEnv().env['SERVER_URL'] + 'auth/register'),
headers: {"Content-Type": "application/json"},
body: jsonEncode(
{
'userId': emailController.text,
'password': passwordController.text,
'passwordCheck': passwordValidController.text
},
),
);
if (response.statusCode == 201) {
return "정보 입력 완료";
} else {
return "오류";
}
}
@override
Widget build(BuildContext context) {
final Size size = MediaQuery.of(context).size;
// int goals = 60;
// int points = 75;
return Scaffold(
backgroundColor: Colors.white,
body: ListView(
children: <Widget>[
Padding(
padding: const EdgeInsets.fromLTRB(20, 25, 20, 0),
child: Row(
children: <Widget>[
Text(
'회원 가입',
textScaleFactor: 1.0,
style: TextStyle(fontSize: 34),
)
],
),
),
Padding(
padding: const EdgeInsets.fromLTRB(20, 10, 20, 0),
child: Row(
children: <Widget>[
Text(
'SmartMedicine 회원가입',
textScaleFactor: 1.0,
style: TextStyle(fontSize: 16),
)
],
),
),
MediaQuery(
data: MediaQuery.of(context).copyWith(textScaleFactor: 1.0),
child: Container(
height: size.height * 0.6,
child: Padding(
padding: const EdgeInsets.fromLTRB(20, 5, 20, 20),
child: new Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
TextFormField(
controller: emailController,
keyboardType: TextInputType.text,
decoration: InputDecoration(
labelText: '이메일',
helperText: '아아디로 사용할 이메일 주소를 입력해주세요.',
),
),
TextFormField(
keyboardType: TextInputType.text,
controller: passwordController,
obscureText:
!passwordVisible, //This will obscure text dynamically
decoration: InputDecoration(
labelText: '비밀번호',
helperText: '비밀번호를 입력해주세요',
// Here is key idea
suffixIcon: IconButton(
icon: Icon(
// Based on passwordVisible state choose the icon
passwordVisible
? Icons.visibility
: Icons.visibility_off,
color: Theme.of(context).primaryColorDark,
),
onPressed: () {
// Update the state i.e. toogle the state of passwordVisible variable
setState(() {
passwordVisible = !passwordVisible;
});
},
),
),
),
TextFormField(
onChanged: (text) {
if (passwordController.text == text) {
setState(() {
_validate = false;
});
} else {
setState(() {
_validate = true;
});
}
},
keyboardType: TextInputType.text,
controller: passwordValidController,
obscureText:
!passwordValidationVisible, //This will obscure text dynamically
decoration: InputDecoration(
labelText: '비밀번호 확인',
helperText: '비밀번호를 확인해주세요',
errorText:
_validate ? '두 비밀번호가 다릅니다. 다시 확인해주세요.' : null,
// Here is key idea
suffixIcon: IconButton(
icon: Icon(
// Based on passwordVisible state choose the icon
passwordValidationVisible
? Icons.visibility
: Icons.visibility_off,
color: Theme.of(context).primaryColorDark,
),
onPressed: () {
// Update the state i.e. toogle the state of passwordVisible variable
setState(() {
passwordValidationVisible =
!passwordValidationVisible;
});
},
),
),
),
],
),
),
),
),
Container(
height: 80,
padding: const EdgeInsets.fromLTRB(20, 20, 20, 20),
child: RaisedButton(
onPressed: () async {
String saveMessage = await signup_Validate();
if (saveMessage == "정보 입력 완료") {
showDialog(
context: context,
builder: (BuildContext context) {
return AlertDialog(
title: new Text('회원 가입'),
content: new Text('회원 가입이 완료 되었습니다.'),
actions: <Widget>[
new FlatButton(
child: new Text('Close'),
onPressed: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (BuildContext context) =>
HomePage()));
})
],
);
});
} else {
showDialog(
context: context,
builder: (BuildContext context) {
return AlertDialog(
title: new Text('회원 가입 오류'),
content: new Text('정확한 이메일, 비밀번호를 입력해 주세요.'),
actions: <Widget>[
new FlatButton(
child: new Text('Close'),
onPressed: () {
Navigator.of(context).pop();
})
],
);
});
}
},
shape: RoundedRectangleBorder(
borderRadius: new BorderRadius.circular(18.0),
side: BorderSide(color: Colors.blue)),
color: Color(0xff1674f6),
child: Text(
'회원 가입',
textScaleFactor: 1.0,
style: TextStyle(
fontSize: 16,
color: Colors.white,
fontWeight: FontWeight.bold),
),
),
)
],
),
bottomNavigationBar: BottomAppBar(
elevation: 0,
child: Container(
height: 70,
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
children: <Widget>[
Padding(
padding: const EdgeInsets.fromLTRB(70, 0, 70, 0),
child: Text(
'회원 가입시, 이용 약관 및 개인정보 처리 방침에 동의하는 것으로 간주합니다..',
style: TextStyle(fontSize: 12, color: Color(0xff747474)),
textAlign: TextAlign.center,
),
)
],
),
),
),
);
}
}
import 'package:Smart_Medicine_Box/src/screens/SettingPage/HubModifyList.dart';
import 'package:flutter/material.dart';
import 'package:Smart_Medicine_Box/src/screens/DashBoard.dart';
import 'package:Smart_Medicine_Box/src/screens/SettingPage/Alarm.dart';
import 'package:Smart_Medicine_Box/src/screens/SettingPage/DEVInformation.dart';
import 'package:Smart_Medicine_Box/src/screens/SettingPage/BottleModifyList.dart';
class SettingPage extends StatefulWidget {
@override
_SettingPageState createState() => _SettingPageState();
}
class _SettingPageState extends State<SettingPage> {
Widget build(BuildContext context) {
final Size size = MediaQuery.of(context).size;
return MaterialApp(
title: 'Welcome to Flutter',
home: Scaffold(
appBar: AppBar(
iconTheme: IconThemeData(color: Colors.black),
backgroundColor: Colors.white,
title: Text(
'Smart Medicine Box',
style: TextStyle(
color: Colors.black,
fontSize: 20,
fontFamily: 'Noto',
fontWeight: FontWeight.bold),
),
actions: [
IconButton(
icon: Icon(
Icons.settings,
color: Colors.black,
),
onPressed: () {},
)
],
),
drawer: Drawer(
child: ListView(
children: [
DrawerHeader(
child: Text('Drawer Header'),
decoration: BoxDecoration(
color: Colors.blue,
),
),
ListTile(
title: Text('Test 1'),
onTap: () {},
),
ListTile(
title: Text('Test 2'),
onTap: () {},
),
ListTile(
title: Text('Test 3'),
onTap: () {},
),
],
),
),
body: Container(
height: size.height * 0.9,
margin: EdgeInsets.fromLTRB(0, 30, 0, 0),
padding: EdgeInsets.fromLTRB(5, 0, 5, 5),
child: Column(
children: <Widget>[
Container(
padding: EdgeInsets.fromLTRB(5, 5, 5, 5),
height: size.height * 0.08,
width: size.width,
child: Center(
child: Text(
'Setting',
textAlign: TextAlign.center,
textScaleFactor: 1.0,
style: TextStyle(
color: Colors.black,
fontSize: 32,
fontFamily: 'NotoSansKR',
fontWeight: FontWeight.w700),
),
),
),
Container(
height: size.height * 0.6,
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
Container(
padding: EdgeInsets.fromLTRB(0, 20, 0, 20),
width: size.width * 0.8,
height: size.height * 0.13,
margin: EdgeInsets.only(bottom: 0),
child: FlatButton(
height: size.height * 0.07,
onPressed: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (BuildContext context) => Alarm(),
));
},
child: Text(
'알림 설정',
textScaleFactor: 1.0,
style: TextStyle(
color: Colors.white,
fontSize: 24,
fontFamily: 'Noto',
fontWeight: FontWeight.bold),
),
color: Color(0xff0B1E33),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(50)),
),
),
Container(
padding: EdgeInsets.fromLTRB(0, 20, 0, 20),
width: size.width * 0.8,
height: size.height * 0.13,
margin: EdgeInsets.only(bottom: 0),
child: FlatButton(
height: size.height * 0.07,
onPressed: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (BuildContext context) =>
HubModifyList(),
));
},
child: Text(
'허브 관리',
textScaleFactor: 1.0,
style: TextStyle(
color: Colors.white,
fontSize: 24,
fontFamily: 'Noto',
fontWeight: FontWeight.bold),
),
color: Color(0xff0B1E33),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(50)),
),
),
Container(
padding: EdgeInsets.fromLTRB(0, 20, 0, 20),
width: size.width * 0.8,
height: size.height * 0.13,
margin: EdgeInsets.only(bottom: 0),
child: FlatButton(
height: size.height * 0.07,
onPressed: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (BuildContext context) =>
BottleModifyList(),
));
},
child: Text(
'약병 관리',
textScaleFactor: 1.0,
style: TextStyle(
color: Colors.white,
fontSize: 24,
fontFamily: 'Noto',
fontWeight: FontWeight.bold),
),
color: Color(0xff0B1E33),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(50)),
),
),
],
),
),
],
),
),
bottomNavigationBar: BottomNavigationBar(
type: BottomNavigationBarType.fixed,
backgroundColor: Colors.grey,
selectedItemColor: Colors.white.withOpacity(.60),
unselectedItemColor: Colors.white.withOpacity(.60),
selectedFontSize: 14,
unselectedFontSize: 14,
currentIndex: 0,
onTap: (int index) => {
setState(
() {
Navigator.push(
context,
MaterialPageRoute(
builder: (BuildContext context) =>
DashBoard(pageNumber: index),
),
);
},
)
},
items: [
BottomNavigationBarItem(
icon: Icon(Icons.device_thermostat), label: 'In'),
BottomNavigationBarItem(icon: Icon(Icons.home), label: 'Home'),
BottomNavigationBarItem(
label: 'Out',
icon: Icon(Icons.access_time),
)
],
),
),
);
}
}
import 'package:flutter/material.dart';
import 'package:Smart_Medicine_Box/src/screens/SettingPage.dart';
class DEVInformation extends StatefulWidget {
@override
_DEVInformationState createState() => _DEVInformationState();
}
class _DEVInformationState extends State<DEVInformation> {
Widget build(BuildContext context) {
final Size size = MediaQuery.of(context).size;
return Scaffold(
appBar: AppBar(
iconTheme: IconThemeData(color: Colors.black),
backgroundColor: Colors.white,
title: Text(
'Smart Medicine Box',
style: TextStyle(
color: Colors.black,
fontSize: 20,
fontFamily: 'Noto',
fontWeight: FontWeight.bold),
),
actions: [
IconButton(
icon: Icon(
Icons.settings,
color: Colors.black,
),
onPressed: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (BuildContext context) => SettingPage(),
));
},
)
],
),
body: Text('1234'),
);
}
}
import 'package:Smart_Medicine_Box/src/screens/Register/RegsiterHub.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'dart:convert';
import 'package:http/http.dart' as http;
import 'package:flutter_dotenv/flutter_dotenv.dart';
// Screen import
import '../../utils/user_secure_stoarge.dart';
class HubModifyList extends StatefulWidget {
List<int> hublist;
HubModifyList({Key key, this.hublist}) : super(key: key);
@override
_HubModifyListState createState() => _HubModifyListState();
}
class _HubModifyListState extends State<HubModifyList> {
List<int> _hublist = new List<int>();
//Get Hub List 함수
Future<String> getHubList() async {
String usertoken = await UserSecureStorage.getUserToken();
http.Response response = await http.get(
Uri.encodeFull(DotEnv().env['SERVER_URL'] + 'hub'),
headers: {"authorization": usertoken},
);
List<dynamic> values = new List<dynamic>();
if (_hublist.length != 0) {
_hublist.clear();
}
if (response.statusCode == 200) {
values = json.decode(response.body);
for (int i = 0; i < values.length; i++) {
_hublist.add(values[i]['hubId']);
}
print(_hublist);
return "get완료";
} else if (response.statusCode == 404) {
return "Not Found";
} else {
return "Error";
}
}
Future<String> deleteHub(int index) async {
String usertoken = await UserSecureStorage.getUserToken();
http.Response response = await http.delete(
Uri.encodeFull(DotEnv().env['SERVER_URL'] + 'hub/' + index.toString()),
headers: {"authorization": usertoken},
);
if (response.statusCode == 204) {
return "Delete";
} else {
return "Error";
}
}
Widget build(BuildContext context) {
final Size size = MediaQuery.of(context).size;
return Scaffold(
appBar: AppBar(
backgroundColor: Colors.white,
leading: new Icon(Icons.medical_services_rounded,
color: Colors.black, size: 45.0),
title: Text(
'Smart Medicine Box',
style: TextStyle(
color: Colors.black,
fontSize: 23,
fontFamily: 'Noto',
fontWeight: FontWeight.bold),
),
),
body: FutureBuilder(
future: getHubList(),
builder: (BuildContext context, AsyncSnapshot snapshot) {
if (snapshot.hasData == false) {
return CircularProgressIndicator();
} else if (snapshot.hasError) {
return Padding(
padding: const EdgeInsets.all(8.0),
child: Text(
'Error: ${snapshot.error}',
style: TextStyle(fontSize: 15),
),
);
} else {
return Container(
height: size.height,
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Container(
height: size.height * 0.1,
width: size.width,
child: Center(
child: Text(
'등록된 허브 리스트',
textScaleFactor: 1.0,
style: TextStyle(
fontSize: 28,
fontFamily: 'Noto',
fontWeight: FontWeight.bold),
),
),
decoration: BoxDecoration(border: Border.all()),
),
SizedBox(height: 30),
Expanded(
child: ListView.separated(
padding: const EdgeInsets.all(30),
itemCount:
_hublist.length == null ? 0 : _hublist.length,
itemBuilder: (BuildContext context, int index) {
return Container(
padding: EdgeInsets.all(8.0),
decoration: BoxDecoration(
border: Border.all(),
borderRadius:
BorderRadius.all(Radius.circular(25.0)),
),
child: ListTile(
title: Text(
'HUB ID: ' + '${_hublist[index]}',
style: TextStyle(
color: Colors.black,
fontSize: 20,
fontFamily: 'Noto',
fontWeight: FontWeight.bold),
),
trailing: Icon(Icons.highlight_remove),
onTap: () async {
if (_hublist.length == 1) {
showDialog(
context: context,
builder: (BuildContext context) {
return AlertDialog(
title: new Text('허브 삭제'),
content: new Text(
'등록된 허브가 하나이므로 해제가 불가능 합니다.'),
actions: <Widget>[
new FlatButton(
child: new Text('Cloes'),
onPressed: () {
Navigator.of(context).pop();
}),
],
);
},
);
} else {
showDialog(
context: context,
builder: (BuildContext context) {
return AlertDialog(
title: new Text('허브 삭제'),
content: new Text(
_hublist[index].toString() +
'을 삭제 하시겠습니까?'),
actions: <Widget>[
new FlatButton(
child: new Text('삭제'),
onPressed: () async {
await deleteHub(_hublist[index]);
setState(() {});
Navigator.of(context).pop();
},
),
new FlatButton(
child: new Text('취소'),
onPressed: () {
Navigator.of(context).pop();
},
)
],
);
},
);
}
},
),
);
},
separatorBuilder: (BuildContext contetx, int index) =>
const Divider(),
),
),
Container(
padding: EdgeInsets.fromLTRB(0, 20, 0, 20),
width: size.width * 0.8,
height: size.height * 0.13,
margin: EdgeInsets.only(bottom: 0),
child: FlatButton(
height: size.height * 0.07,
onPressed: () async {
await Navigator.push(
context,
MaterialPageRoute(
builder: (BuildContext context) =>
RegisterHub(modify_hub: 1),
),
);
setState(() {});
},
child: Text(
'허브 추가',
textScaleFactor: 1.0,
style: TextStyle(
color: Colors.white,
fontSize: 24,
fontFamily: 'Noto',
fontWeight: FontWeight.bold),
),
color: Color(0xff0B1E33),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(50)),
),
),
],
),
);
}
}),
);
}
}
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:Smart_Medicine_Box/src/screens/SettingPage.dart';
class InformationModify extends StatefulWidget {
@override
_InformationModifyState createState() => _InformationModifyState();
}
class _InformationModifyState extends State<InformationModify> {
final passwordController = TextEditingController();
final passwordValidController = TextEditingController();
final medicineNameController = TextEditingController();
final medicineFactureController = TextEditingController();
bool _validate = false;
int userRole = 0;
// Initially password is obscure
bool passwordVisible = false;
bool passwordValidationVisible = true;
Widget build(BuildContext context) {
final Size size = MediaQuery.of(context).size;
return Scaffold(
appBar: AppBar(
iconTheme: IconThemeData(color: Colors.black),
backgroundColor: Colors.white,
title: Text(
'Smart Medicine Box',
style: TextStyle(
color: Colors.black,
fontSize: 20,
fontFamily: 'Noto',
fontWeight: FontWeight.bold),
),
actions: [
IconButton(
icon: Icon(
Icons.settings,
color: Colors.black,
),
onPressed: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (BuildContext context) => SettingPage(),
));
},
)
],
),
body: ListView(
children: <Widget>[
Container(
height: size.height * 0.9,
margin: EdgeInsets.fromLTRB(0, 10, 0, 0),
padding: EdgeInsets.fromLTRB(5, 0, 5, 5),
child: Column(
children: <Widget>[
Container(
padding: EdgeInsets.fromLTRB(5, 5, 5, 5),
height: size.height * 0.08,
width: size.width,
child: Center(
child: Text(
'회원 정보 수정',
textAlign: TextAlign.center,
textScaleFactor: 1.0,
style: TextStyle(
color: Colors.black,
fontSize: 32,
fontFamily: 'NotoSansKR',
fontWeight: FontWeight.w700),
),
),
),
MediaQuery(
data: MediaQuery.of(context).copyWith(textScaleFactor: 1.0),
child: Container(
height: size.height * 0.6,
child: Padding(
padding: const EdgeInsets.fromLTRB(20, 5, 20, 20),
child: new Column(
children: <Widget>[
SizedBox(height: 15),
Container(
height: size.height * 0.091,
padding: const EdgeInsets.fromLTRB(5, 10, 5, 5),
child: Container(
width: size.width * 0.85,
padding: const EdgeInsets.fromLTRB(5, 16, 5, 3),
decoration: BoxDecoration(
color: Color(0xffBDBDBD),
border: Border.all(),
borderRadius:
BorderRadius.all(Radius.circular(5))),
child: Text(
'test@naver.com',
textScaleFactor: 1.0,
style: TextStyle(
color: Colors.black,
fontSize: 18,
fontFamily: 'NotoSansKR',
),
),
),
),
SizedBox(height: 15),
Container(
height: size.height * 0.13,
padding: const EdgeInsets.fromLTRB(5, 10, 5, 5),
child: TextFormField(
keyboardType: TextInputType.text,
controller: passwordController,
obscureText:
!passwordVisible, //This will obscure text dynamically
decoration: InputDecoration(
border: OutlineInputBorder(
borderSide:
BorderSide(color: Colors.black)),
labelText: '비밀번호',
helperText: '비밀번호를 입력해주세요',
// Here is key idea
suffixIcon: IconButton(
icon: Icon(
// Based on passwordVisible state choose the icon
passwordVisible
? Icons.visibility
: Icons.visibility_off,
color: Theme.of(context).primaryColorDark,
),
onPressed: () {
// Update the state i.e. toogle the state of passwordVisible variable
setState(() {
passwordVisible = !passwordVisible;
});
},
),
),
),
),
Container(
height: size.height * 0.13,
padding: const EdgeInsets.fromLTRB(5, 10, 5, 5),
child: TextFormField(
keyboardType: TextInputType.text,
controller: medicineNameController,
decoration: InputDecoration(
border: OutlineInputBorder(),
labelText: '약 이름',
helperText: '약의 이름을 읿력하세요',
),
),
),
Container(
height: size.height * 0.13,
padding: const EdgeInsets.fromLTRB(5, 10, 5, 5),
child: TextFormField(
keyboardType: TextInputType.text,
controller: medicineFactureController,
decoration: InputDecoration(
border: OutlineInputBorder(),
labelText: '약 제조사 이름',
helperText: '약 제조사의 이름을 읿력하세요',
),
),
),
],
),
),
),
),
Container(
height: 100,
width: size.width * 0.7,
padding: const EdgeInsets.fromLTRB(20, 20, 20, 20),
child: RaisedButton(
onPressed: () async {},
shape: RoundedRectangleBorder(
borderRadius: new BorderRadius.circular(20.0),
side: BorderSide(color: Colors.blue)),
color: Color(0xff1674f6),
child: Text(
'회원 정보 수정',
textScaleFactor: 1.0,
style: TextStyle(
fontSize: 16,
color: Colors.white,
fontWeight: FontWeight.bold),
),
),
)
],
),
),
],
),
);
}
}
import 'package:flutter_datetime_picker/flutter_datetime_picker.dart';
class CustomPicker extends CommonPickerModel {
var indexs;
String digits(int value, int length) {
return '$value'.padLeft(length, "0");
}
CustomPicker({DateTime currentTime, LocaleType locale})
: super(locale: LocaleType.ko) {
this.currentTime = currentTime ?? DateTime.now();
var _dayPeriod = 0;
this.setLeftIndex(this.currentTime.hour);
this.setMiddleIndex(this.currentTime.minute);
this.setRightIndex(_dayPeriod);
_fillRightList();
}
@override
String leftStringAtIndex(int index) {
if (index >= 1 && index < 13) {
return this.digits(index, 2);
} else {
return null;
}
}
@override
String middleStringAtIndex(int index) {
if (index >= 0 && index < 60) {
return this.digits(index, 2);
} else {
return null;
}
}
@override
String rightStringAtIndex(int index) {
if (index == 0) {
return 'AM';
} else if (index == 1) {
return 'PM';
}
return null;
}
void _fillRightList() {
this.rightList = List.generate(2, (int index) {
return '$index';
});
}
@override
void setRightIndex(int index) {
super.setRightIndex(index);
indexs = index;
_fillRightList();
}
@override
String leftDivider() {
return ":";
}
@override
String rightDivider() {
return " ";
}
@override
List<int> layoutProportions() {
return [1, 1, 1];
}
@override
DateTime finalTime() {
var leftindex;
if (indexs == 1) {
if (this.currentLeftIndex() == 12) {
leftindex = 12;
} else {
leftindex = this.currentLeftIndex() + 12;
}
} else if (indexs == 0) {
if (this.currentLeftIndex() == 12) {
leftindex = 0;
} else {
leftindex = this.currentLeftIndex();
}
}
return currentTime.isUtc
? DateTime.utc(currentTime.year, currentTime.month, currentTime.day,
leftindex, this.currentMiddleIndex(), this.currentRightIndex())
: DateTime(currentTime.year, currentTime.month, currentTime.day,
leftindex, this.currentMiddleIndex(), this.currentRightIndex());
}
}
class Bottle {
final int bottleId;
final String temperature;
final String humidity;
final String balance;
final DateTime recentOpen;
final int medicineId;
final int hubId;
final int dosage;
Bottle(
{this.bottleId,
this.temperature,
this.humidity,
this.balance,
this.recentOpen,
this.medicineId,
this.hubId,
this.dosage});
factory Bottle.fromJson(Map<String, dynamic> parsedJson) {
return Bottle(
bottleId: parsedJson['bottleId'],
temperature: parsedJson['temperature'].toString(),
humidity: parsedJson['humidity'].toString(),
balance: parsedJson['balance'].toString(),
recentOpen: DateTime.parse(parsedJson['recentOpen']).toLocal(),
medicineId: parsedJson['medicineId'],
hubId: parsedJson['hubId'],
dosage: parsedJson['dosage'],
);
}
Map<String, dynamic> toJson() => {
"bottleId": bottleId,
"temperature": temperature,
"humidity:": humidity,
"balance": balance,
"recentOpen": recentOpen,
"medicineId": medicineId,
"hubId": hubId,
"dosage": dosage,
};
}
import 'Medicine.dart';
class Data {
final int totalItem;
final List<Medicine> result;
Data({this.totalItem, this.result});
factory Data.fromJson(Map<String, dynamic> parsedJson) {
var list = parsedJson['result'] as List;
List<Medicine> resultList = list.map((i) => Medicine.fromJson(i)).toList();
return Data(
totalItem: parsedJson['totalItem'],
result: resultList,
);
}
Map<String, dynamic> toJson() => {
"totalItem": totalItem,
"result": result,
};
}
class Medicine {
final int medicineId;
final String antiEffect;
final String company;
final String dosage;
final String name;
final String target;
final String warn;
Medicine(
{this.medicineId,
this.antiEffect,
this.company,
this.dosage,
this.name,
this.target,
this.warn});
factory Medicine.fromJson(Map<String, dynamic> parsedJson) {
return Medicine(
medicineId: parsedJson['medicineId'],
antiEffect: parsedJson['antiEffect'],
company: parsedJson['company'],
dosage: parsedJson['dosage'],
name: parsedJson['name'],
target: parsedJson['target'],
warn: parsedJson['warn'],
);
}
Map<String, dynamic> toJson() => {
"medicineId": medicineId,
"antiEffect": antiEffect,
"company": company,
"dosage": dosage,
"name": name,
"target": target,
"warn": warn,
};
}
class User {
final String userId;
final String token;
User({this.userId, this.token});
factory User.fromJson(Map<String, dynamic> parsedJson) {
return User(
userId: parsedJson['userId'],
token: parsedJson['token'],
);
}
Map<String, dynamic> toJson() => {
"userId": userId,
"token": token,
};
}
import 'package:flutter/material.dart';
const Color bgColor = Color(0xffF4F7FA);
// const Color primaryColor = Colors.green;
const Color primaryColor = Color(0xff44c662);
const Color white = Colors.white;
const Color darkText = Colors.black54;
const Color highlightColor = Colors.green;
import 'package:flutter/material.dart';
import './colors.dart';
import './styles.dart';
Container fryoTextInput(String hintText,
{onTap, onChanged, onEditingComplete, onSubmitted}) {
return Container(
margin: EdgeInsets.only(top: 13),
child: TextField(
onTap: onTap,
onChanged: onChanged,
onEditingComplete: onEditingComplete,
onSubmitted: onSubmitted,
cursorColor: primaryColor,
style: inputFieldTextStyle,
decoration: InputDecoration(
hintText: hintText,
hintStyle: inputFieldHintTextStyle,
focusedBorder: inputFieldFocusedBorderStyle,
contentPadding: EdgeInsets.symmetric(horizontal: 20, vertical: 10),
border: inputFieldDefaultBorderStyle),
),
);
}
Container fryoEmailInput(String hintText,
{onTap, onChanged, onEditingComplete, onSubmitted}) {
return Container(
margin: EdgeInsets.only(top: 13),
child: TextField(
onTap: onTap,
onChanged: onChanged,
onEditingComplete: onEditingComplete,
onSubmitted: onSubmitted,
keyboardType: TextInputType.emailAddress,
cursorColor: primaryColor,
style: inputFieldTextStyle,
decoration: InputDecoration(
hintText: hintText,
hintStyle: inputFieldHintTextStyle,
focusedBorder: inputFieldFocusedBorderStyle,
contentPadding: EdgeInsets.symmetric(horizontal: 20, vertical: 10),
border: inputFieldDefaultBorderStyle),
),
);
}
Container fryoPasswordInput(String hintText,
{onTap, onChanged, onEditingComplete, onSubmitted}) {
return Container(
margin: EdgeInsets.only(top: 13),
child: TextField(
onTap: onTap,
onChanged: onChanged,
onEditingComplete: onEditingComplete,
onSubmitted: onSubmitted,
obscureText: true,
cursorColor: primaryColor,
style: inputFieldHintPaswordTextStyle,
decoration: InputDecoration(
hintText: hintText,
hintStyle: inputFieldHintPaswordTextStyle,
focusedBorder: inputFieldFocusedBorderStyle,
contentPadding: EdgeInsets.symmetric(horizontal: 20, vertical: 10),
border: inputFieldDefaultBorderStyle),
),
);
}
import 'package:flutter/material.dart';
import './colors.dart';
/////////////////////////////////
/// TEXT STYLES
////////////////////////////////
const logoStyle = TextStyle(
fontFamily: 'Pacifico',
fontSize: 30,
color: Colors.black54,
letterSpacing: 2);
const logoWhiteStyle = TextStyle(
fontFamily: 'Pacifico',
fontSize: 21,
letterSpacing: 2,
color: Colors.white);
const whiteText = TextStyle(color: Colors.white, fontFamily: 'Poppins');
const disabledText = TextStyle(color: Colors.grey, fontFamily: 'Poppins');
const contrastText = TextStyle(color: primaryColor, fontFamily: 'Poppins');
const contrastTextBold = TextStyle(
color: primaryColor, fontFamily: 'Poppins', fontWeight: FontWeight.w600);
const h3 = TextStyle(
color: Colors.black,
fontSize: 24,
fontWeight: FontWeight.w800,
fontFamily: 'Poppins');
const h4 = TextStyle(
color: Colors.black,
fontSize: 18,
fontWeight: FontWeight.w700,
fontFamily: 'Poppins');
const h5 = TextStyle(
color: Colors.black,
fontSize: 18,
fontWeight: FontWeight.w500,
fontFamily: 'Poppins');
const h6 = TextStyle(
color: Colors.black,
fontSize: 16,
fontWeight: FontWeight.w500,
fontFamily: 'Poppins');
const priceText = TextStyle(
color: Colors.black,
fontSize: 19,
fontWeight: FontWeight.w800,
fontFamily: 'Poppins');
const foodNameText = TextStyle(
color: Colors.black,
fontSize: 17,
fontWeight: FontWeight.w600,
fontFamily: 'Poppins');
const tabLinkStyle =
TextStyle(fontWeight: FontWeight.w500);
const taglineText = TextStyle(color: Colors.grey, fontFamily: 'Poppins');
const categoryText = TextStyle(
color: Color(0xff444444),
fontWeight: FontWeight.w700,
fontFamily: 'Poppins');
const inputFieldTextStyle =
TextStyle(fontFamily: 'Poppins', fontWeight: FontWeight.w500);
const inputFieldHintTextStyle =
TextStyle(fontFamily: 'Poppins', color: Color(0xff444444));
const inputFieldPasswordTextStyle = TextStyle(
fontFamily: 'Poppins', fontWeight: FontWeight.w500, letterSpacing: 3);
const inputFieldHintPaswordTextStyle = TextStyle(
fontFamily: 'Poppins', color: Color(0xff444444), letterSpacing: 2);
///////////////////////////////////
/// BOX DECORATION STYLES
//////////////////////////////////
const authPlateDecoration = BoxDecoration(
color: white,
boxShadow: [
BoxShadow(
color: Color.fromRGBO(0, 0, 0, .1),
blurRadius: 10,
spreadRadius: 5,
offset: Offset(0, 1))
],
borderRadius: BorderRadiusDirectional.only(
bottomEnd: Radius.circular(20), bottomStart: Radius.circular(20)));
/////////////////////////////////////
/// INPUT FIELD DECORATION STYLES
////////////////////////////////////
const inputFieldFocusedBorderStyle = OutlineInputBorder(
borderRadius: BorderRadius.all(Radius.circular(6)),
borderSide: BorderSide(
color: primaryColor,
));
const inputFieldDefaultBorderStyle = OutlineInputBorder(
gapPadding: 0, borderRadius: BorderRadius.all(Radius.circular(6)));
import 'package:flutter_secure_storage/flutter_secure_storage.dart';
class UserSecureStorage {
static final _storage = FlutterSecureStorage();
static const _keyToken = 'usertoken';
static const _keyUserId = 'userid';
static const _keyBottleId = 'bottleid';
static const _keyMedicineId = 'medicineid';
static const _keyhubId = 'hubid';
static Future setUserId(String userid) async =>
await _storage.write(key: _keyUserId, value: userid);
static Future<String> getUserID() async =>
await _storage.read(key: _keyUserId);
static Future setUserToken(String userToken) async =>
await _storage.write(key: _keyToken, value: userToken);
static Future<String> getUserToken() async =>
await _storage.read(key: _keyToken);
static Future setBottleId(String bottleid) async =>
await _storage.write(key: _keyBottleId, value: bottleid);
static Future<String> getBottleId() async =>
await _storage.read(key: _keyBottleId);
static Future setMedicineId(String medicineid) async =>
await _storage.write(key: _keyMedicineId, value: medicineid);
static Future<String> getMedicineId() async =>
await _storage.read(key: _keyMedicineId);
static Future setHubId(String hubid) async =>
await _storage.write(key: _keyhubId, value: hubid);
static Future<String> getHubId() async => await _storage.read(key: _keyhubId);
}
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.