박권수

Merge branch 'master' into server

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