From e2b8fab7d964dc78b440f53bc040e4c561c4e5e8 Mon Sep 17 00:00:00 2001 From: erfan Date: Mon, 21 Jun 2021 14:14:54 +0430 Subject: [PATCH] 1.7.1 --- android/build.gradle | 16 +- .../gradle/wrapper/gradle-wrapper.properties | 2 +- lib/main.dart | 4 +- lib/pages/cycle_add_screen.dart | 389 ++++++------- lib/pages/cycle_detail_screen.dart | 64 +-- lib/pages/cycle_filter_screen.dart | 398 +++++++------- lib/pages/cycle_result_screen.dart | 285 +++++----- lib/pages/cycle_scan_screen.dart | 305 ++++++----- lib/pages/forget_pass_screen.dart | 200 +++---- lib/pages/home_screen.dart | 380 ++++++------- lib/pages/label_add_screen.dart | 350 ++++++------ lib/pages/label_detail_screen.dart | 63 +-- lib/pages/label_filter_screen.dart | 378 ++++++------- lib/pages/label_result_screen.dart | 292 +++++----- lib/pages/label_scan_screen.dart | 121 ++-- lib/pages/label_update_screen.dart | 352 ++++++------ lib/pages/login_screen.dart | 350 ++++++------ lib/pages/my_info_screen.dart | 261 ++++----- lib/pages/rePass_screen.dart | 316 +++++------ lib/pages/register.dart | 516 +++++++++--------- lib/pages/test_add_screen.dart | 392 ++++++------- lib/pages/test_detail_screen.dart | 56 +- lib/pages/test_filter_screen.dart | 499 ++++++++--------- lib/pages/test_form_page.dart | 138 ++--- lib/pages/test_result_screen.dart | 437 +++++++-------- lib/pages/test_scan_screen.dart | 297 +++++----- lib/pages/test_verify_screen.dart | 464 ++++++++-------- lib/pages/verify_pass_screen.dart | 213 ++++---- lib/providers/auth.dart | 17 +- lib/providers/cycles.dart | 16 +- lib/providers/input.dart | 9 +- lib/providers/labels.dart | 18 +- lib/providers/my_info.dart | 4 +- lib/providers/test_result_old.dart | 6 +- lib/providers/test_results.dart | 22 +- .../CycleScreens/Add/add_label_box.dart | 5 +- lib/widgets/CycleScreens/Add/save_button.dart | 7 +- .../CycleScreens/Filter/save_button.dart | 7 +- lib/widgets/CycleScreens/Result/banner.dart | 3 +- lib/widgets/CycleScreens/Result/data_box.dart | 5 +- .../CycleScreens/Result/filter_objects.dart | 5 +- .../CycleScreens/Result/search_box.dart | 3 +- lib/widgets/Global/drawer.dart | 3 +- lib/widgets/LabelScreens/Add/save_button.dart | 7 +- .../LabelScreens/Add/update_button.dart | 6 +- .../LabelScreens/Filter/save_button.dart | 7 +- lib/widgets/LabelScreens/Result/data_box.dart | 5 +- .../LabelScreens/Result/filter_chip_box.dart | 1 + .../LabelScreens/Result/floating_buttons.dart | 3 +- .../LabelScreens/Result/search_box.dart | 1 + lib/widgets/LabelScreens/Scan/scan_box.dart | 2 +- .../TestResultScreens/Add/capture_image.dart | 15 +- .../TestResultScreens/Add/form_creator.dart | 28 +- .../TestResultScreens/Add/save_button.dart | 3 +- .../TestResultScreens/Main/add_button.dart | 3 +- .../Main/filter_chip_box.dart | 1 + .../Main/floating_button.dart | 3 +- .../TestResultScreens/Main/search_box.dart | 1 + pubspec.lock | 220 +++++--- pubspec.yaml | 32 +- 60 files changed, 4078 insertions(+), 3928 deletions(-) diff --git a/android/build.gradle b/android/build.gradle index 3100ad2..d47e9ee 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -1,19 +1,27 @@ buildscript { - ext.kotlin_version = '1.3.50' + ext.kotlin_version = '1.3.61' repositories { - google() + // google() + maven { + url 'https://maven.google.com/' + name 'Google' +} jcenter() } dependencies { - classpath 'com.android.tools.build:gradle:3.5.0' + classpath 'com.android.tools.build:gradle:4.1.0' classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" } } allprojects { repositories { - google() + // google() + maven { + url 'https://maven.google.com/' + name 'Google' +} jcenter() } } diff --git a/android/gradle/wrapper/gradle-wrapper.properties b/android/gradle/wrapper/gradle-wrapper.properties index 296b146..bc6a58a 100644 --- a/android/gradle/wrapper/gradle-wrapper.properties +++ b/android/gradle/wrapper/gradle-wrapper.properties @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.2-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-6.7-all.zip diff --git a/lib/main.dart b/lib/main.dart index 66a7df5..68b14c9 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -3,7 +3,6 @@ import 'package:flutter/services.dart'; import 'package:flutter_phoenix/flutter_phoenix.dart'; import 'package:provider/provider.dart'; -import './pages/home_screen.dart'; import 'config/routes.dart'; import 'pages/cycle_add_screen.dart'; import 'pages/cycle_detail_screen.dart'; @@ -11,6 +10,7 @@ import 'pages/cycle_filter_screen.dart'; import 'pages/cycle_result_screen.dart'; import 'pages/cycle_scan_screen.dart'; import 'pages/forget_pass_screen.dart'; +import 'pages/home_screen.dart'; import 'pages/label_add_screen.dart'; import 'pages/label_detail_screen.dart'; import 'pages/label_filter_screen.dart'; @@ -90,7 +90,7 @@ class MyApp extends StatelessWidget { title: 'CSSD-DOC', theme: ThemeData( primaryColor: Colors.black, - cursorColor: Colors.black, + // cursorColor: Colors.black, fontFamily: 'montserrat', // primaryTextTheme: TextTheme( // body1: TextStyle( diff --git a/lib/pages/cycle_add_screen.dart b/lib/pages/cycle_add_screen.dart index 8176a70..1ad572a 100644 --- a/lib/pages/cycle_add_screen.dart +++ b/lib/pages/cycle_add_screen.dart @@ -1,17 +1,18 @@ -import 'package:cssd/config/routes.dart'; -import 'package:cssd/models/cycles_models.dart'; -import 'package:cssd/providers/connectivity.dart'; -import 'package:cssd/providers/cycles.dart'; -import 'package:cssd/widgets/CycleScreens/Add/add_label_box.dart'; -import 'package:cssd/widgets/CycleScreens/Add/date_picker.dart'; -import 'package:cssd/widgets/CycleScreens/Add/save_button.dart'; -import 'package:cssd/widgets/Global/internet_error.dart'; +import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; import 'package:font_awesome_flutter/font_awesome_flutter.dart'; import 'package:intl/intl.dart'; import 'package:provider/provider.dart'; -import 'package:flutter/cupertino.dart'; + +import '../config/routes.dart'; +import '../models/cycles_models.dart'; +import '../providers/connectivity.dart'; +import '../providers/cycles.dart'; +import '../widgets/CycleScreens/Add/add_label_box.dart'; +import '../widgets/CycleScreens/Add/date_picker.dart'; +import '../widgets/CycleScreens/Add/save_button.dart'; +import '../widgets/Global/internet_error.dart'; class CycleAddScreen extends StatefulWidget { // static const route = '/CycleAddScreen'; @@ -84,202 +85,206 @@ class _CycleAddScreenState extends State { ); return true; }, - child: Scaffold( - appBar: AppBar( - titleSpacing: -10, - title: Text('Cycles'), - leading: IconButton( - icon: Icon( - Icons.keyboard_arrow_left, - size: 35, + child: SafeArea( + child: Scaffold( + appBar: AppBar( + titleSpacing: -10, + title: Text('Cycles'), + leading: IconButton( + icon: Icon( + Icons.keyboard_arrow_left, + size: 35, + ), + onPressed: () => Navigator.of(context) + .pushReplacementNamed(Routes.cycleResultScreen), ), - onPressed: () => Navigator.of(context) - .pushReplacementNamed(Routes.cycleResultScreen), ), - ), - body: Consumer(builder: (ct, connection, _) { - return connection.conStatus != 'offline' - ? isInit - ? Center( - child: CircularProgressIndicator(), - ) - : Form( - key: _form, - child: Padding( - padding: EdgeInsets.all(20), - child: ListView( - // crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text( - 'ADD A CYCLE', - style: TextStyle( - fontWeight: FontWeight.w700, - fontSize: 6 * _deviceBlockSize, - letterSpacing: 3, - ), - ), - SizedBox( - height: 20, - ), - - TextFormField( - validator: (val) { - if (val.isEmpty) { - return 'Strilizer ID required!'; - } - return null; - }, - controller: striizerIdCTRL, - decoration: InputDecoration( - icon: Icon( - FontAwesomeIcons.sortNumericDown, - size: 7 * _deviceBlockSize, - ), - labelStyle: TextStyle( - fontWeight: FontWeight.w100, - fontSize: 4 * _deviceBlockSize, - ), - isDense: true, - labelText: 'Strilizer ID', - contentPadding: EdgeInsets.symmetric( - vertical: 2, horizontal: 3), - ), - style: TextStyle( - fontWeight: FontWeight.w700, - fontSize: 5 * _deviceBlockSize, - ), - keyboardType: TextInputType.visiblePassword, - textInputAction: TextInputAction.next, - onFieldSubmitted: (_) { - FocusScope.of(context) - .requestFocus(_cycleNumberFocusNode); - }, - ), - SizedBox( - height: 30, - ), - TextFormField( - validator: (val) { - if (val.isEmpty) { - return 'Cycle number required!'; - } - return null; - }, - controller: cycleNumberCTRL, - decoration: InputDecoration( - icon: Icon( - FontAwesomeIcons.sortNumericDown, - size: 7 * _deviceBlockSize, - ), - labelStyle: TextStyle( - fontWeight: FontWeight.w100, - fontSize: 4 * _deviceBlockSize, - ), - isDense: true, - labelText: 'Cycle Number', - contentPadding: EdgeInsets.symmetric( - vertical: 2, horizontal: 3), - ), - style: TextStyle( - fontWeight: FontWeight.w700, - fontSize: 5 * _deviceBlockSize, - ), - focusNode: _cycleNumberFocusNode, - keyboardType: TextInputType.number, - textInputAction: TextInputAction.next, - onFieldSubmitted: (_) { - FocusScope.of(context) - .requestFocus(_descriptionFocosNode); - }, - ), - - SizedBox( - height: 20, - ), - Container( - margin: EdgeInsets.symmetric(vertical: 10), - child: Text( - 'LABELS INCLUDED', + body: Consumer(builder: (ct, connection, _) { + return connection.conStatus != 'offline' + ? isInit + ? Center( + child: CircularProgressIndicator(), + ) + : Form( + key: _form, + child: Padding( + padding: EdgeInsets.all(20), + child: ListView( + // crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + 'ADD A CYCLE', style: TextStyle( - color: Colors.deepOrange, - letterSpacing: 2, + fontWeight: FontWeight.w700, + fontSize: 6 * _deviceBlockSize, + letterSpacing: 3, + ), + ), + SizedBox( + height: 20, + ), + + TextFormField( + validator: (val) { + if (val.isEmpty) { + return 'Strilizer ID required!'; + } + return null; + }, + controller: striizerIdCTRL, + decoration: InputDecoration( + icon: Icon( + FontAwesomeIcons.sortNumericDown, + size: 7 * _deviceBlockSize, + ), + labelStyle: TextStyle( + fontWeight: FontWeight.w100, + fontSize: 4 * _deviceBlockSize, + ), + isDense: true, + labelText: 'Strilizer ID', + contentPadding: EdgeInsets.symmetric( + vertical: 2, horizontal: 3), + ), + style: TextStyle( + fontWeight: FontWeight.w700, fontSize: 5 * _deviceBlockSize, ), + keyboardType: TextInputType.visiblePassword, + textInputAction: TextInputAction.next, + onFieldSubmitted: (_) { + FocusScope.of(context) + .requestFocus(_cycleNumberFocusNode); + }, ), - ), - Consumer( - builder: (ctx, cycleProvider, _) => - ListView.builder( - physics: NeverScrollableScrollPhysics(), - shrinkWrap: true, - itemBuilder: (ctx, index) => CycleAddLabelBox( - deviceBlockSize: _deviceBlockSize, - labelValues: cycleProvider.labelValues[index], - labelVals: cycleProvider.labelVals, - initialLabelValue: - cycleProvider.initialLabelValue, - index: index, + SizedBox( + height: 30, + ), + TextFormField( + validator: (val) { + if (val.isEmpty) { + return 'Cycle number required!'; + } + return null; + }, + controller: cycleNumberCTRL, + decoration: InputDecoration( + icon: Icon( + FontAwesomeIcons.sortNumericDown, + size: 7 * _deviceBlockSize, + ), + labelStyle: TextStyle( + fontWeight: FontWeight.w100, + fontSize: 4 * _deviceBlockSize, + ), + isDense: true, + labelText: 'Cycle Number', + contentPadding: EdgeInsets.symmetric( + vertical: 2, horizontal: 3), ), - itemCount: cycleProvider.labelValues.length, + style: TextStyle( + fontWeight: FontWeight.w700, + fontSize: 5 * _deviceBlockSize, + ), + focusNode: _cycleNumberFocusNode, + keyboardType: TextInputType.number, + textInputAction: TextInputAction.next, + onFieldSubmitted: (_) { + FocusScope.of(context) + .requestFocus(_descriptionFocosNode); + }, ), - ), - CycleAddDatePicker( - dateCTRL: dateCTRL, - deviceBlockSize: _deviceBlockSize), - SizedBox( - height: 30, - ), - TextFormField( - controller: descriptionCTRL, - decoration: InputDecoration( - icon: Icon( - FontAwesomeIcons.alignLeft, - size: 7 * _deviceBlockSize, - ), - labelStyle: TextStyle( - fontWeight: FontWeight.w100, - fontSize: 4 * _deviceBlockSize, - ), - isDense: true, - labelText: 'Description', - contentPadding: EdgeInsets.symmetric( - vertical: 2, horizontal: 3), + SizedBox( + height: 20, ), - style: TextStyle( - fontWeight: FontWeight.w700, - fontSize: 5 * _deviceBlockSize, + Container( + margin: EdgeInsets.symmetric(vertical: 10), + child: Text( + 'LABELS INCLUDED', + style: TextStyle( + color: Colors.deepOrange, + letterSpacing: 2, + fontSize: 5 * _deviceBlockSize, + ), + ), + ), + Consumer( + builder: (ctx, cycleProvider, _) => + ListView.builder( + physics: NeverScrollableScrollPhysics(), + shrinkWrap: true, + itemBuilder: (ctx, index) => CycleAddLabelBox( + deviceBlockSize: _deviceBlockSize, + labelValues: + cycleProvider.labelValues[index], + labelVals: cycleProvider.labelVals, + initialLabelValue: + cycleProvider.initialLabelValue, + index: index, + ), + itemCount: cycleProvider.labelValues.length, + ), ), - keyboardType: TextInputType.multiline, - focusNode: _descriptionFocosNode, - minLines: 1, - maxLines: 5, - ), - SizedBox( - height: 70, - ), - CycleAddSaveButton( - form: _form, - labelValues: Provider.of(context, - listen: false) - .labelValues, - cycleNumberCTRL: cycleNumberCTRL, - dateValue: dateCTRL.text, - descriptionCTRL: descriptionCTRL, - striizerIdCTRL: striizerIdCTRL, - deviceBlockSize: _deviceBlockSize, - ), - SizedBox( - height: 100, - ), - // DropDownBox(values: ['Washer ID']), - ], + CycleAddDatePicker( + dateCTRL: dateCTRL, + deviceBlockSize: _deviceBlockSize), + SizedBox( + height: 30, + ), + TextFormField( + controller: descriptionCTRL, + decoration: InputDecoration( + icon: Icon( + FontAwesomeIcons.alignLeft, + size: 7 * _deviceBlockSize, + ), + labelStyle: TextStyle( + fontWeight: FontWeight.w100, + fontSize: 4 * _deviceBlockSize, + ), + isDense: true, + labelText: 'Description', + contentPadding: EdgeInsets.symmetric( + vertical: 2, horizontal: 3), + ), + style: TextStyle( + fontWeight: FontWeight.w700, + fontSize: 5 * _deviceBlockSize, + ), + keyboardType: TextInputType.multiline, + focusNode: _descriptionFocosNode, + minLines: 1, + maxLines: 5, + ), + SizedBox( + height: 70, + ), + CycleAddSaveButton( + form: _form, + labelValues: Provider.of( + context, + listen: false) + .labelValues, + cycleNumberCTRL: cycleNumberCTRL, + dateValue: dateCTRL.text, + descriptionCTRL: descriptionCTRL, + striizerIdCTRL: striizerIdCTRL, + deviceBlockSize: _deviceBlockSize, + ), + SizedBox( + height: 100, + ), + + // DropDownBox(values: ['Washer ID']), + ], + ), ), - ), - ) - : ConnectionErrorBox(); - }), + ) + : ConnectionErrorBox(); + }), + ), ), ); } diff --git a/lib/pages/cycle_detail_screen.dart b/lib/pages/cycle_detail_screen.dart index caa9734..79113a8 100644 --- a/lib/pages/cycle_detail_screen.dart +++ b/lib/pages/cycle_detail_screen.dart @@ -1,11 +1,12 @@ -import 'package:cssd/models/cycles_models.dart'; -import 'package:cssd/providers/connectivity.dart'; -import 'package:cssd/providers/cycles.dart'; -import 'package:cssd/widgets/CycleScreens/Details/datas_box.dart'; -import 'package:cssd/widgets/Global/internet_error.dart'; import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; +import '../models/cycles_models.dart'; +import '../providers/connectivity.dart'; +import '../providers/cycles.dart'; +import '../widgets/CycleScreens/Details/datas_box.dart'; +import '../widgets/Global/internet_error.dart'; + class CycleDetailScreen extends StatefulWidget { // static const route = '/CycleDetailScreen'; final String testResultId; @@ -49,35 +50,36 @@ class _CycleDetailScreenState extends State { // final double _pixelRatio = (_media.size.height / _media.size.width * 7 / 5); final double _devicewidth = _media.size.width; final double _deviceBlockSize = _devicewidth / 100; - print(datas); - return Scaffold( - appBar: AppBar( - titleSpacing: -10, - title: Text('Cycles'), - leading: IconButton( - icon: Icon( - Icons.keyboard_arrow_left, - size: 35, + return SafeArea( + child: Scaffold( + appBar: AppBar( + titleSpacing: -10, + title: Text('Cycles'), + leading: IconButton( + icon: Icon( + Icons.keyboard_arrow_left, + size: 35, + ), + onPressed: () => Navigator.of(context).pop(), ), - onPressed: () => Navigator.of(context).pop(), ), + body: Consumer(builder: (ct, connection, _) { + return connection.conStatus != 'offline' + ? isInit + ? Center( + child: CircularProgressIndicator(), + ) + : isEmpty + ? Center( + child: Text('This Cycle doesnt exists!'), + ) + : CycleDetailsDataBox( + datas: datas, + deviceBlockSize: _deviceBlockSize, + ) + : ConnectionErrorBox(); + }), ), - body: Consumer(builder: (ct, connection, _) { - return connection.conStatus != 'offline' - ? isInit - ? Center( - child: CircularProgressIndicator(), - ) - : isEmpty - ? Center( - child: Text('This Cycle doesnt exists!'), - ) - : CycleDetailsDataBox( - datas: datas, - deviceBlockSize: _deviceBlockSize, - ) - : ConnectionErrorBox(); - }), ); } } diff --git a/lib/pages/cycle_filter_screen.dart b/lib/pages/cycle_filter_screen.dart index fb99cec..f078850 100644 --- a/lib/pages/cycle_filter_screen.dart +++ b/lib/pages/cycle_filter_screen.dart @@ -1,4 +1,4 @@ -import 'package:barcode_scan/barcode_scan.dart'; +import 'package:barcode_scan2/barcode_scan2.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; @@ -98,206 +98,208 @@ class _CycleFilterScreenState extends State { ); return true; }, - child: Scaffold( - appBar: AppBar( - titleSpacing: -10, - title: Text('Cycles'), - leading: IconButton( - icon: Icon( - Icons.keyboard_arrow_left, - size: 35, + child: SafeArea( + child: Scaffold( + appBar: AppBar( + titleSpacing: -10, + title: Text('Cycles'), + leading: IconButton( + icon: Icon( + Icons.keyboard_arrow_left, + size: 35, + ), + onPressed: () => Navigator.of(context) + .pushReplacementNamed(Routes.cycleResultScreen), ), - onPressed: () => Navigator.of(context) - .pushReplacementNamed(Routes.cycleResultScreen), ), + body: Consumer(builder: (ct, connection, _) { + return connection.conStatus != 'offline' + ? isInit + ? Center( + child: CircularProgressIndicator(), + ) + : Padding( + padding: EdgeInsets.all(20), + child: ListView( + // crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + 'FILTER RESULTS', + style: TextStyle( + fontWeight: FontWeight.w700, + fontSize: 5 * _deviceBlockSize, + ), + ), + SizedBox( + height: 20, + ), + Row( + children: [ + Flexible( + flex: 8, + child: TextFormField( + controller: cycleIdCTRL, + decoration: InputDecoration( + icon: Icon( + FontAwesomeIcons.sortNumericDown, + size: 6 * _deviceBlockSize, + ), + labelStyle: TextStyle( + fontWeight: FontWeight.w100, + fontSize: 4 * _deviceBlockSize, + ), + labelText: 'Cycle ID', + isDense: true, + contentPadding: EdgeInsets.symmetric( + vertical: 2, horizontal: 3), + ), + style: TextStyle( + fontWeight: FontWeight.w700, + fontSize: 5 * _deviceBlockSize, + ), + keyboardType: TextInputType.number, + textInputAction: TextInputAction.next, + onFieldSubmitted: (_) { + FocusScope.of(context) + .requestFocus(_cycleNumberFocusNode); + }, + ), + ), + // Spacer(), + Flexible( + flex: 1, + child: InkWell( + onTap: () { + scan().then( + (String result) { + if (result == 'cancel') { + print('cancel'); + } else if (result == 'error') { + print('error'); + } else if (result == 'access') { + print('access'); + } else { + print(result); + cycleIdCTRL.text = result; + // Navigator.of(context).pushNamed( + // CycleDetailScreen.route, + // arguments: result, + // ); + } + }, + ); + }, + child: Container( + padding: EdgeInsets.all(8), + decoration: BoxDecoration( + shape: BoxShape.circle, + color: Colors.black, + ), + child: Icon( + FontAwesomeIcons.barcode, + size: 5 * _deviceBlockSize, + color: Colors.white, + ), + ), + ), + ) + ], + ), + SizedBox( + height: 30, + ), + TextFormField( + controller: cycleNumberCTRL, + decoration: InputDecoration( + icon: Icon( + FontAwesomeIcons.sortNumericDown, + size: 6 * _deviceBlockSize, + ), + labelStyle: TextStyle( + fontWeight: FontWeight.w100, + fontSize: 4 * _deviceBlockSize, + ), + labelText: 'Cycle Number', + isDense: true, + contentPadding: EdgeInsets.symmetric( + vertical: 2, horizontal: 3), + ), + style: TextStyle( + fontWeight: FontWeight.w700, + fontSize: 5 * _deviceBlockSize, + ), + focusNode: _cycleNumberFocusNode, + keyboardType: TextInputType.visiblePassword, + textInputAction: TextInputAction.next, + onFieldSubmitted: (_) { + FocusScope.of(context) + .requestFocus(_strilizerIdFocusNode); + }, + ), + SizedBox( + height: 30, + ), + TextField( + controller: striizerIdCTRL, + decoration: InputDecoration( + icon: Icon( + FontAwesomeIcons.sortNumericDown, + size: 6 * _deviceBlockSize, + ), + labelStyle: TextStyle( + fontWeight: FontWeight.w100, + fontSize: 4 * _deviceBlockSize, + ), + labelText: 'Strilizer ID', + isDense: true, + contentPadding: EdgeInsets.symmetric( + vertical: 2, horizontal: 3), + ), + style: TextStyle( + fontWeight: FontWeight.w700, + fontSize: 5 * _deviceBlockSize, + ), + focusNode: _strilizerIdFocusNode, + keyboardType: TextInputType.visiblePassword, + textInputAction: TextInputAction.done, + ), + SizedBox( + height: 20, + ), + CycleFilterSelectorBox( + deviceBlockSize: _deviceBlockSize, + hospitalCTRL: hospitalCTRL, + hospitalVals: hospitalVals, + label: 'Hospital', + ), + SizedBox( + height: 20, + ), + CycleFilterDatePicker( + dateCTRL: dateCTRL, + deviceBlockSize: _deviceBlockSize, + ), + SizedBox( + height: 70, + ), + CycleFilterSaveButton( + hospitalVals: hospitalVals, + hospitalCTRL: hospitalCTRL, + cycleIdCTRL: cycleIdCTRL, + cycleNumberCTRL: cycleNumberCTRL, + striizerIdCTRL: striizerIdCTRL, + dateCTRL: dateCTRL, + deviceBlockSize: _deviceBlockSize, + ), + SizedBox( + height: 100, + ), + ], + ), + ) + : ConnectionErrorBox(); + }), ), - body: Consumer(builder: (ct, connection, _) { - return connection.conStatus != 'offline' - ? isInit - ? Center( - child: CircularProgressIndicator(), - ) - : Padding( - padding: EdgeInsets.all(20), - child: ListView( - // crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text( - 'FILTER RESULTS', - style: TextStyle( - fontWeight: FontWeight.w700, - fontSize: 5 * _deviceBlockSize, - ), - ), - SizedBox( - height: 20, - ), - Row( - children: [ - Flexible( - flex: 8, - child: TextFormField( - controller: cycleIdCTRL, - decoration: InputDecoration( - icon: Icon( - FontAwesomeIcons.sortNumericDown, - size: 6 * _deviceBlockSize, - ), - labelStyle: TextStyle( - fontWeight: FontWeight.w100, - fontSize: 4 * _deviceBlockSize, - ), - labelText: 'Cycle ID', - isDense: true, - contentPadding: EdgeInsets.symmetric( - vertical: 2, horizontal: 3), - ), - style: TextStyle( - fontWeight: FontWeight.w700, - fontSize: 5 * _deviceBlockSize, - ), - keyboardType: TextInputType.number, - textInputAction: TextInputAction.next, - onFieldSubmitted: (_) { - FocusScope.of(context) - .requestFocus(_cycleNumberFocusNode); - }, - ), - ), - // Spacer(), - Flexible( - flex: 1, - child: InkWell( - onTap: () { - scan().then( - (String result) { - if (result == 'cancel') { - print('cancel'); - } else if (result == 'error') { - print('error'); - } else if (result == 'access') { - print('access'); - } else { - print(result); - cycleIdCTRL.text = result; - // Navigator.of(context).pushNamed( - // CycleDetailScreen.route, - // arguments: result, - // ); - } - }, - ); - }, - child: Container( - padding: EdgeInsets.all(8), - decoration: BoxDecoration( - shape: BoxShape.circle, - color: Colors.black, - ), - child: Icon( - FontAwesomeIcons.barcode, - size: 5 * _deviceBlockSize, - color: Colors.white, - ), - ), - ), - ) - ], - ), - SizedBox( - height: 30, - ), - TextFormField( - controller: cycleNumberCTRL, - decoration: InputDecoration( - icon: Icon( - FontAwesomeIcons.sortNumericDown, - size: 6 * _deviceBlockSize, - ), - labelStyle: TextStyle( - fontWeight: FontWeight.w100, - fontSize: 4 * _deviceBlockSize, - ), - labelText: 'Cycle Number', - isDense: true, - contentPadding: EdgeInsets.symmetric( - vertical: 2, horizontal: 3), - ), - style: TextStyle( - fontWeight: FontWeight.w700, - fontSize: 5 * _deviceBlockSize, - ), - focusNode: _cycleNumberFocusNode, - keyboardType: TextInputType.visiblePassword, - textInputAction: TextInputAction.next, - onFieldSubmitted: (_) { - FocusScope.of(context) - .requestFocus(_strilizerIdFocusNode); - }, - ), - SizedBox( - height: 30, - ), - TextField( - controller: striizerIdCTRL, - decoration: InputDecoration( - icon: Icon( - FontAwesomeIcons.sortNumericDown, - size: 6 * _deviceBlockSize, - ), - labelStyle: TextStyle( - fontWeight: FontWeight.w100, - fontSize: 4 * _deviceBlockSize, - ), - labelText: 'Strilizer ID', - isDense: true, - contentPadding: EdgeInsets.symmetric( - vertical: 2, horizontal: 3), - ), - style: TextStyle( - fontWeight: FontWeight.w700, - fontSize: 5 * _deviceBlockSize, - ), - focusNode: _strilizerIdFocusNode, - keyboardType: TextInputType.visiblePassword, - textInputAction: TextInputAction.done, - ), - SizedBox( - height: 20, - ), - CycleFilterSelectorBox( - deviceBlockSize: _deviceBlockSize, - hospitalCTRL: hospitalCTRL, - hospitalVals: hospitalVals, - label: 'Hospital', - ), - SizedBox( - height: 20, - ), - CycleFilterDatePicker( - dateCTRL: dateCTRL, - deviceBlockSize: _deviceBlockSize, - ), - SizedBox( - height: 70, - ), - CycleFilterSaveButton( - hospitalVals: hospitalVals, - hospitalCTRL: hospitalCTRL, - cycleIdCTRL: cycleIdCTRL, - cycleNumberCTRL: cycleNumberCTRL, - striizerIdCTRL: striizerIdCTRL, - dateCTRL: dateCTRL, - deviceBlockSize: _deviceBlockSize, - ), - SizedBox( - height: 100, - ), - ], - ), - ) - : ConnectionErrorBox(); - }), ), ); } diff --git a/lib/pages/cycle_result_screen.dart b/lib/pages/cycle_result_screen.dart index cbcc02a..ad13c07 100644 --- a/lib/pages/cycle_result_screen.dart +++ b/lib/pages/cycle_result_screen.dart @@ -1,11 +1,11 @@ -import 'package:cssd/config/routes.dart'; +import '../config/routes.dart'; -import 'package:cssd/providers/connectivity.dart'; -import 'package:cssd/widgets/CycleScreens/Result/banner.dart'; -import 'package:cssd/widgets/CycleScreens/Result/data_box.dart'; -import 'package:cssd/widgets/CycleScreens/Result/filter_objects.dart'; -import 'package:cssd/widgets/CycleScreens/Result/search_box.dart'; -import 'package:cssd/widgets/Global/internet_error.dart'; +import '../providers/connectivity.dart'; +import '../widgets/CycleScreens/Result/banner.dart'; +import '../widgets/CycleScreens/Result/data_box.dart'; +import '../widgets/CycleScreens/Result/filter_objects.dart'; +import '../widgets/CycleScreens/Result/search_box.dart'; +import '../widgets/Global/internet_error.dart'; import '../providers/cycles.dart'; @@ -62,142 +62,145 @@ class _CycleResultScreenState extends State { final _media = MediaQuery.of(context); final double _devicewidth = _media.size.width; final double _deviceBlockSize = _devicewidth / 100; - return Scaffold( - floatingActionButton: CycleResultFloatingButton( - deviceBlockSize: _deviceBlockSize, - ), - appBar: AppBar( - titleSpacing: -10, - title: Text('Home'), - leading: IconButton( - icon: Icon( - Icons.keyboard_arrow_left, - size: 35, - ), - onPressed: () => Navigator.of(context).pop(), + return SafeArea( + child: Scaffold( + floatingActionButton: CycleResultFloatingButton( + deviceBlockSize: _deviceBlockSize, ), - ), - body: Consumer(builder: (ct, connection, _) { - return connection.conStatus != 'offline' - ? Padding( - padding: - EdgeInsets.only(top: 20, right: 20, bottom: 60, left: 20), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - CycleResultBanner(deviceBlockSize: _deviceBlockSize), - SizedBox( - height: 10, - ), - Consumer(builder: (ctx, cycle, _) { - return Container( - height: 50, - child: ListView( - scrollDirection: Axis.horizontal, - shrinkWrap: true, - children: [ - CycleFilterBaner(deviceBlockSize: _deviceBlockSize), - cycle.filters.id != '' - ? CycleFilterChip( - deviceBlockSize: _deviceBlockSize, - label: 'ID', - id: '', - cycleNumber: cycle.filters.cycleNumber, - sterilizerId: cycle.filters.sterilizerId, - hospital: cycle.filters.hospital, - date: cycle.filters.date, - ) - : Container(), - cycle.filters.cycleNumber != '' - ? CycleFilterChip( - deviceBlockSize: _deviceBlockSize, - label: 'Cycle Number', - id: cycle.filters.id, - cycleNumber: '', - sterilizerId: cycle.filters.sterilizerId, - hospital: cycle.filters.hospital, - date: cycle.filters.date, - ) - : Container(), - cycle.filters.sterilizerId != '' - ? CycleFilterChip( - deviceBlockSize: _deviceBlockSize, - label: 'Sterilizer ID', - id: cycle.filters.id, - cycleNumber: cycle.filters.cycleNumber, - sterilizerId: '', - hospital: cycle.filters.hospital, - date: cycle.filters.date, - ) - : Container(), - cycle.filters.hospital != '' - ? CycleFilterChip( - deviceBlockSize: _deviceBlockSize, - label: 'Hospital', - id: cycle.filters.id, - cycleNumber: cycle.filters.cycleNumber, - sterilizerId: cycle.filters.sterilizerId, - hospital: '', - date: cycle.filters.date, - ) - : Container(), - cycle.filters.date != '' - ? CycleFilterChip( - deviceBlockSize: _deviceBlockSize, - label: 'Date', - id: cycle.filters.id, - cycleNumber: cycle.filters.cycleNumber, - sterilizerId: cycle.filters.sterilizerId, - hospital: cycle.filters.hospital, - date: '', - ) - : Container(), - ], - ), - ); - }), - CycleResultSearchBox( - searchCTRL: searchCTRL, - deviceBlockSize: _deviceBlockSize, - ), - SizedBox( - height: 20, - ), - Expanded( - child: Consumer( - builder: (context, cycleResults, _) { - return cycleResults.isloading - ? Center( - child: CircularProgressIndicator(), - ) - : ListView.builder( - controller: sc, - itemBuilder: (context, index) { - String labels = ''; - for (var label - in cycleResults.items[index].label) { - labels += label; - labels += ' , '; - } - labels = labels.substring( - 0, labels.length - 3); // remove extra , - return CycleItemBox( - deviceBlockSize: _deviceBlockSize, - item: cycleResults.items[index], - labels: labels, - ); - }, - itemCount: cycleResults.items.length, - shrinkWrap: true, - ); - }, + appBar: AppBar( + titleSpacing: -10, + title: Text('Home'), + leading: IconButton( + icon: Icon( + Icons.keyboard_arrow_left, + size: 35, + ), + onPressed: () => Navigator.of(context).pop(), + ), + ), + body: Consumer(builder: (ct, connection, _) { + return connection.conStatus != 'offline' + ? Padding( + padding: + EdgeInsets.only(top: 20, right: 20, bottom: 60, left: 20), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + CycleResultBanner(deviceBlockSize: _deviceBlockSize), + SizedBox( + height: 10, ), - ), - ], - ), - ) - : ConnectionErrorBox(); - }), + Consumer(builder: (ctx, cycle, _) { + return Container( + height: 50, + child: ListView( + scrollDirection: Axis.horizontal, + shrinkWrap: true, + children: [ + CycleFilterBaner( + deviceBlockSize: _deviceBlockSize), + cycle.filters.id != '' + ? CycleFilterChip( + deviceBlockSize: _deviceBlockSize, + label: 'ID', + id: '', + cycleNumber: cycle.filters.cycleNumber, + sterilizerId: cycle.filters.sterilizerId, + hospital: cycle.filters.hospital, + date: cycle.filters.date, + ) + : Container(), + cycle.filters.cycleNumber != '' + ? CycleFilterChip( + deviceBlockSize: _deviceBlockSize, + label: 'Cycle Number', + id: cycle.filters.id, + cycleNumber: '', + sterilizerId: cycle.filters.sterilizerId, + hospital: cycle.filters.hospital, + date: cycle.filters.date, + ) + : Container(), + cycle.filters.sterilizerId != '' + ? CycleFilterChip( + deviceBlockSize: _deviceBlockSize, + label: 'Sterilizer ID', + id: cycle.filters.id, + cycleNumber: cycle.filters.cycleNumber, + sterilizerId: '', + hospital: cycle.filters.hospital, + date: cycle.filters.date, + ) + : Container(), + cycle.filters.hospital != '' + ? CycleFilterChip( + deviceBlockSize: _deviceBlockSize, + label: 'Hospital', + id: cycle.filters.id, + cycleNumber: cycle.filters.cycleNumber, + sterilizerId: cycle.filters.sterilizerId, + hospital: '', + date: cycle.filters.date, + ) + : Container(), + cycle.filters.date != '' + ? CycleFilterChip( + deviceBlockSize: _deviceBlockSize, + label: 'Date', + id: cycle.filters.id, + cycleNumber: cycle.filters.cycleNumber, + sterilizerId: cycle.filters.sterilizerId, + hospital: cycle.filters.hospital, + date: '', + ) + : Container(), + ], + ), + ); + }), + CycleResultSearchBox( + searchCTRL: searchCTRL, + deviceBlockSize: _deviceBlockSize, + ), + SizedBox( + height: 20, + ), + Expanded( + child: Consumer( + builder: (context, cycleResults, _) { + return cycleResults.isloading + ? Center( + child: CircularProgressIndicator(), + ) + : ListView.builder( + controller: sc, + itemBuilder: (context, index) { + String labels = ''; + for (var label + in cycleResults.items[index].label) { + labels += label; + labels += ' , '; + } + labels = labels.substring(0, + labels.length - 3); // remove extra , + return CycleItemBox( + deviceBlockSize: _deviceBlockSize, + item: cycleResults.items[index], + labels: labels, + ); + }, + itemCount: cycleResults.items.length, + shrinkWrap: true, + ); + }, + ), + ), + ], + ), + ) + : ConnectionErrorBox(); + }), + ), ); } } diff --git a/lib/pages/cycle_scan_screen.dart b/lib/pages/cycle_scan_screen.dart index 745461f..c2da146 100644 --- a/lib/pages/cycle_scan_screen.dart +++ b/lib/pages/cycle_scan_screen.dart @@ -1,13 +1,13 @@ -import 'package:cssd/providers/connectivity.dart'; -import 'package:cssd/widgets/Global/internet_error.dart'; +import 'package:barcode_scan2/barcode_scan2.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; -import 'package:barcode_scan/barcode_scan.dart'; - import 'package:font_awesome_flutter/font_awesome_flutter.dart'; import 'package:provider/provider.dart'; import 'package:url_launcher/url_launcher.dart'; +import '../providers/connectivity.dart'; +import '../widgets/Global/internet_error.dart'; + class CycleScanScreen extends StatefulWidget { // static const route = '/cycleScanScreen'; @override @@ -27,167 +27,170 @@ class _CycleScanScreenState extends State { // final double _pixelRatio = (_media.size.height / _media.size.width * 7 / 5); final double _devicewidth = _media.size.width; final double _deviceBlockSize = _devicewidth / 100; - return Scaffold( - appBar: AppBar( - centerTitle: true, - titleSpacing: -10, - title: Text('CSSD'), - leading: IconButton( - icon: Icon( - Icons.keyboard_arrow_left, - size: 35, + return SafeArea( + child: Scaffold( + appBar: AppBar( + centerTitle: true, + titleSpacing: -10, + title: Text('CSSD'), + leading: IconButton( + icon: Icon( + Icons.keyboard_arrow_left, + size: 35, + ), + onPressed: () => Navigator.of(context).pop(), ), - onPressed: () => Navigator.of(context).pop(), ), - ), - body: Consumer(builder: (ct, connection, _) { - return connection.conStatus != 'offline' - ? ListView( - padding: EdgeInsets.symmetric(horizontal: 20), - children: [ - Container( - padding: EdgeInsets.only(top: 30), - child: Text( - 'LOOKING FOR A CYCLE?', - textAlign: TextAlign.left, - style: TextStyle( - color: Colors.black, - fontSize: 5.5 * _deviceBlockSize, - fontWeight: FontWeight.w700, - letterSpacing: 3, - ), - ), - ), - GestureDetector( - child: Container( - margin: EdgeInsets.symmetric(vertical: 10), - height: 200, - decoration: BoxDecoration(border: Border.all()), - child: Center( - child: Text( - 'Please Scan The Cycle Barcode', - style: TextStyle( - color: Colors.black, - fontSize: 5 * _deviceBlockSize, - fontWeight: FontWeight.w100, - letterSpacing: 3, - ), - textAlign: TextAlign.center, + body: Consumer(builder: (ct, connection, _) { + return connection.conStatus != 'offline' + ? ListView( + padding: EdgeInsets.symmetric(horizontal: 20), + children: [ + Container( + padding: EdgeInsets.only(top: 30), + child: Text( + 'LOOKING FOR A CYCLE?', + textAlign: TextAlign.left, + style: TextStyle( + color: Colors.black, + fontSize: 5.5 * _deviceBlockSize, + fontWeight: FontWeight.w700, + letterSpacing: 3, ), ), ), - onTap: () { - scan().then( - (String result) { - if (result == 'cancel') { - print('cancel'); - } else if (result == 'error') { - print('error'); - } else if (result == 'access') { - print('access'); - } else { - launch( - 'https://cssd-doc.com/Show/Cycle/$result', - ); - // Navigator.of(context).pushNamed( - // Routes.cycleDetailScreen, - // arguments: result, - // ); - } - }, - ); - }, - ), - Form( - key: _form, - child: TextFormField( - validator: (val) { - if (val.isEmpty) { - return 'Id required!!'; - } - return null; + GestureDetector( + child: Container( + margin: EdgeInsets.symmetric(vertical: 10), + height: 200, + decoration: BoxDecoration(border: Border.all()), + child: Center( + child: Text( + 'Please Scan The Cycle Barcode', + style: TextStyle( + color: Colors.black, + fontSize: 5 * _deviceBlockSize, + fontWeight: FontWeight.w100, + letterSpacing: 3, + ), + textAlign: TextAlign.center, + ), + ), + ), + onTap: () { + scan().then( + (String result) { + if (result == 'cancel') { + print('cancel'); + } else if (result == 'error') { + print('error'); + } else if (result == 'access') { + print('access'); + } else { + launch( + 'https://cssd-doc.com/Show/Cycle/$result', + ); + // Navigator.of(context).pushNamed( + // Routes.cycleDetailScreen, + // arguments: result, + // ); + } + }, + ); }, - controller: idCTRL, - decoration: InputDecoration( - icon: Icon( - FontAwesomeIcons.sortNumericDown, - size: 6 * _deviceBlockSize, - ), - labelStyle: TextStyle( - fontWeight: FontWeight.w100, - fontSize: 4 * _deviceBlockSize, - ), - isDense: true, - labelText: 'Or enter a cycle ID', - contentPadding: EdgeInsets.symmetric( - vertical: 2, - horizontal: 3, - ), - focusedBorder: UnderlineInputBorder( - // borderRadius: BorderRadius.only(Radius.circular(4)), - borderSide: BorderSide( - color: Colors.grey, + ), + Form( + key: _form, + child: TextFormField( + validator: (val) { + if (val.isEmpty) { + return 'Id required!!'; + } + return null; + }, + controller: idCTRL, + decoration: InputDecoration( + icon: Icon( + FontAwesomeIcons.sortNumericDown, + size: 6 * _deviceBlockSize, + ), + labelStyle: TextStyle( + fontWeight: FontWeight.w100, + fontSize: 4 * _deviceBlockSize, + ), + isDense: true, + labelText: 'Or enter a cycle ID', + contentPadding: EdgeInsets.symmetric( + vertical: 2, + horizontal: 3, + ), + focusedBorder: UnderlineInputBorder( + // borderRadius: BorderRadius.only(Radius.circular(4)), + borderSide: BorderSide( + color: Colors.grey, + ), ), ), - ), - style: TextStyle( - fontWeight: FontWeight.w700, - fontSize: 5 * _deviceBlockSize, - ), - keyboardType: TextInputType.number, - ), - ), - SizedBox( - height: 40, - ), - Divider( - color: Colors.black, - thickness: 3, - ), - SizedBox( - height: 30, - ), - InkWell( - onTap: () { - if (!_form.currentState.validate()) { - return; - } - launch( - 'https://cssd-doc.com/Show/Cycle/${idCTRL.text}', - ); - // Navigator.of(context).pushNamed( - // Routes.cycleDetailScreen, - // arguments: idCTRL.text, - // ); - }, - child: Container( - padding: EdgeInsets.symmetric( - horizontal: 5 * _deviceBlockSize, - vertical: 10, - ), - margin: EdgeInsets.only(bottom: 50,left: 20,right: 20), - decoration: BoxDecoration( - gradient: LinearGradient( - colors: [Colors.red, Colors.orange], + style: TextStyle( + fontWeight: FontWeight.w700, + fontSize: 5 * _deviceBlockSize, ), - borderRadius: BorderRadius.circular(7), + keyboardType: TextInputType.number, ), - child: Align( - alignment: Alignment.center, - child: Text( - 'GO!', - style: TextStyle( - color: Colors.white, - fontSize: 5 * _deviceBlockSize, + ), + SizedBox( + height: 40, + ), + Divider( + color: Colors.black, + thickness: 3, + ), + SizedBox( + height: 30, + ), + InkWell( + onTap: () { + if (!_form.currentState.validate()) { + return; + } + launch( + 'https://cssd-doc.com/Show/Cycle/${idCTRL.text}', + ); + // Navigator.of(context).pushNamed( + // Routes.cycleDetailScreen, + // arguments: idCTRL.text, + // ); + }, + child: Container( + padding: EdgeInsets.symmetric( + horizontal: 5 * _deviceBlockSize, + vertical: 10, + ), + margin: + EdgeInsets.only(bottom: 50, left: 20, right: 20), + decoration: BoxDecoration( + gradient: LinearGradient( + colors: [Colors.red, Colors.orange], + ), + borderRadius: BorderRadius.circular(7), + ), + child: Align( + alignment: Alignment.center, + child: Text( + 'GO!', + style: TextStyle( + color: Colors.white, + fontSize: 5 * _deviceBlockSize, + ), ), ), ), ), - ), - ], - ) - : ConnectionErrorBox(); - }), + ], + ) + : ConnectionErrorBox(); + }), + ), ); } diff --git a/lib/pages/forget_pass_screen.dart b/lib/pages/forget_pass_screen.dart index a6db5dc..2ba5bce 100644 --- a/lib/pages/forget_pass_screen.dart +++ b/lib/pages/forget_pass_screen.dart @@ -38,7 +38,7 @@ class _ForgetPassScreenState extends State { title: Text('Error'), content: Text(message), actions: [ - FlatButton( + TextButton( child: Text('Ok'), onPressed: () { Navigator.of(ctx).pop(); @@ -90,106 +90,108 @@ class _ForgetPassScreenState extends State { // final double _pixelRatio = (_media.size.height / _media.size.width * 7 / 5); final double _devicewidth = _media.size.width; final double _deviceBlockSize = _devicewidth / 100; - return Scaffold( - appBar: AppBar( - centerTitle: true, - title: Text('CSSD'), - ), - body: Selector( - builder: (ctx, value, _) => value != 'offline' - ? _isLoading - ? Center( - child: CircularProgressIndicator(), - ) - : Form( - key: _form, - child: ListView( - padding: EdgeInsets.symmetric(horizontal: 20), - children: [ - Container( - padding: EdgeInsets.symmetric(vertical: 20), - child: Text( - 'FORGET PASSWORD', - textAlign: TextAlign.left, - style: TextStyle( - color: Colors.black, - fontSize: 5 * _deviceBlockSize, - letterSpacing: 3, - fontWeight: FontWeight.w700, - ), - ), - ), - TextFormField( - validator: (value) { - if (value.isEmpty) { - return 'Cell number is required.'; - } - RegExp regExp = - RegExp(r'^09[0,1,2,3,9]{1}[0-9]{8}$'); - if (!regExp.hasMatch(value)) { - return 'Enter a valid cell number'; - } - return null; - }, - controller: cellNumberController, - decoration: InputDecoration( - icon: Icon( - Icons.call, - size: 6 * _deviceBlockSize, - ), - labelStyle: TextStyle( - fontWeight: FontWeight.w100, - fontSize: 4 * _deviceBlockSize, - ), - labelText: 'Cell Number', - isDense: true, - contentPadding: EdgeInsets.symmetric( - vertical: 2, horizontal: 3), - ), - style: TextStyle( - fontWeight: FontWeight.w700, - fontSize: 5 * _deviceBlockSize, - ), - keyboardType: TextInputType.phone, - textInputAction: TextInputAction.next, - onSaved: (value) { - cellNumberController.text = value; - }, - ), - SizedBox(height: 40), - Row( - children: [ - InkWell( - onTap: () => _requestCode(), - child: Container( - width: 40 * _deviceBlockSize, - padding: EdgeInsets.symmetric( - horizontal: 5 * _deviceBlockSize, - vertical: 10, - ), - // margin: - // EdgeInsets.symmetric(horizontal: 35, vertical: 15), - decoration: BoxDecoration( - gradient: LinearGradient( - colors: [Colors.blue, Colors.green], - ), - borderRadius: BorderRadius.circular(7), - ), - child: Text( - 'Request Code', - style: TextStyle(color: Colors.white), - ), + return SafeArea( + child: Scaffold( + appBar: AppBar( + centerTitle: true, + title: Text('CSSD'), + ), + body: Selector( + builder: (ctx, value, _) => value != 'offline' + ? _isLoading + ? Center( + child: CircularProgressIndicator(), + ) + : Form( + key: _form, + child: ListView( + padding: EdgeInsets.symmetric(horizontal: 20), + children: [ + Container( + padding: EdgeInsets.symmetric(vertical: 20), + child: Text( + 'FORGET PASSWORD', + textAlign: TextAlign.left, + style: TextStyle( + color: Colors.black, + fontSize: 5 * _deviceBlockSize, + letterSpacing: 3, + fontWeight: FontWeight.w700, ), ), - Spacer(), - ], - ), - SizedBox(height: 10), - ], - ), - ) - : ConnectionErrorBox(), - selector: (_, connectivity) => connectivity.conStatus, + ), + TextFormField( + validator: (value) { + if (value.isEmpty) { + return 'Cell number is required.'; + } + RegExp regExp = + RegExp(r'^09[0,1,2,3,9]{1}[0-9]{8}$'); + if (!regExp.hasMatch(value)) { + return 'Enter a valid cell number'; + } + return null; + }, + controller: cellNumberController, + decoration: InputDecoration( + icon: Icon( + Icons.call, + size: 6 * _deviceBlockSize, + ), + labelStyle: TextStyle( + fontWeight: FontWeight.w100, + fontSize: 4 * _deviceBlockSize, + ), + labelText: 'Cell Number', + isDense: true, + contentPadding: EdgeInsets.symmetric( + vertical: 2, horizontal: 3), + ), + style: TextStyle( + fontWeight: FontWeight.w700, + fontSize: 5 * _deviceBlockSize, + ), + keyboardType: TextInputType.phone, + textInputAction: TextInputAction.next, + onSaved: (value) { + cellNumberController.text = value; + }, + ), + SizedBox(height: 40), + Row( + children: [ + InkWell( + onTap: () => _requestCode(), + child: Container( + width: 40 * _deviceBlockSize, + padding: EdgeInsets.symmetric( + horizontal: 5 * _deviceBlockSize, + vertical: 10, + ), + // margin: + // EdgeInsets.symmetric(horizontal: 35, vertical: 15), + decoration: BoxDecoration( + gradient: LinearGradient( + colors: [Colors.blue, Colors.green], + ), + borderRadius: BorderRadius.circular(7), + ), + child: Text( + 'Request Code', + style: TextStyle(color: Colors.white), + ), + ), + ), + Spacer(), + ], + ), + SizedBox(height: 10), + ], + ), + ) + : ConnectionErrorBox(), + selector: (_, connectivity) => connectivity.conStatus, + ), ), ); } diff --git a/lib/pages/home_screen.dart b/lib/pages/home_screen.dart index 4da9e00..4499903 100644 --- a/lib/pages/home_screen.dart +++ b/lib/pages/home_screen.dart @@ -1,4 +1,4 @@ -import 'package:barcode_scan/platform_wrapper.dart'; +import 'package:barcode_scan2/platform_wrapper.dart'; import 'package:double_back_to_close_app/double_back_to_close_app.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; @@ -6,13 +6,13 @@ import 'package:flutter_phoenix/flutter_phoenix.dart'; import 'package:provider/provider.dart'; import 'package:url_launcher/url_launcher.dart'; -import './my_info_screen.dart'; import '../providers/auth.dart'; import '../providers/connectivity.dart'; import '../widgets/Global/drawer.dart'; import '../widgets/Global/internet_error.dart'; import 'cycle_result_screen.dart'; import 'label_result_screen.dart'; +import 'my_info_screen.dart'; import 'test_result_screen.dart'; import 'test_verify_screen.dart'; @@ -25,195 +25,197 @@ class HomePage extends StatelessWidget { final userData = Provider.of(context, listen: false).user; // print(userData['roles']); - return Scaffold( - resizeToAvoidBottomPadding: false, - drawer: Selector( - builder: (ctx, value, _) => - value != 'offline' ? AppDrawer() : Container(), - selector: (_, connctivity) => connctivity.conStatus, - ) - // Consumer(builder: (ct, connection, _) { - // return connection.conStatus != 'offline' ? AppDrawer() : Container(); - // }) - , - appBar: AppBar( - centerTitle: true, - title: Text('CSSD'), - actions: [ - Padding( - padding: const EdgeInsets.only(right: 10.0), - child: IconButton( - icon: Icon( - Icons.power_settings_new, - ), - onPressed: () { - showDialog( - context: context, - builder: (ctx) => AlertDialog( - title: Text('LogOut'), - content: Text('Are you sure for logout?'), - actions: [ - FlatButton( - child: Text('Yes'), - onPressed: () { - Navigator.of(ctx).pop(); - Provider.of(context, listen: false).logout(); - Phoenix.rebirth(context); - }, - ), - FlatButton( - child: Text('No'), - onPressed: () { - Navigator.of(ctx).pop(); - }, - ), - ], - ), - ); - }, - ), - ) - ], - ), - body: Consumer( - builder: (ct, connection, _) { - return connection.conStatus != 'offline' - ? DoubleBackToCloseApp( - snackBar: SnackBar( - duration: Duration(seconds: 2), - backgroundColor: Colors.black, - content: Text( - 'Double tap for exit . . .', - style: TextStyle(color: Colors.white), - ), - ), - child: Container( - margin: EdgeInsets.only( - top: 0, bottom: 10, left: 20, right: 20), - child: ListView( - // crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Container( - margin: EdgeInsets.only(top: 20, bottom: 10), - child: Text( - 'WELCOME HOME', - style: TextStyle( - color: Colors.black, - fontSize: 20, - letterSpacing: 3.5, - fontWeight: FontWeight.w700, - ), - ), + return SafeArea( + child: Scaffold( + // resizeToAvoidBottomPadding: false, + drawer: Selector( + builder: (ctx, value, _) => + value != 'offline' ? AppDrawer() : Container(), + selector: (_, connctivity) => connctivity.conStatus, + ) + // Consumer(builder: (ct, connection, _) { + // return connection.conStatus != 'offline' ? AppDrawer() : Container(); + // }) + , + appBar: AppBar( + centerTitle: true, + title: Text('CSSD'), + actions: [ + Padding( + padding: const EdgeInsets.only(right: 10.0), + child: IconButton( + icon: Icon( + Icons.power_settings_new, + ), + onPressed: () { + showDialog( + context: context, + builder: (ctx) => AlertDialog( + title: Text('LogOut'), + content: Text('Are you sure for logout?'), + actions: [ + TextButton( + child: Text('Yes'), + onPressed: () { + Navigator.of(ctx).pop(); + Provider.of(context, listen: false).logout(); + Phoenix.rebirth(context); + }, ), - SelectionItem( - startColor: Color(0xFFFCB8A2), - endColor: Color(0xFFFFECD2), - firstLine: 'My INFO', - secondLine: 'List, Details & Add a one', - onTap: () => Navigator.push( - context, - MaterialPageRoute( - builder: (context) { - return Consumer( - builder: (ctx, auth, _) { - return MyInfoScreen(); - }, - ); - }, - ), - ), + TextButton( + child: Text('No'), + onPressed: () { + Navigator.of(ctx).pop(); + }, ), - SelectionItem( - startColor: Color(0xFFD5F5FD), - endColor: Color(0xFFE9FFF7), - firstLine: 'TEST RESULTS', - secondLine: 'List, Details & Add a one', - onTap: () => Navigator.push( - context, - MaterialPageRoute( - builder: (context) { - return Consumer( - builder: (ctx, auth, _) { - return TestResultScreen(); - }, - ); - }, - ), - ), - // MyTestResult( - // isAdmin: false, - // ), - ), - SelectionItem( - startColor: Color(0xFFE2D2C4), - endColor: Color(0xFFFAF7F5), - firstLine: 'LABELS', - secondLine: 'List, Details & Add a one', - onTap: () => Navigator.push( - context, - MaterialPageRoute( - builder: (context) { - return Consumer( - builder: (ctx, auth, _) { - return LabelResultScreen(); - }, - ); - }, - ), - ), - ), - SelectionItem( - startColor: Color(0xFFA7CCE1), - endColor: Color(0xFFECF7ED), - firstLine: 'CYCLES', - secondLine: 'List, Details & Add a one', - onTap: () => Navigator.push( - context, - MaterialPageRoute( - builder: (context) { - return Consumer( - builder: (ctx, auth, _) { - return CycleResultScreen(); - }, - ); - }, - ), - ), - ), - // SelectionItem( - // startColor: Color(0xFFA7CCE1), - // endColor: Color(0xFFECF7ED), - // firstLine: 'image', - // secondLine: 'image', - // onTap: CaptureImage(), - // ), - userData['roles'].contains('User') - ? Container() - : SelectionItem( - startColor: Color(0xFFA7CCE1), - endColor: Color(0xFFECF7ED), - firstLine: 'TEST TO VERIFY', - secondLine: 'Verify and reject Test Results', - onTap: () => Navigator.push( - context, - MaterialPageRoute( - builder: (context) { - return Consumer( - builder: (ctx, auth, _) { - return TestVerifyScreen(); - }, - ); - }, - ), - ), - ), - BarcodeSelectionItem(), ], ), - ), - ) - : ConnectionErrorBox(); - }, + ); + }, + ), + ) + ], + ), + body: Consumer( + builder: (ct, connection, _) { + return connection.conStatus != 'offline' + ? DoubleBackToCloseApp( + snackBar: SnackBar( + duration: Duration(seconds: 2), + backgroundColor: Colors.black, + content: Text( + 'Double tap for exit . . .', + style: TextStyle(color: Colors.white), + ), + ), + child: Container( + margin: EdgeInsets.only( + top: 0, bottom: 10, left: 20, right: 20), + child: ListView( + // crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Container( + margin: EdgeInsets.only(top: 20, bottom: 10), + child: Text( + 'WELCOME HOME', + style: TextStyle( + color: Colors.black, + fontSize: 20, + letterSpacing: 3.5, + fontWeight: FontWeight.w700, + ), + ), + ), + SelectionItem( + startColor: Color(0xFFFCB8A2), + endColor: Color(0xFFFFECD2), + firstLine: 'My INFO', + secondLine: 'List, Details & Add a one', + onTap: () => Navigator.push( + context, + MaterialPageRoute( + builder: (context) { + return Consumer( + builder: (ctx, auth, _) { + return MyInfoScreen(); + }, + ); + }, + ), + ), + ), + SelectionItem( + startColor: Color(0xFFD5F5FD), + endColor: Color(0xFFE9FFF7), + firstLine: 'TEST RESULTS', + secondLine: 'List, Details & Add a one', + onTap: () => Navigator.push( + context, + MaterialPageRoute( + builder: (context) { + return Consumer( + builder: (ctx, auth, _) { + return TestResultScreen(); + }, + ); + }, + ), + ), + // MyTestResult( + // isAdmin: false, + // ), + ), + SelectionItem( + startColor: Color(0xFFE2D2C4), + endColor: Color(0xFFFAF7F5), + firstLine: 'LABELS', + secondLine: 'List, Details & Add a one', + onTap: () => Navigator.push( + context, + MaterialPageRoute( + builder: (context) { + return Consumer( + builder: (ctx, auth, _) { + return LabelResultScreen(); + }, + ); + }, + ), + ), + ), + SelectionItem( + startColor: Color(0xFFA7CCE1), + endColor: Color(0xFFECF7ED), + firstLine: 'CYCLES', + secondLine: 'List, Details & Add a one', + onTap: () => Navigator.push( + context, + MaterialPageRoute( + builder: (context) { + return Consumer( + builder: (ctx, auth, _) { + return CycleResultScreen(); + }, + ); + }, + ), + ), + ), + // SelectionItem( + // startColor: Color(0xFFA7CCE1), + // endColor: Color(0xFFECF7ED), + // firstLine: 'image', + // secondLine: 'image', + // onTap: CaptureImage(), + // ), + userData['roles'].contains('User') + ? Container() + : SelectionItem( + startColor: Color(0xFFA7CCE1), + endColor: Color(0xFFECF7ED), + firstLine: 'TEST TO VERIFY', + secondLine: 'Verify and reject Test Results', + onTap: () => Navigator.push( + context, + MaterialPageRoute( + builder: (context) { + return Consumer( + builder: (ctx, auth, _) { + return TestVerifyScreen(); + }, + ); + }, + ), + ), + ), + BarcodeSelectionItem(), + ], + ), + ), + ) + : ConnectionErrorBox(); + }, + ), ), ); } @@ -359,7 +361,7 @@ class BarcodeSelectionItem extends StatelessWidget { print(result); showDialog( context: context, - child: AlertDialog( + builder: (_) => AlertDialog( title: Text( 'نتیجه ی اسکن', textDirection: TextDirection.rtl, @@ -376,7 +378,7 @@ class BarcodeSelectionItem extends StatelessWidget { ), ), actions: [ - FlatButton( + TextButton( onPressed: () async { await launch(result); Navigator.of(context).pop(); diff --git a/lib/pages/label_add_screen.dart b/lib/pages/label_add_screen.dart index 686a836..f887d59 100644 --- a/lib/pages/label_add_screen.dart +++ b/lib/pages/label_add_screen.dart @@ -84,195 +84,197 @@ class _LabelAddScreenState extends State { ); return true; }, - child: Scaffold( - appBar: AppBar( - titleSpacing: -10, - title: Text('Labels'), - leading: IconButton( - icon: Icon( - Icons.keyboard_arrow_left, - size: 35, + child: SafeArea( + child: Scaffold( + appBar: AppBar( + titleSpacing: -10, + title: Text('Labels'), + leading: IconButton( + icon: Icon( + Icons.keyboard_arrow_left, + size: 35, + ), + onPressed: () => Navigator.of(context) + .pushReplacementNamed(Routes.labelResultScreen), ), - onPressed: () => Navigator.of(context) - .pushReplacementNamed(Routes.labelResultScreen), ), - ), - body: Consumer(builder: (ct, connection, _) { - return connection.conStatus != 'offline' - ? isInit - ? Center( - child: CircularProgressIndicator(), - ) - : Form( - key: _form, - child: Padding( - padding: EdgeInsets.all(20), - child: ListView( - children: [ - Text( - 'ADD A LABEL', - style: TextStyle( - fontWeight: FontWeight.w700, - fontSize: 6 * _deviceBlockSize, - letterSpacing: 3, - ), - ), - SizedBox( - height: 20, - ), - TextFormField( - onChanged: (val) { - setState(() { - lotNumberCTRL.text = - val + ' - ' + cycleNumberCTRL.text; - }); - }, - validator: (val) { - if (val.isEmpty) { - return 'Strilizer ID required!'; - } - return null; - }, - controller: striizerIdCTRL, - decoration: InputDecoration( - icon: Icon(FontAwesomeIcons.sortNumericDown, - size: 7 * _deviceBlockSize), - isDense: true, - labelText: 'Strilizer ID', - contentPadding: EdgeInsets.symmetric( - vertical: 2, horizontal: 3), - labelStyle: TextStyle( - fontWeight: FontWeight.w100, - fontSize: 4 * _deviceBlockSize, + body: Consumer(builder: (ct, connection, _) { + return connection.conStatus != 'offline' + ? isInit + ? Center( + child: CircularProgressIndicator(), + ) + : Form( + key: _form, + child: Padding( + padding: EdgeInsets.all(20), + child: ListView( + children: [ + Text( + 'ADD A LABEL', + style: TextStyle( + fontWeight: FontWeight.w700, + fontSize: 6 * _deviceBlockSize, + letterSpacing: 3, ), ), - style: TextStyle( - fontWeight: FontWeight.w700, - fontSize: 5 * _deviceBlockSize, + SizedBox( + height: 20, ), - keyboardType: TextInputType.visiblePassword, - textInputAction: TextInputAction.next, - onFieldSubmitted: (_) { - FocusScope.of(context) - .requestFocus(_cycleNumberFocusNode); - }, - ), - SizedBox( - height: 20, - ), - TextFormField( - onChanged: (val) { - setState( - () { + TextFormField( + onChanged: (val) { + setState(() { lotNumberCTRL.text = - striizerIdCTRL.text + ' - ' + val; - }, - ); - }, - validator: (val) { - if (val.isEmpty) { - return 'Cycle number required!'; - } - return null; - }, - controller: cycleNumberCTRL, - decoration: InputDecoration( - icon: Icon( - FontAwesomeIcons.sortNumericDown, - size: 7 * _deviceBlockSize, + val + ' - ' + cycleNumberCTRL.text; + }); + }, + validator: (val) { + if (val.isEmpty) { + return 'Strilizer ID required!'; + } + return null; + }, + controller: striizerIdCTRL, + decoration: InputDecoration( + icon: Icon(FontAwesomeIcons.sortNumericDown, + size: 7 * _deviceBlockSize), + isDense: true, + labelText: 'Strilizer ID', + contentPadding: EdgeInsets.symmetric( + vertical: 2, horizontal: 3), + labelStyle: TextStyle( + fontWeight: FontWeight.w100, + fontSize: 4 * _deviceBlockSize, + ), ), - labelStyle: TextStyle( - fontWeight: FontWeight.w100, - fontSize: 4 * _deviceBlockSize, + style: TextStyle( + fontWeight: FontWeight.w700, + fontSize: 5 * _deviceBlockSize, ), - isDense: true, - labelText: 'Cycle Number', - contentPadding: EdgeInsets.symmetric( - vertical: 2, horizontal: 3), + keyboardType: TextInputType.visiblePassword, + textInputAction: TextInputAction.next, + onFieldSubmitted: (_) { + FocusScope.of(context) + .requestFocus(_cycleNumberFocusNode); + }, ), - style: TextStyle( - fontWeight: FontWeight.w700, - fontSize: 5 * _deviceBlockSize, + SizedBox( + height: 20, ), - focusNode: _cycleNumberFocusNode, - keyboardType: TextInputType.number, - textInputAction: TextInputAction.done, - ), - SizedBox( - height: 20, - ), - TextFormField( - readOnly: true, - controller: lotNumberCTRL, - decoration: InputDecoration( - icon: Icon( - FontAwesomeIcons.sortNumericDown, - size: 7 * _deviceBlockSize, + TextFormField( + onChanged: (val) { + setState( + () { + lotNumberCTRL.text = + striizerIdCTRL.text + ' - ' + val; + }, + ); + }, + validator: (val) { + if (val.isEmpty) { + return 'Cycle number required!'; + } + return null; + }, + controller: cycleNumberCTRL, + decoration: InputDecoration( + icon: Icon( + FontAwesomeIcons.sortNumericDown, + size: 7 * _deviceBlockSize, + ), + labelStyle: TextStyle( + fontWeight: FontWeight.w100, + fontSize: 4 * _deviceBlockSize, + ), + isDense: true, + labelText: 'Cycle Number', + contentPadding: EdgeInsets.symmetric( + vertical: 2, horizontal: 3), ), - labelStyle: TextStyle( - fontWeight: FontWeight.w100, - fontSize: 4 * _deviceBlockSize, - ), - isDense: true, - labelText: 'Lot Number', - contentPadding: EdgeInsets.symmetric( - vertical: 2, - horizontal: 3, + style: TextStyle( + fontWeight: FontWeight.w700, + fontSize: 5 * _deviceBlockSize, ), + focusNode: _cycleNumberFocusNode, + keyboardType: TextInputType.number, + textInputAction: TextInputAction.done, ), - style: TextStyle( - fontWeight: FontWeight.w700, - fontSize: 5 * _deviceBlockSize, + SizedBox( + height: 20, ), - keyboardType: TextInputType.visiblePassword, - ), - SizedBox( - height: 20, - ), - LabelAddSelectorBox( - deviceBlockSize: _deviceBlockSize, - packageCTRL: packageCTRL, - packageVals: packageVals, - packageValue: packageValue, - ), - SizedBox( - height: 10, - ), - LabelAddDatePicker( - dateCTRL: sDateCTRL, - deviceBlockSize: _deviceBlockSize, - label: 'Sterile Date', - ), - SizedBox( - height: 20, - ), - LabelAddDatePicker( - dateCTRL: eDateCTRL, - deviceBlockSize: _deviceBlockSize, - label: 'Expire Date', - ), - SizedBox( - height: 70, - ), - LabelAddSaveButton( - form: _form, - lotNumberCTRL: lotNumberCTRL, - cycleNumberCTRL: cycleNumberCTRL, - sDateCTRL: sDateCTRL, - packageValue: packageValue, - eDateCTRL: eDateCTRL, - striizerIdCTRL: striizerIdCTRL, - deviceBlockSize: _deviceBlockSize, - ), - SizedBox( - height: 100, - ), - ], + TextFormField( + readOnly: true, + controller: lotNumberCTRL, + decoration: InputDecoration( + icon: Icon( + FontAwesomeIcons.sortNumericDown, + size: 7 * _deviceBlockSize, + ), + labelStyle: TextStyle( + fontWeight: FontWeight.w100, + fontSize: 4 * _deviceBlockSize, + ), + isDense: true, + labelText: 'Lot Number', + contentPadding: EdgeInsets.symmetric( + vertical: 2, + horizontal: 3, + ), + ), + style: TextStyle( + fontWeight: FontWeight.w700, + fontSize: 5 * _deviceBlockSize, + ), + keyboardType: TextInputType.visiblePassword, + ), + SizedBox( + height: 20, + ), + LabelAddSelectorBox( + deviceBlockSize: _deviceBlockSize, + packageCTRL: packageCTRL, + packageVals: packageVals, + packageValue: packageValue, + ), + SizedBox( + height: 10, + ), + LabelAddDatePicker( + dateCTRL: sDateCTRL, + deviceBlockSize: _deviceBlockSize, + label: 'Sterile Date', + ), + SizedBox( + height: 20, + ), + LabelAddDatePicker( + dateCTRL: eDateCTRL, + deviceBlockSize: _deviceBlockSize, + label: 'Expire Date', + ), + SizedBox( + height: 70, + ), + LabelAddSaveButton( + form: _form, + lotNumberCTRL: lotNumberCTRL, + cycleNumberCTRL: cycleNumberCTRL, + sDateCTRL: sDateCTRL, + packageValue: packageValue, + eDateCTRL: eDateCTRL, + striizerIdCTRL: striizerIdCTRL, + deviceBlockSize: _deviceBlockSize, + ), + SizedBox( + height: 100, + ), + ], + ), ), - ), - ) - : ConnectionErrorBox(); - }), + ) + : ConnectionErrorBox(); + }), + ), ), ); } diff --git a/lib/pages/label_detail_screen.dart b/lib/pages/label_detail_screen.dart index 885fb22..fdc09a1 100644 --- a/lib/pages/label_detail_screen.dart +++ b/lib/pages/label_detail_screen.dart @@ -1,8 +1,8 @@ -import 'package:cssd/models/label_models.dart'; -import 'package:cssd/providers/connectivity.dart'; -import 'package:cssd/providers/labels.dart'; -import 'package:cssd/widgets/Global/internet_error.dart'; -import 'package:cssd/widgets/LabelScreens/Detail/datas_box.dart'; +import '../models/label_models.dart'; +import '../providers/connectivity.dart'; +import '../providers/labels.dart'; +import '../widgets/Global/internet_error.dart'; +import '../widgets/LabelScreens/Detail/datas_box.dart'; import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; @@ -50,35 +50,36 @@ class _LabelDetailScreenState extends State { // final double _pixelRatio = (_media.size.height / _media.size.width * 7 / 5); final double _devicewidth = _media.size.width; final double _deviceBlockSize = _devicewidth / 100; - print(datas); - return Scaffold( - appBar: AppBar( - titleSpacing: -10, - title: Text('Labels'), - leading: IconButton( - icon: Icon( - Icons.keyboard_arrow_left, - size: 35, + return SafeArea( + child: Scaffold( + appBar: AppBar( + titleSpacing: -10, + title: Text('Labels'), + leading: IconButton( + icon: Icon( + Icons.keyboard_arrow_left, + size: 35, + ), + onPressed: () => Navigator.of(context).pop(), ), - onPressed: () => Navigator.of(context).pop(), ), + body: Consumer(builder: (ct, connection, _) { + return connection.conStatus != 'offline' + ? isInit + ? Center( + child: CircularProgressIndicator(), + ) + : isEmpty + ? Center( + child: Text('This Lable doesnt exists!'), + ) + : LabelDetailsDataBox( + datas: datas, + deviceBlockSize: _deviceBlockSize, + ) + : ConnectionErrorBox(); + }), ), - body: Consumer(builder: (ct, connection, _) { - return connection.conStatus != 'offline' - ? isInit - ? Center( - child: CircularProgressIndicator(), - ) - : isEmpty - ? Center( - child: Text('This Lable doesnt exists!'), - ) - : LabelDetailsDataBox( - datas: datas, - deviceBlockSize: _deviceBlockSize, - ) - : ConnectionErrorBox(); - }), ); } } diff --git a/lib/pages/label_filter_screen.dart b/lib/pages/label_filter_screen.dart index ae8f29f..8c8c211 100644 --- a/lib/pages/label_filter_screen.dart +++ b/lib/pages/label_filter_screen.dart @@ -1,16 +1,17 @@ -import 'package:barcode_scan/barcode_scan.dart'; -import 'package:cssd/config/routes.dart'; -import 'package:cssd/models/label_models.dart'; -import 'package:cssd/providers/connectivity.dart'; -import 'package:cssd/providers/labels.dart'; -import 'package:cssd/widgets/Global/internet_error.dart'; -import 'package:cssd/widgets/LabelScreens/Filter/save_button.dart'; -import 'package:cssd/widgets/LabelScreens/Filter/selector_box.dart'; +import 'package:barcode_scan2/barcode_scan2.dart'; +import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; import 'package:font_awesome_flutter/font_awesome_flutter.dart'; import 'package:provider/provider.dart'; -import 'package:flutter/cupertino.dart'; + +import '../config/routes.dart'; +import '../models/label_models.dart'; +import '../providers/connectivity.dart'; +import '../providers/labels.dart'; +import '../widgets/Global/internet_error.dart'; +import '../widgets/LabelScreens/Filter/save_button.dart'; +import '../widgets/LabelScreens/Filter/selector_box.dart'; class LabelFilterScreen extends StatefulWidget { // static const route = '/LabelFilterScreen'; @@ -90,203 +91,206 @@ class _LabelFilterScreenState extends State { ); return true; }, - child: Scaffold( - appBar: AppBar( - titleSpacing: -10, - title: Text('Labels'), - leading: IconButton( - icon: Icon( - Icons.keyboard_arrow_left, - size: 35, + child: SafeArea( + child: Scaffold( + appBar: AppBar( + titleSpacing: -10, + title: Text('Labels'), + leading: IconButton( + icon: Icon( + Icons.keyboard_arrow_left, + size: 35, + ), + onPressed: () => Navigator.of(context) + .pushReplacementNamed(Routes.labelResultScreen), ), - onPressed: () => Navigator.of(context) - .pushReplacementNamed(Routes.labelResultScreen), ), - ), - body: Consumer( - builder: (ct, connection, _) { - return connection.conStatus != 'offline' - ? isInit - ? Center( - child: CircularProgressIndicator(), - ) - : Padding( - padding: EdgeInsets.all(20), - child: ListView( - children: [ - Text( - 'FILTER RESULTS', - style: TextStyle( - fontWeight: FontWeight.w700, - fontSize: 5 * _deviceBlockSize, - ), - ), - SizedBox( - height: 20, - ), - Row( - children: [ - Flexible( - flex: 8, - child: TextFormField( - controller: labelIdCTRl, - decoration: InputDecoration( - icon: Icon( - FontAwesomeIcons.sortNumericDown, - size: 6 * _deviceBlockSize, - ), - labelStyle: TextStyle( - fontWeight: FontWeight.w100, - fontSize: 4 * _deviceBlockSize, - ), - labelText: 'Label ID', - isDense: true, - contentPadding: EdgeInsets.symmetric( - vertical: 2, horizontal: 3), - ), - style: TextStyle( - fontWeight: FontWeight.w700, - fontSize: 5 * _deviceBlockSize, - ), - keyboardType: TextInputType.number, - textInputAction: TextInputAction.next, - onFieldSubmitted: (_) { - FocusScope.of(context) - .requestFocus(_cycleNumberFocusNode); - }, - ), + body: Consumer( + builder: (ct, connection, _) { + return connection.conStatus != 'offline' + ? isInit + ? Center( + child: CircularProgressIndicator(), + ) + : Padding( + padding: EdgeInsets.all(20), + child: ListView( + children: [ + Text( + 'FILTER RESULTS', + style: TextStyle( + fontWeight: FontWeight.w700, + fontSize: 5 * _deviceBlockSize, ), - Flexible( - flex: 1, - child: InkWell( - onTap: () { - scan().then( - (String result) { - if (result == 'cancel') { - print('cancel'); - } else if (result == 'error') { - print('error'); - } else if (result == 'access') { - print('access'); - } else { - print(result); - labelIdCTRl.text = result; - // Navigator.of(context).pushNamed( - // CycleDetailScreen.route, - // arguments: result, - // ); - } - }, - ); - }, - child: Container( - padding: EdgeInsets.all(8), - decoration: BoxDecoration( - shape: BoxShape.circle, - color: Colors.black, + ), + SizedBox( + height: 20, + ), + Row( + children: [ + Flexible( + flex: 8, + child: TextFormField( + controller: labelIdCTRl, + decoration: InputDecoration( + icon: Icon( + FontAwesomeIcons.sortNumericDown, + size: 6 * _deviceBlockSize, + ), + labelStyle: TextStyle( + fontWeight: FontWeight.w100, + fontSize: 4 * _deviceBlockSize, + ), + labelText: 'Label ID', + isDense: true, + contentPadding: EdgeInsets.symmetric( + vertical: 2, horizontal: 3), ), - child: Icon( - FontAwesomeIcons.barcode, - size: 5 * _deviceBlockSize, - color: Colors.white, + style: TextStyle( + fontWeight: FontWeight.w700, + fontSize: 5 * _deviceBlockSize, ), + keyboardType: TextInputType.number, + textInputAction: TextInputAction.next, + onFieldSubmitted: (_) { + FocusScope.of(context).requestFocus( + _cycleNumberFocusNode); + }, ), ), - ) - ], - ), - SizedBox( - height: 30, - ), - TextFormField( - controller: cycleNumberCTRL, - decoration: InputDecoration( - icon: Icon( - FontAwesomeIcons.sortNumericDown, - size: 6 * _deviceBlockSize, - ), - labelStyle: TextStyle( - fontWeight: FontWeight.w100, - fontSize: 4 * _deviceBlockSize, - ), - labelText: 'Cycle Number', - isDense: true, - contentPadding: EdgeInsets.symmetric( - vertical: 2, horizontal: 3), + Flexible( + flex: 1, + child: InkWell( + onTap: () { + scan().then( + (String result) { + if (result == 'cancel') { + print('cancel'); + } else if (result == 'error') { + print('error'); + } else if (result == 'access') { + print('access'); + } else { + print(result); + labelIdCTRl.text = result; + // Navigator.of(context).pushNamed( + // CycleDetailScreen.route, + // arguments: result, + // ); + } + }, + ); + }, + child: Container( + padding: EdgeInsets.all(8), + decoration: BoxDecoration( + shape: BoxShape.circle, + color: Colors.black, + ), + child: Icon( + FontAwesomeIcons.barcode, + size: 5 * _deviceBlockSize, + color: Colors.white, + ), + ), + ), + ) + ], ), - style: TextStyle( - fontWeight: FontWeight.w700, - fontSize: 5 * _deviceBlockSize, + SizedBox( + height: 30, ), - focusNode: _cycleNumberFocusNode, - keyboardType: TextInputType.visiblePassword, - textInputAction: TextInputAction.next, - onFieldSubmitted: (_) { - FocusScope.of(context) - .requestFocus(_strilizerIdFocusNode); - }, - ), - SizedBox( - height: 30, - ), - TextFormField( - controller: striizerIdCTRL, - decoration: InputDecoration( - icon: Icon( - FontAwesomeIcons.sortNumericDown, - size: 6 * _deviceBlockSize, + TextFormField( + controller: cycleNumberCTRL, + decoration: InputDecoration( + icon: Icon( + FontAwesomeIcons.sortNumericDown, + size: 6 * _deviceBlockSize, + ), + labelStyle: TextStyle( + fontWeight: FontWeight.w100, + fontSize: 4 * _deviceBlockSize, + ), + labelText: 'Cycle Number', + isDense: true, + contentPadding: EdgeInsets.symmetric( + vertical: 2, horizontal: 3), ), - labelStyle: TextStyle( - fontWeight: FontWeight.w100, - fontSize: 4 * _deviceBlockSize, + style: TextStyle( + fontWeight: FontWeight.w700, + fontSize: 5 * _deviceBlockSize, ), - labelText: 'Strilizer ID', - isDense: true, - contentPadding: EdgeInsets.symmetric( - vertical: 2, horizontal: 3), + focusNode: _cycleNumberFocusNode, + keyboardType: TextInputType.visiblePassword, + textInputAction: TextInputAction.next, + onFieldSubmitted: (_) { + FocusScope.of(context) + .requestFocus(_strilizerIdFocusNode); + }, ), - style: TextStyle( - fontWeight: FontWeight.w700, - fontSize: 5 * _deviceBlockSize, + SizedBox( + height: 30, + ), + TextFormField( + controller: striizerIdCTRL, + decoration: InputDecoration( + icon: Icon( + FontAwesomeIcons.sortNumericDown, + size: 6 * _deviceBlockSize, + ), + labelStyle: TextStyle( + fontWeight: FontWeight.w100, + fontSize: 4 * _deviceBlockSize, + ), + labelText: 'Strilizer ID', + isDense: true, + contentPadding: EdgeInsets.symmetric( + vertical: 2, horizontal: 3), + ), + style: TextStyle( + fontWeight: FontWeight.w700, + fontSize: 5 * _deviceBlockSize, + ), + textInputAction: TextInputAction.done, + keyboardType: TextInputType.visiblePassword, + focusNode: _strilizerIdFocusNode, + ), + SizedBox( + height: 30, ), - textInputAction: TextInputAction.done, - keyboardType: TextInputType.visiblePassword, - focusNode: _strilizerIdFocusNode, - ), - SizedBox( - height: 30, - ), - LabelFilterSelectorBox( - deviceBlockSize: _deviceBlockSize, - hospitalCTRL: hospitalCTRL, - hospitalVals: hospitalVals, - ), - SizedBox( - height: 70, - ), - LabelFilterSaveButton( - hospitalVals: hospitalVals, - hospitalCTRL: hospitalCTRL, - labelIdCTRl: labelIdCTRl, - cycleNumberCTRL: cycleNumberCTRL, - striizerIdCTRL: striizerIdCTRL, - deviceBlockSize: _deviceBlockSize, - ), - SizedBox( - height: 50, - ), - // DropDownBox(values: ['Washer ID']), - ], - ), - ) - : ConnectionErrorBox(); - }, + LabelFilterSelectorBox( + deviceBlockSize: _deviceBlockSize, + hospitalCTRL: hospitalCTRL, + hospitalVals: hospitalVals, + ), + SizedBox( + height: 70, + ), + LabelFilterSaveButton( + hospitalVals: hospitalVals, + hospitalCTRL: hospitalCTRL, + labelIdCTRl: labelIdCTRl, + cycleNumberCTRL: cycleNumberCTRL, + striizerIdCTRL: striizerIdCTRL, + deviceBlockSize: _deviceBlockSize, + ), + SizedBox( + height: 50, + ), + // DropDownBox(values: ['Washer ID']), + ], + ), + ) + : ConnectionErrorBox(); + }, + ), ), ), ); } } + Future scan() async { try { var barcode = await BarcodeScanner.scan(); diff --git a/lib/pages/label_result_screen.dart b/lib/pages/label_result_screen.dart index 16949e2..ea3426b 100644 --- a/lib/pages/label_result_screen.dart +++ b/lib/pages/label_result_screen.dart @@ -1,15 +1,16 @@ -import 'package:cssd/config/routes.dart'; -import 'package:cssd/providers/connectivity.dart'; -import 'package:cssd/widgets/Global/page_header.dart'; -import 'package:cssd/widgets/Global/internet_error.dart'; -import 'package:cssd/widgets/LabelScreens/Result/data_box.dart'; -import 'package:cssd/widgets/LabelScreens/Result/filter_chip_box.dart'; -import 'package:cssd/widgets/LabelScreens/Result/floating_buttons.dart'; -import 'package:cssd/widgets/LabelScreens/Result/search_box.dart'; import 'package:flutter/material.dart'; import 'package:font_awesome_flutter/font_awesome_flutter.dart'; import 'package:provider/provider.dart'; + +import '../config/routes.dart'; +import '../providers/connectivity.dart'; import '../providers/labels.dart'; +import '../widgets/Global/internet_error.dart'; +import '../widgets/Global/page_header.dart'; +import '../widgets/LabelScreens/Result/data_box.dart'; +import '../widgets/LabelScreens/Result/filter_chip_box.dart'; +import '../widgets/LabelScreens/Result/floating_buttons.dart'; +import '../widgets/LabelScreens/Result/search_box.dart'; class LabelResultScreen extends StatefulWidget { // static const route = '/LabelResultScreen'; @@ -61,150 +62,155 @@ class _LabelResultScreenState extends State { final _media = MediaQuery.of(context); final double _devicewidth = _media.size.width; final double _deviceBlockSize = _devicewidth / 100; - return Scaffold( - floatingActionButton: - LabelFloatingButtons(deviceBlockSize: _deviceBlockSize), - appBar: AppBar( - titleSpacing: -10, - title: Text('Home'), - leading: IconButton( - icon: Icon( - Icons.keyboard_arrow_left, - size: 35, + return SafeArea( + child: Scaffold( + floatingActionButton: + LabelFloatingButtons(deviceBlockSize: _deviceBlockSize), + appBar: AppBar( + titleSpacing: -10, + title: Text('Home'), + leading: IconButton( + icon: Icon( + Icons.keyboard_arrow_left, + size: 35, + ), + onPressed: () => Navigator.of(context).pop(), ), - onPressed: () => Navigator.of(context).pop(), ), - ), - body: Consumer( - builder: (ct, connection, _) { - return connection.conStatus != 'offline' - ? Padding( - padding: - EdgeInsets.only(top: 20, right: 20, bottom: 60, left: 20), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - PageHeader( - deviceBlockSize: _deviceBlockSize, - label: 'LABELS', - route: Routes.labelFilterScreen, - ), - SizedBox( - height: 10, - ), - Consumer( - builder: (context, label, _) { - return Container( - height: 50, - child: ListView( - scrollDirection: Axis.horizontal, - shrinkWrap: true, - children: [ - InkWell( - onTap: () { - Navigator.of(context).popAndPushNamed( - Routes.labelFilterScreen, - ); - }, - child: Chip( - backgroundColor: Colors.black, - label: Text( - 'Filters', - style: TextStyle( - color: Colors.white, - ), - ), - deleteIcon: Icon( - FontAwesomeIcons.filter, - color: Colors.white, - size: 4 * _deviceBlockSize, - ), - onDeleted: () { + body: Consumer( + builder: (ct, connection, _) { + return connection.conStatus != 'offline' + ? Padding( + padding: EdgeInsets.only( + top: 20, right: 20, bottom: 60, left: 20), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + PageHeader( + deviceBlockSize: _deviceBlockSize, + label: 'LABELS', + route: Routes.labelFilterScreen, + ), + SizedBox( + height: 10, + ), + Consumer( + builder: (context, label, _) { + return Container( + height: 50, + child: ListView( + scrollDirection: Axis.horizontal, + shrinkWrap: true, + children: [ + InkWell( + onTap: () { Navigator.of(context).popAndPushNamed( Routes.labelFilterScreen, ); }, - ), - ), - label.filters.id != '' - ? LabelFilterChip( - deviceBlockSize: _deviceBlockSize, - id: '', - cycleNumber: label.filters.cycleNumber, - sterilizerId: - label.filters.sterilizerId, - hospital: label.filters.hospital, - label: 'ID', - ) - : Container(), - label.filters.cycleNumber != '' - ? LabelFilterChip( - deviceBlockSize: _deviceBlockSize, - id: label.filters.id, - cycleNumber: '', - sterilizerId: - label.filters.sterilizerId, - hospital: label.filters.hospital, - label: 'Cycle Number', - ) - : Container(), - label.filters.sterilizerId != '' - ? LabelFilterChip( - deviceBlockSize: _deviceBlockSize, - id: label.filters.id, - cycleNumber: label.filters.cycleNumber, - sterilizerId: '', - hospital: label.filters.hospital, - label: 'Sterilizer ID', - ) - : Container(), - label.filters.hospital != '' - ? LabelFilterChip( - deviceBlockSize: _deviceBlockSize, - id: label.filters.id, - cycleNumber: label.filters.cycleNumber, - sterilizerId: - label.filters.sterilizerId, - hospital: '', - label: 'Hospital', - ) - : Container(), - ], - ), - ); - }, - ), - LabelSearchBox( - searchCTRL: searchCTRL, - deviceBlockSize: _deviceBlockSize), - SizedBox( - height: 20, - ), - Expanded( - child: Consumer( - builder: (context, labelResults, _) { - return labelResults.isloading - ? Center( - child: CircularProgressIndicator(), - ) - : ListView.builder( - controller: sc, - itemBuilder: (context, index) => - LabelItemBox( - deviceBlockSize: _deviceBlockSize, - item: labelResults.items[index], + child: Chip( + backgroundColor: Colors.black, + label: Text( + 'Filters', + style: TextStyle( + color: Colors.white, + ), + ), + deleteIcon: Icon( + FontAwesomeIcons.filter, + color: Colors.white, + size: 4 * _deviceBlockSize, + ), + onDeleted: () { + Navigator.of(context).popAndPushNamed( + Routes.labelFilterScreen, + ); + }, ), - itemCount: labelResults.items.length, - shrinkWrap: true, - ); + ), + label.filters.id != '' + ? LabelFilterChip( + deviceBlockSize: _deviceBlockSize, + id: '', + cycleNumber: + label.filters.cycleNumber, + sterilizerId: + label.filters.sterilizerId, + hospital: label.filters.hospital, + label: 'ID', + ) + : Container(), + label.filters.cycleNumber != '' + ? LabelFilterChip( + deviceBlockSize: _deviceBlockSize, + id: label.filters.id, + cycleNumber: '', + sterilizerId: + label.filters.sterilizerId, + hospital: label.filters.hospital, + label: 'Cycle Number', + ) + : Container(), + label.filters.sterilizerId != '' + ? LabelFilterChip( + deviceBlockSize: _deviceBlockSize, + id: label.filters.id, + cycleNumber: + label.filters.cycleNumber, + sterilizerId: '', + hospital: label.filters.hospital, + label: 'Sterilizer ID', + ) + : Container(), + label.filters.hospital != '' + ? LabelFilterChip( + deviceBlockSize: _deviceBlockSize, + id: label.filters.id, + cycleNumber: + label.filters.cycleNumber, + sterilizerId: + label.filters.sterilizerId, + hospital: '', + label: 'Hospital', + ) + : Container(), + ], + ), + ); }, ), - ), - ], - ), - ) - : ConnectionErrorBox(); - }, + LabelSearchBox( + searchCTRL: searchCTRL, + deviceBlockSize: _deviceBlockSize), + SizedBox( + height: 20, + ), + Expanded( + child: Consumer( + builder: (context, labelResults, _) { + return labelResults.isloading + ? Center( + child: CircularProgressIndicator(), + ) + : ListView.builder( + controller: sc, + itemBuilder: (context, index) => + LabelItemBox( + deviceBlockSize: _deviceBlockSize, + item: labelResults.items[index], + ), + itemCount: labelResults.items.length, + shrinkWrap: true, + ); + }, + ), + ), + ], + ), + ) + : ConnectionErrorBox(); + }, + ), ), ); } diff --git a/lib/pages/label_scan_screen.dart b/lib/pages/label_scan_screen.dart index 81c98be..9a82d71 100644 --- a/lib/pages/label_scan_screen.dart +++ b/lib/pages/label_scan_screen.dart @@ -1,12 +1,13 @@ -import 'package:cssd/providers/connectivity.dart'; -import 'package:cssd/widgets/Global/internet_error.dart'; -import 'package:cssd/widgets/LabelScreens/Scan/input_box.dart'; -import 'package:cssd/widgets/LabelScreens/Scan/save_button.dart'; -import 'package:cssd/widgets/LabelScreens/Scan/scan_box.dart'; import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; + +import '../providers/connectivity.dart'; +import '../widgets/Global/internet_error.dart'; +import '../widgets/LabelScreens/Scan/input_box.dart'; +import '../widgets/LabelScreens/Scan/save_button.dart'; +import '../widgets/LabelScreens/Scan/scan_box.dart'; // import 'package:flutter/services.dart'; -// import 'package:barcode_scan/barcode_scan.dart'; +// import 'package:barcode_scan2/barcode_scan2.dart'; class LabelScanScreen extends StatefulWidget { // static const route = '/LabelScanScreen'; @@ -27,63 +28,65 @@ class _LabelScanScreenState extends State { // final double _pixelRatio = (_media.size.height / _media.size.width * 7 / 5); final double _devicewidth = _media.size.width; final double _deviceBlockSize = _devicewidth / 100; - return Scaffold( - appBar: AppBar( - centerTitle: true, - titleSpacing: -10, - title: Text('CSSD'), - leading: IconButton( - icon: Icon( - Icons.keyboard_arrow_left, - size: 35, + return SafeArea( + child: Scaffold( + appBar: AppBar( + centerTitle: true, + titleSpacing: -10, + title: Text('CSSD'), + leading: IconButton( + icon: Icon( + Icons.keyboard_arrow_left, + size: 35, + ), + onPressed: () => Navigator.of(context).pop(), ), - onPressed: () => Navigator.of(context).pop(), ), - ), - body: Consumer( - builder: (ct, connection, _) { - return connection.conStatus != 'offline' - ? ListView( - padding: EdgeInsets.symmetric(horizontal: 20), - children: [ - Container( - padding: EdgeInsets.only(top: 30), - child: Text( - 'LOOKING FOR A Label?', - textAlign: TextAlign.left, - style: TextStyle( - color: Colors.black, - fontSize: 5.5 * _deviceBlockSize, - fontWeight: FontWeight.w700, - letterSpacing: 3, + body: Consumer( + builder: (ct, connection, _) { + return connection.conStatus != 'offline' + ? ListView( + padding: EdgeInsets.symmetric(horizontal: 20), + children: [ + Container( + padding: EdgeInsets.only(top: 30), + child: Text( + 'LOOKING FOR A Label?', + textAlign: TextAlign.left, + style: TextStyle( + color: Colors.black, + fontSize: 5.5 * _deviceBlockSize, + fontWeight: FontWeight.w700, + letterSpacing: 3, + ), ), ), - ), - LabelScanBox(), - Form( - key: _form, - child: LabelScanInputBox( - idCTRL: idCTRL, deviceBlockSize: _deviceBlockSize), - ), - SizedBox( - height: 40, - ), - Divider( - color: Colors.black, - thickness: 3, - ), - SizedBox( - height: 30, - ), - FilterScanSaveButton( - form: _form, - idCTRL: idCTRL, - deviceBlockSize: _deviceBlockSize, - ), - ], - ) - : ConnectionErrorBox(); - }, + LabelScanBox(), + Form( + key: _form, + child: LabelScanInputBox( + idCTRL: idCTRL, deviceBlockSize: _deviceBlockSize), + ), + SizedBox( + height: 40, + ), + Divider( + color: Colors.black, + thickness: 3, + ), + SizedBox( + height: 30, + ), + FilterScanSaveButton( + form: _form, + idCTRL: idCTRL, + deviceBlockSize: _deviceBlockSize, + ), + ], + ) + : ConnectionErrorBox(); + }, + ), ), ); } diff --git a/lib/pages/label_update_screen.dart b/lib/pages/label_update_screen.dart index 42b5adf..82c5670 100644 --- a/lib/pages/label_update_screen.dart +++ b/lib/pages/label_update_screen.dart @@ -107,196 +107,198 @@ class _LabelUpdateScreenState extends State { ); return true; }, - child: Scaffold( - appBar: AppBar( - titleSpacing: -10, - title: Text('Labels'), - leading: IconButton( - icon: Icon( - Icons.keyboard_arrow_left, - size: 35, + child: SafeArea( + child: Scaffold( + appBar: AppBar( + titleSpacing: -10, + title: Text('Labels'), + leading: IconButton( + icon: Icon( + Icons.keyboard_arrow_left, + size: 35, + ), + onPressed: () => Navigator.of(context) + .pushReplacementNamed(Routes.labelResultScreen), ), - onPressed: () => Navigator.of(context) - .pushReplacementNamed(Routes.labelResultScreen), ), - ), - body: Consumer(builder: (ct, connection, _) { - return connection.conStatus != 'offline' - ? isInit - ? Center( - child: CircularProgressIndicator(), - ) - : Form( - key: _form, - child: Padding( - padding: EdgeInsets.all(20), - child: ListView( - children: [ - Text( - 'Update A LABEL', - style: TextStyle( - fontWeight: FontWeight.w700, - fontSize: 6 * _deviceBlockSize, - letterSpacing: 3, - ), - ), - SizedBox( - height: 20, - ), - TextFormField( - onChanged: (val) { - setState(() { - lotNumberCTRL.text = - val + ' - ' + cycleNumberCTRL.text; - }); - }, - validator: (val) { - if (val.isEmpty) { - return 'Strilizer ID required!'; - } - return null; - }, - controller: striizerIdCTRL, - decoration: InputDecoration( - icon: Icon(FontAwesomeIcons.sortNumericDown, - size: 7 * _deviceBlockSize), - isDense: true, - labelText: 'Strilizer ID', - contentPadding: EdgeInsets.symmetric( - vertical: 2, horizontal: 3), - labelStyle: TextStyle( - fontWeight: FontWeight.w100, - fontSize: 4 * _deviceBlockSize, + body: Consumer(builder: (ct, connection, _) { + return connection.conStatus != 'offline' + ? isInit + ? Center( + child: CircularProgressIndicator(), + ) + : Form( + key: _form, + child: Padding( + padding: EdgeInsets.all(20), + child: ListView( + children: [ + Text( + 'Update A LABEL', + style: TextStyle( + fontWeight: FontWeight.w700, + fontSize: 6 * _deviceBlockSize, + letterSpacing: 3, ), ), - style: TextStyle( - fontWeight: FontWeight.w700, - fontSize: 5 * _deviceBlockSize, + SizedBox( + height: 20, ), - keyboardType: TextInputType.visiblePassword, - textInputAction: TextInputAction.next, - onFieldSubmitted: (_) { - FocusScope.of(context) - .requestFocus(_cycleNumberFocusNode); - }, - ), - SizedBox( - height: 20, - ), - TextFormField( - onChanged: (val) { - setState( - () { + TextFormField( + onChanged: (val) { + setState(() { lotNumberCTRL.text = - striizerIdCTRL.text + ' - ' + val; - }, - ); - }, - validator: (val) { - if (val.isEmpty) { - return 'Cycle number required!'; - } - return null; - }, - controller: cycleNumberCTRL, - decoration: InputDecoration( - icon: Icon( - FontAwesomeIcons.sortNumericDown, - size: 7 * _deviceBlockSize, + val + ' - ' + cycleNumberCTRL.text; + }); + }, + validator: (val) { + if (val.isEmpty) { + return 'Strilizer ID required!'; + } + return null; + }, + controller: striizerIdCTRL, + decoration: InputDecoration( + icon: Icon(FontAwesomeIcons.sortNumericDown, + size: 7 * _deviceBlockSize), + isDense: true, + labelText: 'Strilizer ID', + contentPadding: EdgeInsets.symmetric( + vertical: 2, horizontal: 3), + labelStyle: TextStyle( + fontWeight: FontWeight.w100, + fontSize: 4 * _deviceBlockSize, + ), ), - labelStyle: TextStyle( - fontWeight: FontWeight.w100, - fontSize: 4 * _deviceBlockSize, + style: TextStyle( + fontWeight: FontWeight.w700, + fontSize: 5 * _deviceBlockSize, ), - isDense: true, - labelText: 'Cycle Number', - contentPadding: EdgeInsets.symmetric( - vertical: 2, horizontal: 3), + keyboardType: TextInputType.visiblePassword, + textInputAction: TextInputAction.next, + onFieldSubmitted: (_) { + FocusScope.of(context) + .requestFocus(_cycleNumberFocusNode); + }, ), - style: TextStyle( - fontWeight: FontWeight.w700, - fontSize: 5 * _deviceBlockSize, + SizedBox( + height: 20, ), - focusNode: _cycleNumberFocusNode, - keyboardType: TextInputType.number, - textInputAction: TextInputAction.done, - ), - SizedBox( - height: 20, - ), - TextFormField( - readOnly: true, - controller: lotNumberCTRL, - decoration: InputDecoration( - icon: Icon( - FontAwesomeIcons.sortNumericDown, - size: 7 * _deviceBlockSize, + TextFormField( + onChanged: (val) { + setState( + () { + lotNumberCTRL.text = + striizerIdCTRL.text + ' - ' + val; + }, + ); + }, + validator: (val) { + if (val.isEmpty) { + return 'Cycle number required!'; + } + return null; + }, + controller: cycleNumberCTRL, + decoration: InputDecoration( + icon: Icon( + FontAwesomeIcons.sortNumericDown, + size: 7 * _deviceBlockSize, + ), + labelStyle: TextStyle( + fontWeight: FontWeight.w100, + fontSize: 4 * _deviceBlockSize, + ), + isDense: true, + labelText: 'Cycle Number', + contentPadding: EdgeInsets.symmetric( + vertical: 2, horizontal: 3), ), - labelStyle: TextStyle( - fontWeight: FontWeight.w100, - fontSize: 4 * _deviceBlockSize, - ), - isDense: true, - labelText: 'Lot Number', - contentPadding: EdgeInsets.symmetric( - vertical: 2, - horizontal: 3, + style: TextStyle( + fontWeight: FontWeight.w700, + fontSize: 5 * _deviceBlockSize, ), + focusNode: _cycleNumberFocusNode, + keyboardType: TextInputType.number, + textInputAction: TextInputAction.done, ), - style: TextStyle( - fontWeight: FontWeight.w700, - fontSize: 5 * _deviceBlockSize, + SizedBox( + height: 20, ), - keyboardType: TextInputType.visiblePassword, - ), - SizedBox( - height: 20, - ), - LabelAddSelectorBox( - deviceBlockSize: _deviceBlockSize, - packageCTRL: packageCTRL, - packageVals: packageVals, - packageValue: packageValue, - ), - SizedBox( - height: 10, - ), - LabelAddDatePicker( - dateCTRL: sDateCTRL, - deviceBlockSize: _deviceBlockSize, - label: 'Sterile Date', - ), - SizedBox( - height: 20, - ), - LabelAddDatePicker( - dateCTRL: eDateCTRL, - deviceBlockSize: _deviceBlockSize, - label: 'Expire Date', - ), - SizedBox( - height: 70, - ), - LabelUpdateButton( - form: _form, - id: datas.id, - lotNumberCTRL: lotNumberCTRL, - cycleNumberCTRL: cycleNumberCTRL, - sDateCTRL: sDateCTRL, - packageValue: packageValue, - eDateCTRL: eDateCTRL, - striizerIdCTRL: striizerIdCTRL, - deviceBlockSize: _deviceBlockSize, - ), - SizedBox( - height: 100, - ), - ], + TextFormField( + readOnly: true, + controller: lotNumberCTRL, + decoration: InputDecoration( + icon: Icon( + FontAwesomeIcons.sortNumericDown, + size: 7 * _deviceBlockSize, + ), + labelStyle: TextStyle( + fontWeight: FontWeight.w100, + fontSize: 4 * _deviceBlockSize, + ), + isDense: true, + labelText: 'Lot Number', + contentPadding: EdgeInsets.symmetric( + vertical: 2, + horizontal: 3, + ), + ), + style: TextStyle( + fontWeight: FontWeight.w700, + fontSize: 5 * _deviceBlockSize, + ), + keyboardType: TextInputType.visiblePassword, + ), + SizedBox( + height: 20, + ), + LabelAddSelectorBox( + deviceBlockSize: _deviceBlockSize, + packageCTRL: packageCTRL, + packageVals: packageVals, + packageValue: packageValue, + ), + SizedBox( + height: 10, + ), + LabelAddDatePicker( + dateCTRL: sDateCTRL, + deviceBlockSize: _deviceBlockSize, + label: 'Sterile Date', + ), + SizedBox( + height: 20, + ), + LabelAddDatePicker( + dateCTRL: eDateCTRL, + deviceBlockSize: _deviceBlockSize, + label: 'Expire Date', + ), + SizedBox( + height: 70, + ), + LabelUpdateButton( + form: _form, + id: datas.id, + lotNumberCTRL: lotNumberCTRL, + cycleNumberCTRL: cycleNumberCTRL, + sDateCTRL: sDateCTRL, + packageValue: packageValue, + eDateCTRL: eDateCTRL, + striizerIdCTRL: striizerIdCTRL, + deviceBlockSize: _deviceBlockSize, + ), + SizedBox( + height: 100, + ), + ], + ), ), - ), - ) - : ConnectionErrorBox(); - }), + ) + : ConnectionErrorBox(); + }), + ), ), ); } diff --git a/lib/pages/login_screen.dart b/lib/pages/login_screen.dart index 14a5693..5663167 100644 --- a/lib/pages/login_screen.dart +++ b/lib/pages/login_screen.dart @@ -1,11 +1,12 @@ -import 'package:cssd/config/routes.dart'; -import 'package:cssd/providers/auth.dart'; -import 'package:cssd/providers/connectivity.dart'; -import 'package:cssd/widgets/Global/internet_error.dart'; import 'package:flutter/material.dart'; import 'package:font_awesome_flutter/font_awesome_flutter.dart'; import 'package:provider/provider.dart'; +import '../config/routes.dart'; +import '../providers/auth.dart'; +import '../providers/connectivity.dart'; +import '../widgets/Global/internet_error.dart'; + class LoginScreen extends StatefulWidget { // static const route = '/HomeScreen'; @@ -44,7 +45,7 @@ class _LoginScreenState extends State { title: Text('Error'), content: Text(message), actions: [ - FlatButton( + TextButton( child: Text('Ok'), onPressed: () { Navigator.of(ctx).pop(); @@ -110,186 +111,187 @@ class _LoginScreenState extends State { // final double _pixelRatio = (_media.size.height / _media.size.width * 7 / 5); final double _devicewidth = _media.size.width; final double _deviceBlockSize = _devicewidth / 100; - return Scaffold( - appBar: AppBar( - centerTitle: true, - title: Text('CSSD'), - ), - body: Selector( - builder: (ctx, value, _) => value != 'offline' - ? _isLoading - ? Center( - child: CircularProgressIndicator(), - ) - : Form( - key: _form, - child: ListView( - padding: EdgeInsets.symmetric(horizontal: 20), - children: [ - Container( - padding: EdgeInsets.symmetric(vertical: 20), - child: Text( - 'LOGIN', - textAlign: TextAlign.left, - style: TextStyle( - color: Colors.black, - fontSize: 6 * _deviceBlockSize, - letterSpacing: 3, - fontWeight: FontWeight.w700, - ), - ), - ), - TextFormField( - validator: (value) { - if (value.isEmpty) { - return 'Cell number is required.'; - } - RegExp regExp = - RegExp(r'^09[0,1,2,3,9]{1}[0-9]{8}$'); - if (!regExp.hasMatch(value)) { - return 'Enter a valid cell number'; - } - return null; - }, - controller: cellNumberController, - decoration: InputDecoration( - icon: Icon( - Icons.call, - size: 6 * _deviceBlockSize, - ), - labelStyle: TextStyle( - fontWeight: FontWeight.w100, - fontSize: 4 * _deviceBlockSize, - ), - labelText: 'Cell Number', - isDense: true, - contentPadding: EdgeInsets.symmetric( - vertical: 2, horizontal: 3), - ), + return SafeArea( + child: Scaffold( + appBar: AppBar( + centerTitle: true, + title: Text('CSSD'), + ), + body: Selector( + builder: (ctx, value, _) => value != 'offline' + ? _isLoading + ? Center( + child: CircularProgressIndicator(), + ) + : Form( + key: _form, + child: ListView( + padding: EdgeInsets.symmetric(horizontal: 20), + children: [ + Container( + padding: EdgeInsets.symmetric(vertical: 20), + child: Text( + 'LOGIN', + textAlign: TextAlign.left, style: TextStyle( + color: Colors.black, + fontSize: 6 * _deviceBlockSize, + letterSpacing: 3, fontWeight: FontWeight.w700, - fontSize: 5 * _deviceBlockSize, ), - keyboardType: TextInputType.phone, - textInputAction: TextInputAction.next, - onFieldSubmitted: (_) { - FocusScope.of(context) - .requestFocus(_passwordFocusNode); - }, - onSaved: (value) { - map['cellNumber'] = value; - }, ), - SizedBox( - height: 30, - ), - TextFormField( - validator: (value) { - if (value.isEmpty) { - return 'Password is required.'; - } - if (value.length < 8) { - return 'Password at least is 8 characters.'; - } - return null; - }, - obscureText: _hidePass, - controller: passwordController, - decoration: InputDecoration( - icon: Icon( - FontAwesomeIcons.starOfLife, - size: 6 * _deviceBlockSize, - ), - labelStyle: TextStyle( - fontWeight: FontWeight.w100, - fontSize: 4 * _deviceBlockSize, - ), - labelText: 'Password', - isDense: true, - contentPadding: EdgeInsets.symmetric( - vertical: 2, horizontal: 3), - suffixIcon: InkWell( - child: Icon(FontAwesomeIcons.eye), - onTap: () { - setState(() { - _hidePass = !_hidePass; - }); - }, - ), + ), + TextFormField( + validator: (value) { + if (value.isEmpty) { + return 'Cell number is required.'; + } + RegExp regExp = + RegExp(r'^09[0,1,2,3,9]{1}[0-9]{8}$'); + if (!regExp.hasMatch(value)) { + return 'Enter a valid cell number'; + } + return null; + }, + controller: cellNumberController, + decoration: InputDecoration( + icon: Icon( + Icons.call, + size: 6 * _deviceBlockSize, ), - style: TextStyle( - fontWeight: FontWeight.w700, - fontSize: 5 * _deviceBlockSize, + labelStyle: TextStyle( + fontWeight: FontWeight.w100, + fontSize: 4 * _deviceBlockSize, ), - textInputAction: TextInputAction.done, - onFieldSubmitted: (_) { - _login(); - }, - keyboardType: TextInputType.visiblePassword, - focusNode: _passwordFocusNode, - onSaved: (value) { - map['password'] = value; - }, + labelText: 'Cell Number', + isDense: true, + contentPadding: EdgeInsets.symmetric( + vertical: 2, horizontal: 3), ), - SizedBox(height: 40), - Row( - children: [ - InkWell( - onTap: () => _login(), - child: Container( - width: 40 * _deviceBlockSize, - padding: EdgeInsets.symmetric( - horizontal: 5 * _deviceBlockSize, - vertical: 10, + style: TextStyle( + fontWeight: FontWeight.w700, + fontSize: 5 * _deviceBlockSize, + ), + keyboardType: TextInputType.phone, + textInputAction: TextInputAction.next, + onFieldSubmitted: (_) { + FocusScope.of(context) + .requestFocus(_passwordFocusNode); + }, + onSaved: (value) { + map['cellNumber'] = value; + }, + ), + SizedBox( + height: 30, + ), + TextFormField( + validator: (value) { + if (value.isEmpty) { + return 'Password is required.'; + } + if (value.length < 8) { + return 'Password at least is 8 characters.'; + } + return null; + }, + obscureText: _hidePass, + controller: passwordController, + decoration: InputDecoration( + icon: Icon( + FontAwesomeIcons.starOfLife, + size: 6 * _deviceBlockSize, + ), + labelStyle: TextStyle( + fontWeight: FontWeight.w100, + fontSize: 4 * _deviceBlockSize, + ), + labelText: 'Password', + isDense: true, + contentPadding: EdgeInsets.symmetric( + vertical: 2, horizontal: 3), + suffixIcon: InkWell( + child: Icon(FontAwesomeIcons.eye), + onTap: () { + setState(() { + _hidePass = !_hidePass; + }); + }, + ), + ), + style: TextStyle( + fontWeight: FontWeight.w700, + fontSize: 5 * _deviceBlockSize, + ), + textInputAction: TextInputAction.done, + onFieldSubmitted: (_) { + _login(); + }, + keyboardType: TextInputType.visiblePassword, + focusNode: _passwordFocusNode, + onSaved: (value) { + map['password'] = value; + }, + ), + SizedBox(height: 40), + Row( + children: [ + InkWell( + onTap: () => _login(), + child: Container( + width: 40 * _deviceBlockSize, + padding: EdgeInsets.symmetric( + horizontal: 5 * _deviceBlockSize, + vertical: 10, + ), + // margin: + // EdgeInsets.symmetric(horizontal: 35, vertical: 15), + decoration: BoxDecoration( + gradient: LinearGradient( + colors: [Colors.blue, Colors.green], ), - // margin: - // EdgeInsets.symmetric(horizontal: 35, vertical: 15), - decoration: BoxDecoration( - gradient: LinearGradient( - colors: [Colors.blue, Colors.green], + borderRadius: BorderRadius.circular(7), + ), + child: Row( + mainAxisSize: MainAxisSize.min, + children: [ + Spacer(), + Icon( + Icons.exit_to_app, + color: Colors.white, ), - borderRadius: BorderRadius.circular(7), - ), - child: Row( - mainAxisSize: MainAxisSize.min, - children: [ - Spacer(), - Icon( - Icons.exit_to_app, - color: Colors.white, - ), - Text( - 'Login', - style: TextStyle(color: Colors.white), - ), - Spacer() - ], - )), - ), - Spacer(), - ], - ), - SizedBox(height: 10), - FlatButton( - padding: EdgeInsets.all(0), - child: Align( - alignment: Alignment.centerLeft, - child: Text( - 'Forgot Password ?', - style: TextStyle( - color: Colors.black54, - decoration: TextDecoration.underline, - ), + Text( + 'Login', + style: TextStyle(color: Colors.white), + ), + Spacer() + ], + )), + ), + Spacer(), + ], + ), + SizedBox(height: 10), + TextButton( + child: Align( + alignment: Alignment.centerLeft, + child: Text( + 'Forgot Password ?', + style: TextStyle( + color: Colors.black54, + decoration: TextDecoration.underline, ), ), - onPressed: () => Navigator.of(context) - .pushNamed(Routes.forgetPassScreen), ), - ], - ), - ) - : ConnectionErrorBox(), - selector: (_, connectivity) => connectivity.conStatus, - )); + onPressed: () => Navigator.of(context) + .pushNamed(Routes.forgetPassScreen), + ), + ], + ), + ) + : ConnectionErrorBox(), + selector: (_, connectivity) => connectivity.conStatus, + )), + ); } } diff --git a/lib/pages/my_info_screen.dart b/lib/pages/my_info_screen.dart index f18ebd6..4d6d2b7 100644 --- a/lib/pages/my_info_screen.dart +++ b/lib/pages/my_info_screen.dart @@ -40,138 +40,141 @@ class _MyInfoScreenState extends State { final _media = MediaQuery.of(context); final double _devicewidth = _media.size.width; final double _deviceBlockSize = _devicewidth / 100; - return Scaffold( - appBar: AppBar( - titleSpacing: -10, - title: Text('Dashboard'), - leading: IconButton( - icon: Icon( - Icons.keyboard_arrow_left, - size: 35, + return SafeArea( + child: Scaffold( + appBar: AppBar( + titleSpacing: -10, + title: Text('Dashboard'), + leading: IconButton( + icon: Icon( + Icons.keyboard_arrow_left, + size: 35, + ), + onPressed: () => Navigator.of(context).pop(), ), - onPressed: () => Navigator.of(context).pop(), ), - ), - body: Consumer(builder: (ct, connection, _) { - return connection.conStatus != 'offline' - ? isInit - ? Center( - child: CircularProgressIndicator(), - ) - : ListView( - children: [ - InfoHeader( - deviceBlockSize: _deviceBlockSize, - label: 'MY INFO', - ), - Container( - padding: EdgeInsets.symmetric(horizontal: 20), - child: Column( - children: [ - InfoInputBox( - controller: usernameCTRL, - deviceBlockSize: _deviceBlockSize, - label: 'Full Name', - icon: FontAwesomeIcons.sortNumericDown, - inputType: TextInputType.text, - ), - SizedBox( - height: 20, - ), - TextFormField( - readOnly: true, - initialValue: user['cell_number'], - decoration: InputDecoration( - icon: Icon( - Icons.call, - size: 6 * _deviceBlockSize, - ), - labelStyle: TextStyle( - fontWeight: FontWeight.w100, - fontSize: 4 * _deviceBlockSize, - ), - labelText: 'Cell Number', - isDense: true, - contentPadding: EdgeInsets.symmetric( - vertical: 2, horizontal: 3), - ), - style: TextStyle( - fontWeight: FontWeight.w700, - color: Colors.grey, - fontSize: 5 * _deviceBlockSize, - ), - keyboardType: TextInputType.number, - textInputAction: TextInputAction.next, - ), - SizedBox( - height: 20, - ), - InfoInputBox( - controller: emailCTRL, - deviceBlockSize: _deviceBlockSize, - label: 'Email Address', - icon: FontAwesomeIcons.envelope, - inputType: TextInputType.emailAddress, - ), - SizedBox( - height: 40, - ), - InkWell( - child: Container( - padding: EdgeInsets.symmetric( - horizontal: 60, vertical: 10), - margin: EdgeInsets.only(top: 50, bottom: 20), - width: double.infinity, - decoration: BoxDecoration( - gradient: LinearGradient( - colors: [Colors.blue, Colors.green], - ), - borderRadius: BorderRadius.circular(5), - ), - child: Text( - 'Save', - style: TextStyle( - color: Colors.white, - fontSize: 5 * _deviceBlockSize, - ), - textAlign: TextAlign.center, - ), - ), - onTap: () async { - await Provider.of(context, listen: false) - .setUserData( - user['id'], - usernameCTRL.text, - emailCTRL.text, - ) - .then( - (value) async => await showDialog( - context: context, - builder: (ctx) => AlertDialog( - content: Text( - 'Info changed successfully.', - ), - actions: [ - FlatButton( - child: Text('Ok'), - onPressed: () { - Navigator.of(ctx).pop(); - }, - ), - ], - ), - ), - ); - Navigator.of(context).pop(); - }, - ), - ], + body: Consumer(builder: (ct, connection, _) { + return connection.conStatus != 'offline' + ? isInit + ? Center( + child: CircularProgressIndicator(), + ) + : ListView( + children: [ + InfoHeader( + deviceBlockSize: _deviceBlockSize, + label: 'MY INFO', ), - ), - ], - ) - : ConnectionErrorBox(); - }), + Container( + padding: EdgeInsets.symmetric(horizontal: 20), + child: Column( + children: [ + InfoInputBox( + controller: usernameCTRL, + deviceBlockSize: _deviceBlockSize, + label: 'Full Name', + icon: FontAwesomeIcons.sortNumericDown, + inputType: TextInputType.text, + ), + SizedBox( + height: 20, + ), + TextFormField( + readOnly: true, + initialValue: user['cell_number'], + decoration: InputDecoration( + icon: Icon( + Icons.call, + size: 6 * _deviceBlockSize, + ), + labelStyle: TextStyle( + fontWeight: FontWeight.w100, + fontSize: 4 * _deviceBlockSize, + ), + labelText: 'Cell Number', + isDense: true, + contentPadding: EdgeInsets.symmetric( + vertical: 2, horizontal: 3), + ), + style: TextStyle( + fontWeight: FontWeight.w700, + color: Colors.grey, + fontSize: 5 * _deviceBlockSize, + ), + keyboardType: TextInputType.number, + textInputAction: TextInputAction.next, + ), + SizedBox( + height: 20, + ), + InfoInputBox( + controller: emailCTRL, + deviceBlockSize: _deviceBlockSize, + label: 'Email Address', + icon: FontAwesomeIcons.envelope, + inputType: TextInputType.emailAddress, + ), + SizedBox( + height: 40, + ), + InkWell( + child: Container( + padding: EdgeInsets.symmetric( + horizontal: 60, vertical: 10), + margin: EdgeInsets.only(top: 50, bottom: 20), + width: double.infinity, + decoration: BoxDecoration( + gradient: LinearGradient( + colors: [Colors.blue, Colors.green], + ), + borderRadius: BorderRadius.circular(5), + ), + child: Text( + 'Save', + style: TextStyle( + color: Colors.white, + fontSize: 5 * _deviceBlockSize, + ), + textAlign: TextAlign.center, + ), + ), + onTap: () async { + await Provider.of(context, + listen: false) + .setUserData( + user['id'], + usernameCTRL.text, + emailCTRL.text, + ) + .then( + (value) async => await showDialog( + context: context, + builder: (ctx) => AlertDialog( + content: Text( + 'Info changed successfully.', + ), + actions: [ + TextButton( + child: Text('Ok'), + onPressed: () { + Navigator.of(ctx).pop(); + }, + ), + ], + ), + ), + ); + Navigator.of(context).pop(); + }, + ), + ], + ), + ), + ], + ) + : ConnectionErrorBox(); + }), + ), ); } } diff --git a/lib/pages/rePass_screen.dart b/lib/pages/rePass_screen.dart index 6d299a8..f4f1c8d 100644 --- a/lib/pages/rePass_screen.dart +++ b/lib/pages/rePass_screen.dart @@ -43,7 +43,7 @@ class _RePassScreenState extends State { builder: (ctx) => AlertDialog( content: Text(message), actions: [ - FlatButton( + TextButton( child: Text('Ok'), onPressed: () { Navigator.of(ctx).pop(); @@ -79,163 +79,165 @@ class _RePassScreenState extends State { // final double _pixelRatio = (_media.size.height / _media.size.width * 7 / 5); final double _devicewidth = _media.size.width; final double _deviceBlockSize = _devicewidth / 100; - return Scaffold( - appBar: AppBar( - centerTitle: true, - title: Text('CSSD'), - ), - body: Selector( - builder: (ctx, value, _) => value != 'offline' - ? _isLoading - ? Center( - child: CircularProgressIndicator(), - ) - : Form( - key: _form, - child: ListView( - padding: EdgeInsets.symmetric(horizontal: 20), - children: [ - Container( - padding: EdgeInsets.symmetric(vertical: 20), - child: Text( - 'CHANGE PASSWORD', - textAlign: TextAlign.left, - style: TextStyle( - color: Colors.black, - fontSize: 6 * _deviceBlockSize, - letterSpacing: 3, - fontWeight: FontWeight.w700, - ), - ), - ), - TextFormField( - validator: (value) { - if (value.isEmpty) { - return 'Password is required.'; - } - if (value.length < 8) { - return 'Password at least is 8 characters.'; - } - return null; - }, - obscureText: _hidePass, - controller: passwordController, - decoration: InputDecoration( - icon: Icon( - FontAwesomeIcons.starOfLife, - size: 6 * _deviceBlockSize, - ), - labelStyle: TextStyle( - fontWeight: FontWeight.w100, - fontSize: 4 * _deviceBlockSize, - ), - labelText: 'Password', - isDense: true, - contentPadding: EdgeInsets.symmetric( - vertical: 2, horizontal: 3), - suffixIcon: InkWell( - child: Icon(FontAwesomeIcons.eye), - onTap: () { - setState(() { - _hidePass = !_hidePass; - }); - }, - ), - ), - style: TextStyle( - fontWeight: FontWeight.w700, - fontSize: 5 * _deviceBlockSize, - ), - textInputAction: TextInputAction.done, - onFieldSubmitted: (_) { - _sendRePass(); - }, - keyboardType: TextInputType.visiblePassword, - ), - SizedBox( - height: 30, - ), - TextFormField( - validator: (value) { - if (value.length < 8) { - return 'Password at least is 8 characters.'; - } - if (value != passwordController.text) { - return 'Password doesnt match!'; - } - return null; - }, - obscureText: _hideRePass, - controller: rePasswordController, - decoration: InputDecoration( - icon: Icon( - FontAwesomeIcons.starOfLife, - size: 6 * _deviceBlockSize, - ), - labelStyle: TextStyle( - fontWeight: FontWeight.w100, - fontSize: 4 * _deviceBlockSize, - ), - labelText: 'Confirm Password', - isDense: true, - contentPadding: EdgeInsets.symmetric( - vertical: 2, horizontal: 3), - suffixIcon: InkWell( - child: Icon(FontAwesomeIcons.eye), - onTap: () { - setState(() { - _hideRePass = !_hideRePass; - }); - }, - ), - ), - style: TextStyle( - fontWeight: FontWeight.w700, - fontSize: 5 * _deviceBlockSize, - ), - textInputAction: TextInputAction.done, - onFieldSubmitted: (_) { - _sendRePass(); - }, - keyboardType: TextInputType.visiblePassword, - ), - SizedBox(height: 40), - Row( - children: [ - InkWell( - onTap: () => _sendRePass(), - child: Container( - width: 40 * _deviceBlockSize, - padding: EdgeInsets.symmetric( - horizontal: 5 * _deviceBlockSize, - vertical: 10, - ), - // margin: - // EdgeInsets.symmetric(horizontal: 35, vertical: 15), - decoration: BoxDecoration( - gradient: LinearGradient( - colors: [Colors.blue, Colors.green], - ), - borderRadius: BorderRadius.circular(7), - ), - child: Text( - 'Change', - style: TextStyle( - color: Colors.white, - ), - textAlign: TextAlign.center, - ), + return SafeArea( + child: Scaffold( + appBar: AppBar( + centerTitle: true, + title: Text('CSSD'), + ), + body: Selector( + builder: (ctx, value, _) => value != 'offline' + ? _isLoading + ? Center( + child: CircularProgressIndicator(), + ) + : Form( + key: _form, + child: ListView( + padding: EdgeInsets.symmetric(horizontal: 20), + children: [ + Container( + padding: EdgeInsets.symmetric(vertical: 20), + child: Text( + 'CHANGE PASSWORD', + textAlign: TextAlign.left, + style: TextStyle( + color: Colors.black, + fontSize: 6 * _deviceBlockSize, + letterSpacing: 3, + fontWeight: FontWeight.w700, ), ), - Spacer(), - ], - ), - SizedBox(height: 10), - ], - ), - ) - : ConnectionErrorBox(), - selector: (_, connectivity) => connectivity.conStatus, - )); + ), + TextFormField( + validator: (value) { + if (value.isEmpty) { + return 'Password is required.'; + } + if (value.length < 8) { + return 'Password at least is 8 characters.'; + } + return null; + }, + obscureText: _hidePass, + controller: passwordController, + decoration: InputDecoration( + icon: Icon( + FontAwesomeIcons.starOfLife, + size: 6 * _deviceBlockSize, + ), + labelStyle: TextStyle( + fontWeight: FontWeight.w100, + fontSize: 4 * _deviceBlockSize, + ), + labelText: 'Password', + isDense: true, + contentPadding: EdgeInsets.symmetric( + vertical: 2, horizontal: 3), + suffixIcon: InkWell( + child: Icon(FontAwesomeIcons.eye), + onTap: () { + setState(() { + _hidePass = !_hidePass; + }); + }, + ), + ), + style: TextStyle( + fontWeight: FontWeight.w700, + fontSize: 5 * _deviceBlockSize, + ), + textInputAction: TextInputAction.done, + onFieldSubmitted: (_) { + _sendRePass(); + }, + keyboardType: TextInputType.visiblePassword, + ), + SizedBox( + height: 30, + ), + TextFormField( + validator: (value) { + if (value.length < 8) { + return 'Password at least is 8 characters.'; + } + if (value != passwordController.text) { + return 'Password doesnt match!'; + } + return null; + }, + obscureText: _hideRePass, + controller: rePasswordController, + decoration: InputDecoration( + icon: Icon( + FontAwesomeIcons.starOfLife, + size: 6 * _deviceBlockSize, + ), + labelStyle: TextStyle( + fontWeight: FontWeight.w100, + fontSize: 4 * _deviceBlockSize, + ), + labelText: 'Confirm Password', + isDense: true, + contentPadding: EdgeInsets.symmetric( + vertical: 2, horizontal: 3), + suffixIcon: InkWell( + child: Icon(FontAwesomeIcons.eye), + onTap: () { + setState(() { + _hideRePass = !_hideRePass; + }); + }, + ), + ), + style: TextStyle( + fontWeight: FontWeight.w700, + fontSize: 5 * _deviceBlockSize, + ), + textInputAction: TextInputAction.done, + onFieldSubmitted: (_) { + _sendRePass(); + }, + keyboardType: TextInputType.visiblePassword, + ), + SizedBox(height: 40), + Row( + children: [ + InkWell( + onTap: () => _sendRePass(), + child: Container( + width: 40 * _deviceBlockSize, + padding: EdgeInsets.symmetric( + horizontal: 5 * _deviceBlockSize, + vertical: 10, + ), + // margin: + // EdgeInsets.symmetric(horizontal: 35, vertical: 15), + decoration: BoxDecoration( + gradient: LinearGradient( + colors: [Colors.blue, Colors.green], + ), + borderRadius: BorderRadius.circular(7), + ), + child: Text( + 'Change', + style: TextStyle( + color: Colors.white, + ), + textAlign: TextAlign.center, + ), + ), + ), + Spacer(), + ], + ), + SizedBox(height: 10), + ], + ), + ) + : ConnectionErrorBox(), + selector: (_, connectivity) => connectivity.conStatus, + )), + ); } } diff --git a/lib/pages/register.dart b/lib/pages/register.dart index 71b082c..1490ac9 100644 --- a/lib/pages/register.dart +++ b/lib/pages/register.dart @@ -39,7 +39,7 @@ class _RegisterState extends State { // title: Text('error occured'), // content: Text(message), // actions: [ - // FlatButton( + // TextButton( // child: Text('Ok'), // onPressed: () { // Navigator.of(ctx).pop(); @@ -84,294 +84,296 @@ class _RegisterState extends State { // final double _pixelRatio = (_media.size.height / _media.size.width * 7 / 5); final double _devicewidth = _media.size.width; final double _deviceBlockSize = _devicewidth / 100; - return Scaffold( - appBar:AppBar( - titleSpacing: -10, - title: Text('Login'), - leading: IconButton( - icon: Icon( - Icons.keyboard_arrow_left, - size: 35, + return SafeArea( + child: Scaffold( + appBar: AppBar( + titleSpacing: -10, + title: Text('Login'), + leading: IconButton( + icon: Icon( + Icons.keyboard_arrow_left, + size: 35, + ), + onPressed: () => Navigator.of(context).pop(), ), - onPressed: () => Navigator.of(context).pop(), ), - ), - body: _isLoading - ? Center( - child: CircularProgressIndicator(), - ) - : Form( - key: _form, - child: ListView( - padding: EdgeInsets.symmetric(horizontal: 20), - children: [ - Container( - padding: EdgeInsets.symmetric(vertical: 20), - child: Text( - 'register', - textAlign: TextAlign.left, - style: TextStyle( - color: Colors.black, - fontSize: 7 * _deviceBlockSize, - letterSpacing: 3, + body: _isLoading + ? Center( + child: CircularProgressIndicator(), + ) + : Form( + key: _form, + child: ListView( + padding: EdgeInsets.symmetric(horizontal: 20), + children: [ + Container( + padding: EdgeInsets.symmetric(vertical: 20), + child: Text( + 'register', + textAlign: TextAlign.left, + style: TextStyle( + color: Colors.black, + fontSize: 7 * _deviceBlockSize, + letterSpacing: 3, + ), ), ), - ), - TextFormField( - validator: (value) { - if (value.isEmpty) { - return 'Cell number is required.'; - } - RegExp regExp = RegExp(r'^09[0,1,2,3,9]{1}[0-9]{8}$'); - if (!regExp.hasMatch(value)) { - return 'Enter a valid cell number'; - } - return null; - }, - style: TextStyle(fontWeight: FontWeight.w700), - keyboardType: TextInputType.phone, - textInputAction: TextInputAction.next, - onFieldSubmitted: (_) { - FocusScope.of(context).requestFocus(_passwordFocusNode); - }, - controller: cellNumberController, - decoration: InputDecoration( - isDense: true, - icon: Icon( - Icons.call, - color: Colors.grey, + TextFormField( + validator: (value) { + if (value.isEmpty) { + return 'Cell number is required.'; + } + RegExp regExp = RegExp(r'^09[0,1,2,3,9]{1}[0-9]{8}$'); + if (!regExp.hasMatch(value)) { + return 'Enter a valid cell number'; + } + return null; + }, + style: TextStyle(fontWeight: FontWeight.w700), + keyboardType: TextInputType.phone, + textInputAction: TextInputAction.next, + onFieldSubmitted: (_) { + FocusScope.of(context).requestFocus(_passwordFocusNode); + }, + controller: cellNumberController, + decoration: InputDecoration( + isDense: true, + icon: Icon( + Icons.call, + color: Colors.grey, + ), + border: UnderlineInputBorder(), + fillColor: Colors.red, + labelText: 'Cell Number', + contentPadding: EdgeInsets.symmetric(vertical: 5), ), - border: UnderlineInputBorder(), - fillColor: Colors.red, - labelText: 'Cell Number', - contentPadding: EdgeInsets.symmetric(vertical: 5), + onSaved: (value) { + map['cellNumber'] = value; + }, ), - onSaved: (value) { - map['cellNumber'] = value; - }, - ), - SizedBox( - height: 10, - ), - TextFormField( - validator: (value) { - if (value.isEmpty) { - return 'Password is required.'; - } - if (value.length < 8) { - return 'Password at least is 8 characters.'; - } - return null; - }, - obscureText: _hidePass, - textInputAction: TextInputAction.done, - onFieldSubmitted: (_) { - _register(); - }, - style: TextStyle(fontWeight: FontWeight.w700), - decoration: InputDecoration( - isDense: true, - icon: Icon( - FontAwesomeIcons.starOfLife, - color: Colors.grey, - ), - border: UnderlineInputBorder(), - fillColor: Colors.red, - labelText: 'Password', - contentPadding: EdgeInsets.symmetric(vertical: 5), - suffixIcon: InkWell( - child: Icon(FontAwesomeIcons.eye), - onTap: () { - setState(() { - _hidePass = !_hidePass; - }); - }, - ), + SizedBox( + height: 10, ), - focusNode: _passwordFocusNode, - onSaved: (value) { - map['password'] = value; - }, - ), - SizedBox( - height: 10, - ), - TextFormField( - validator: (value) { - if (value.isEmpty) { - return 'Full Name is required.'; - } - // RegExp regExp = RegExp(r'^09[0,1,2,3,9]{1}[0-9]{8}$'); - // if (!regExp.hasMatch(value)) { - // return 'Enter a valid cell number'; - // } - return null; - }, - // keyboardType: TextInputType.phone, - // textInputAction: TextInputAction.next, - // onFieldSubmitted: (_) { - // FocusScope.of(context).requestFocus(_passwordFocusNode); - // }, - // controller: cellNumberController, - decoration: InputDecoration( - isDense: true, - icon: Icon( - FontAwesomeIcons.sortNumericDown, - color: Colors.grey, - ), - border: UnderlineInputBorder(), - fillColor: Colors.red, - labelText: 'Full Name', - contentPadding: EdgeInsets.symmetric(vertical: 5), - ), - style: TextStyle(fontWeight: FontWeight.w700), - // onSaved: (value) { - // map['cellNumber'] = value; - // }, - ), - SizedBox( - height: 20, - ), - Row( - // width: double.infinity, - children: [ - Icon( - FontAwesomeIcons.alignLeft, - color: Colors.grey, - size: 5 * _deviceBlockSize, - ), - SizedBox( - width: 3 * _deviceBlockSize, - ), - Expanded( - // width: MediaQuery.of(context).size.width - 70, - child: DropdownButton( - focusColor: Colors.red, - icon: Icon(FontAwesomeIcons.angleDown), - isExpanded: true, - hint: Padding( - padding: const EdgeInsets.symmetric(horizontal: 4), - child: Text( - curhospitalVal, - style: TextStyle( - fontWeight: FontWeight.w700, - color: Colors.black, - // color: _mainFontColor, - // fontSize: 5 * _deviceBlockSize, - ), - ), - ), - isDense: true, - items: hospitalVals.map((String value) { - return new DropdownMenuItem( - value: value, - child: Container( - child: Text( - value, - style: TextStyle( - // color: _mainFontColor, - fontSize: 4 * _deviceBlockSize, - ), - ), - ), - ); - }).toList(), - onChanged: (val) { + TextFormField( + validator: (value) { + if (value.isEmpty) { + return 'Password is required.'; + } + if (value.length < 8) { + return 'Password at least is 8 characters.'; + } + return null; + }, + obscureText: _hidePass, + textInputAction: TextInputAction.done, + onFieldSubmitted: (_) { + _register(); + }, + style: TextStyle(fontWeight: FontWeight.w700), + decoration: InputDecoration( + isDense: true, + icon: Icon( + FontAwesomeIcons.starOfLife, + color: Colors.grey, + ), + border: UnderlineInputBorder(), + fillColor: Colors.red, + labelText: 'Password', + contentPadding: EdgeInsets.symmetric(vertical: 5), + suffixIcon: InkWell( + child: Icon(FontAwesomeIcons.eye), + onTap: () { setState(() { - curhospitalVal = val; + _hidePass = !_hidePass; }); }, ), ), - ], - ), - SizedBox(height: 40), - Row( - children: [ - InkWell( - onTap: () => _register(), - child: Container( + focusNode: _passwordFocusNode, + onSaved: (value) { + map['password'] = value; + }, + ), + SizedBox( + height: 10, + ), + TextFormField( + validator: (value) { + if (value.isEmpty) { + return 'Full Name is required.'; + } + // RegExp regExp = RegExp(r'^09[0,1,2,3,9]{1}[0-9]{8}$'); + // if (!regExp.hasMatch(value)) { + // return 'Enter a valid cell number'; + // } + return null; + }, + // keyboardType: TextInputType.phone, + // textInputAction: TextInputAction.next, + // onFieldSubmitted: (_) { + // FocusScope.of(context).requestFocus(_passwordFocusNode); + // }, + // controller: cellNumberController, + decoration: InputDecoration( + isDense: true, + icon: Icon( + FontAwesomeIcons.sortNumericDown, + color: Colors.grey, + ), + border: UnderlineInputBorder(), + fillColor: Colors.red, + labelText: 'Full Name', + contentPadding: EdgeInsets.symmetric(vertical: 5), + ), + style: TextStyle(fontWeight: FontWeight.w700), + // onSaved: (value) { + // map['cellNumber'] = value; + // }, + ), + SizedBox( + height: 20, + ), + Row( + // width: double.infinity, + children: [ + Icon( + FontAwesomeIcons.alignLeft, + color: Colors.grey, + size: 5 * _deviceBlockSize, + ), + SizedBox( + width: 3 * _deviceBlockSize, + ), + Expanded( + // width: MediaQuery.of(context).size.width - 70, + child: DropdownButton( + focusColor: Colors.red, + icon: Icon(FontAwesomeIcons.angleDown), + isExpanded: true, + hint: Padding( + padding: + const EdgeInsets.symmetric(horizontal: 4), + child: Text( + curhospitalVal, + style: TextStyle( + fontWeight: FontWeight.w700, + color: Colors.black, + // color: _mainFontColor, + // fontSize: 5 * _deviceBlockSize, + ), + ), + ), + isDense: true, + items: hospitalVals.map((String value) { + return new DropdownMenuItem( + value: value, + child: Container( + child: Text( + value, + style: TextStyle( + // color: _mainFontColor, + fontSize: 4 * _deviceBlockSize, + ), + ), + ), + ); + }).toList(), + onChanged: (val) { + setState(() { + curhospitalVal = val; + }); + }, + ), + ), + ], + ), + SizedBox(height: 40), + Row( + children: [ + InkWell( + onTap: () => _register(), + child: Container( + width: 40 * _deviceBlockSize, + padding: EdgeInsets.symmetric( + horizontal: 5 * _deviceBlockSize, + vertical: 5, + ), + // margin: + // EdgeInsets.symmetric(horizontal: 35, vertical: 15), + decoration: BoxDecoration( + gradient: LinearGradient( + colors: [Colors.blue, Colors.green], + ), + borderRadius: BorderRadius.circular(7), + ), + child: Row( + mainAxisSize: MainAxisSize.min, + children: [ + Spacer(), + Icon( + Icons.add, + color: Colors.white, + ), + Text( + 'register', + style: TextStyle(color: Colors.white), + ), + Spacer() + ], + ) + // TextButton.icon( + // padding: EdgeInsets.all(0), + // onPressed: () { + // _register(); + // }, + // icon: Icon(Icons.exit_to_app, + // color: Colors.white, size: 17), + // label: Text('register', + // style: TextStyle(color: Colors.white)), + // ), + ), + ), + Spacer(), + InkWell( + onTap: () { + Navigator.of(context).pop(); + }, + child: Container( width: 40 * _deviceBlockSize, padding: EdgeInsets.symmetric( horizontal: 5 * _deviceBlockSize, vertical: 5, ), - // margin: - // EdgeInsets.symmetric(horizontal: 35, vertical: 15), decoration: BoxDecoration( - gradient: LinearGradient( - colors: [Colors.blue, Colors.green], + borderRadius: BorderRadius.circular(5), + border: Border.all( + color: Colors.black, ), - borderRadius: BorderRadius.circular(7), ), child: Row( - mainAxisSize: MainAxisSize.min, children: [ Spacer(), Icon( - Icons.add, - color: Colors.white, + Icons.exit_to_app, + // size: 6 * _pixelRatio, ), Text( - 'register', - style: TextStyle(color: Colors.white), + 'Login', + style: TextStyle( + // fontSize: 5.5, + ), ), - Spacer() + Spacer(), ], - ) - // FlatButton.icon( - // padding: EdgeInsets.all(0), - // onPressed: () { - // _register(); - // }, - // icon: Icon(Icons.exit_to_app, - // color: Colors.white, size: 17), - // label: Text('register', - // style: TextStyle(color: Colors.white)), - // ), ), - ), - Spacer(), - InkWell( - onTap: () { - Navigator.of(context).pop(); - }, - child: Container( - width: 40 * _deviceBlockSize, - padding: EdgeInsets.symmetric( - horizontal: 5 * _deviceBlockSize, - vertical: 5, - ), - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(5), - border: Border.all( - color: Colors.black, - ), - ), - child: Row( - children: [ - Spacer(), - Icon( - Icons.exit_to_app, - // size: 6 * _pixelRatio, - ), - Text( - 'Login', - style: TextStyle( - // fontSize: 5.5, - ), - ), - Spacer(), - ], ), ), - ), - ], - ), - - ], + ], + ), + ], + ), ), - ), + ), ); } } diff --git a/lib/pages/test_add_screen.dart b/lib/pages/test_add_screen.dart index 43a8f50..9db3125 100644 --- a/lib/pages/test_add_screen.dart +++ b/lib/pages/test_add_screen.dart @@ -1,17 +1,18 @@ -import 'package:cssd/config/routes.dart'; -import 'package:cssd/providers/connectivity.dart'; -import 'package:cssd/widgets/Global/internet_error.dart'; -import 'package:cssd/widgets/TestResultScreens/Add/selector_box.dart'; -import 'package:flutter/material.dart'; -import 'package:flutter/services.dart'; -import 'package:barcode_scan/barcode_scan.dart'; -import 'package:cssd/providers/test_results.dart'; +import 'package:barcode_scan2/barcode_scan2.dart'; // import 'package:flutter_barcode_scanner/flutter_barcode_scanner.dart'; import 'package:cssd/pages/test_form_page.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter/services.dart'; import 'package:font_awesome_flutter/font_awesome_flutter.dart'; import 'package:provider/provider.dart'; +import '../config/routes.dart'; +import '../providers/connectivity.dart'; +import '../providers/test_results.dart'; +import '../widgets/Global/internet_error.dart'; +import '../widgets/TestResultScreens/Add/selector_box.dart'; + class TestResultAddScreen extends StatefulWidget { // static const route = '/TestResultAddScreen'; @override @@ -59,206 +60,207 @@ class _TestResultAddScreenState extends State { ); return true; }, - child: Scaffold( - appBar: AppBar( - titleSpacing: -10, - title: Text('Test Results'), - leading: IconButton( - icon: Icon( - Icons.keyboard_arrow_left, - size: 35, + child: SafeArea( + child: Scaffold( + appBar: AppBar( + titleSpacing: -10, + title: Text('Test Results'), + leading: IconButton( + icon: Icon( + Icons.keyboard_arrow_left, + size: 35, + ), + // padding: EdgeInsets.all(0), + onPressed: () => Navigator.of(context) + .popAndPushNamed(Routes.testResultScreen), ), - // padding: EdgeInsets.all(0), - onPressed: () => - Navigator.of(context).popAndPushNamed(Routes.testResultScreen), ), - ), - body: Consumer(builder: (ct, connection, _) { - return connection.conStatus != 'offline' - ? isInit - ? Center( - child: CircularProgressIndicator(), - ) - : ListView( - padding: - EdgeInsets.symmetric(horizontal: 20, vertical: 20), - children: [ - Container( - padding: EdgeInsets.only( - top: 10, - ), - child: Text( - 'ADD A TEST RESULT', - style: TextStyle( - color: Colors.black, - fontSize: 5 * _deviceBlockSize, - letterSpacing: 3, - fontWeight: FontWeight.w700, + body: Consumer(builder: (ct, connection, _) { + return connection.conStatus != 'offline' + ? isInit + ? Center( + child: CircularProgressIndicator(), + ) + : ListView( + padding: + EdgeInsets.symmetric(horizontal: 20, vertical: 20), + children: [ + Container( + padding: EdgeInsets.only( + top: 10, ), - ), - ), - GestureDetector( - child: Container( - margin: EdgeInsets.only(top: 5, bottom: 30), - padding: EdgeInsets.all(10), - height: 200, - decoration: BoxDecoration(border: Border.all()), - child: Center( - child: Text( - 'PLEASE SCAN THE TEST BARCODE', - textAlign: TextAlign.center, - style: TextStyle( - color: Colors.grey, - fontSize: 5 * _deviceBlockSize, - fontWeight: FontWeight.w100, - letterSpacing: 3, - ), + child: Text( + 'ADD A TEST RESULT', + style: TextStyle( + color: Colors.black, + fontSize: 5 * _deviceBlockSize, + letterSpacing: 3, + fontWeight: FontWeight.w700, ), ), ), - onTap: () { - scan().then( - (String result) { - if (result == 'cancel') { - print('cancel'); - } else if (result == 'error') { - print('error'); - } else if (result == 'access') { - print('access'); - } else { - Navigator.pushReplacement( - context, - MaterialPageRoute( - builder: (context) { - return FormPage( - uniqueCode: result, - ); - }, - ), - ); - } - }, - ); - }, - ), - Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - crossAxisAlignment: CrossAxisAlignment.center, - mainAxisSize: MainAxisSize.max, - children: [ - Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Container( - width: 70 * _deviceBlockSize, - child: TestResultAddSelectorBox( - deviceBlockSize: _deviceBlockSize, - dataCTRL: testTypeCTRL, - dataVals: testTypeVals, - label: 'Choose a Test Type'), + GestureDetector( + child: Container( + margin: EdgeInsets.only(top: 5, bottom: 30), + padding: EdgeInsets.all(10), + height: 200, + decoration: BoxDecoration(border: Border.all()), + child: Center( + child: Text( + 'PLEASE SCAN THE TEST BARCODE', + textAlign: TextAlign.center, + style: TextStyle( + color: Colors.grey, + fontSize: 5 * _deviceBlockSize, + fontWeight: FontWeight.w100, + letterSpacing: 3, + ), ), - Row( - crossAxisAlignment: CrossAxisAlignment.end, - children: [ - Text( - 'OR', - style: TextStyle( - fontWeight: FontWeight.w700, - fontSize: 7 * _deviceBlockSize, - ), - ), - SizedBox( - width: 8 * _deviceBlockSize, - ), - Container( - width: 50 * _deviceBlockSize, - child: TextFormField( - onChanged: (val) { - if (val != '') { - setState(() { - testTypeCTRL.text = ''; - }); - } else { - setState(() { - testTypeCTRL.text = - testTypeVals[0]; - }); - } + ), + ), + onTap: () { + scan().then( + (String result) { + if (result == 'cancel') { + print('cancel'); + } else if (result == 'error') { + print('error'); + } else if (result == 'access') { + print('access'); + } else { + Navigator.pushReplacement( + context, + MaterialPageRoute( + builder: (context) { + return FormPage( + uniqueCode: result, + ); }, - controller: testIdCTRL, - decoration: InputDecoration( - isDense: true, - icon: Icon( - FontAwesomeIcons.sortNumericDown, - ), - labelText: 'Enter a Test Code', - labelStyle: TextStyle( - fontSize: 3 * _deviceBlockSize), - contentPadding: EdgeInsets.only( - bottom: 5, top: 5), - ), - keyboardType: TextInputType.number, ), - ), - ], - ) - ], - ), - SizedBox( - width: 5 * _deviceBlockSize, - ), - Expanded( - child: Container( - height: 100, - margin: EdgeInsets.only(bottom: 50), - child: FlatButton( - padding: EdgeInsets.all(0), - color: Color(0xFFEB4A64), - shape: RoundedRectangleBorder( + ); + } + }, + ); + }, + ), + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + crossAxisAlignment: CrossAxisAlignment.center, + mainAxisSize: MainAxisSize.max, + children: [ + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Container( + width: 70 * _deviceBlockSize, + child: TestResultAddSelectorBox( + deviceBlockSize: _deviceBlockSize, + dataCTRL: testTypeCTRL, + dataVals: testTypeVals, + label: 'Choose a Test Type'), + ), + Row( + crossAxisAlignment: CrossAxisAlignment.end, + children: [ + Text( + 'OR', + style: TextStyle( + fontWeight: FontWeight.w700, + fontSize: 7 * _deviceBlockSize, + ), + ), + SizedBox( + width: 8 * _deviceBlockSize, + ), + Container( + width: 50 * _deviceBlockSize, + child: TextFormField( + onChanged: (val) { + if (val != '') { + setState(() { + testTypeCTRL.text = ''; + }); + } else { + setState(() { + testTypeCTRL.text = + testTypeVals[0]; + }); + } + }, + controller: testIdCTRL, + decoration: InputDecoration( + isDense: true, + icon: Icon( + FontAwesomeIcons.sortNumericDown, + ), + labelText: 'Enter a Test Code', + labelStyle: TextStyle( + fontSize: 3 * _deviceBlockSize), + contentPadding: EdgeInsets.only( + bottom: 5, top: 5), + ), + keyboardType: TextInputType.number, + ), + ), + ], + ) + ], + ), + SizedBox( + width: 5 * _deviceBlockSize, + ), + Expanded( + child: Container( + height: 100, + margin: EdgeInsets.only(bottom: 50), + decoration: BoxDecoration( + color: Color(0xFFEB4A64), borderRadius: BorderRadius.circular(10), ), - child: Text( - 'GO', - textAlign: TextAlign.center, - style: TextStyle( - color: Colors.white, - fontSize: 6 * _deviceBlockSize, - fontWeight: FontWeight.w700), + child: TextButton( + child: Text( + 'GO', + textAlign: TextAlign.center, + style: TextStyle( + color: Colors.white, + fontSize: 6 * _deviceBlockSize, + fontWeight: FontWeight.w700), + ), + onPressed: () { + if (testIdCTRL.text != '') { + Navigator.push( + context, + MaterialPageRoute( + builder: (context) { + return FormPage( + uniqueCode: testIdCTRL.text); + }, + ), + ); + } else if (testTypeCTRL.text != '') { + Navigator.pushReplacement( + context, + MaterialPageRoute( + builder: (context) { + return FormPage( + name: testTypeCTRL.text, + ); + }, + ), + ); + } + // print(testCode); + }, ), - onPressed: () { - if (testIdCTRL.text != '') { - Navigator.push( - context, - MaterialPageRoute( - builder: (context) { - return FormPage( - uniqueCode: testIdCTRL.text); - }, - ), - ); - } else if (testTypeCTRL.text != '') { - Navigator.pushReplacement( - context, - MaterialPageRoute( - builder: (context) { - return FormPage( - name: testTypeCTRL.text, - ); - }, - ), - ); - } - // print(testCode); - }, ), - ), - ) - ], - ), - ], - ) - : ConnectionErrorBox(); - }), + ) + ], + ), + ], + ) + : ConnectionErrorBox(); + }), + ), ), ); } diff --git a/lib/pages/test_detail_screen.dart b/lib/pages/test_detail_screen.dart index 999f012..5870770 100644 --- a/lib/pages/test_detail_screen.dart +++ b/lib/pages/test_detail_screen.dart @@ -1,7 +1,7 @@ -import 'package:cssd/providers/connectivity.dart'; -import 'package:cssd/providers/test_results.dart'; -import 'package:cssd/widgets/Global/internet_error.dart'; -import 'package:cssd/widgets/TestResultScreens/Details/datas_box.dart'; +import '../providers/connectivity.dart'; +import '../providers/test_results.dart'; +import '../widgets/Global/internet_error.dart'; +import '../widgets/TestResultScreens/Details/datas_box.dart'; import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; @@ -42,31 +42,33 @@ class _TestDetailsScreenState extends State { final double _devicewidth = _media.size.width; final double _deviceBlockSize = _devicewidth / 100; // print(datas); - return Scaffold( - appBar: AppBar( - titleSpacing: -10, - title: Text('Test Result Detail'), - leading: IconButton( - icon: Icon( - Icons.keyboard_arrow_left, - size: 35, + return SafeArea( + child: Scaffold( + appBar: AppBar( + titleSpacing: -10, + title: Text('Test Result Detail'), + leading: IconButton( + icon: Icon( + Icons.keyboard_arrow_left, + size: 35, + ), + onPressed: () => Navigator.of(context).pop(), ), - onPressed: () => Navigator.of(context).pop(), ), - ), - body: Consumer( - builder: (ct, connection, _) { - return connection.conStatus != 'offline' - ? isInit - ? Center( - child: CircularProgressIndicator(), - ) - : DatasBox( - datas: datas, - deviceBlockSize: _deviceBlockSize, - ) - : ConnectionErrorBox(); - }, + body: Consumer( + builder: (ct, connection, _) { + return connection.conStatus != 'offline' + ? isInit + ? Center( + child: CircularProgressIndicator(), + ) + : DatasBox( + datas: datas, + deviceBlockSize: _deviceBlockSize, + ) + : ConnectionErrorBox(); + }, + ), ), ); } diff --git a/lib/pages/test_filter_screen.dart b/lib/pages/test_filter_screen.dart index 9214b6e..21df194 100644 --- a/lib/pages/test_filter_screen.dart +++ b/lib/pages/test_filter_screen.dart @@ -1,4 +1,4 @@ -import 'package:barcode_scan/barcode_scan.dart'; +import 'package:barcode_scan2/barcode_scan2.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; @@ -131,264 +131,267 @@ class _TestFilterScreenState extends State { ); return true; }, - child: Scaffold( - appBar: AppBar( - titleSpacing: -10, - title: Text('Tests'), - leading: IconButton( - icon: Icon( - Icons.keyboard_arrow_left, - size: 35, - ), - onPressed: () => Navigator.of(context).popAndPushNamed( - Routes.testResultScreen, + child: SafeArea( + child: Scaffold( + appBar: AppBar( + titleSpacing: -10, + title: Text('Tests'), + leading: IconButton( + icon: Icon( + Icons.keyboard_arrow_left, + size: 35, + ), + onPressed: () => Navigator.of(context).popAndPushNamed( + Routes.testResultScreen, + ), ), ), - ), - body: Consumer( - builder: (ct, connection, _) { - return connection.conStatus != 'offline' - ? isInit - ? Center( - child: CircularProgressIndicator(), - ) - : Padding( - padding: EdgeInsets.all(20), - child: ListView( - // crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text( - 'FILTER RESULTS', - style: TextStyle( - fontWeight: FontWeight.w700, - fontSize: 5 * _deviceBlockSize, - ), - ), - SizedBox( - height: 20, - ), - Row( - children: [ - Flexible( - flex: 8, - child: TextFormField( - controller: idCTRL, - decoration: InputDecoration( - icon: Icon( - FontAwesomeIcons.sortNumericDown, - size: 6 * _deviceBlockSize, - ), - labelStyle: TextStyle( - fontWeight: FontWeight.w100, - fontSize: 4 * _deviceBlockSize, - ), - labelText: 'ID', - isDense: true, - contentPadding: EdgeInsets.symmetric( - vertical: 2, horizontal: 3), - ), - style: TextStyle( - fontWeight: FontWeight.w700, - fontSize: 5 * _deviceBlockSize, - ), - keyboardType: TextInputType.text, - textInputAction: TextInputAction.next, - // onFieldSubmitted: (_) { - // FocusScope.of(context) - // .requestFocus(_cycleNumberFocusNode); - // }, - ), + body: Consumer( + builder: (ct, connection, _) { + return connection.conStatus != 'offline' + ? isInit + ? Center( + child: CircularProgressIndicator(), + ) + : Padding( + padding: EdgeInsets.all(20), + child: ListView( + // crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + 'FILTER RESULTS', + style: TextStyle( + fontWeight: FontWeight.w700, + fontSize: 5 * _deviceBlockSize, ), - Flexible( - flex: 1, - child: InkWell( - onTap: () { - scan().then( - (String result) { - if (result == 'cancel') { - print('cancel'); - } else if (result == 'error') { - print('error'); - } else if (result == 'access') { - print('access'); - } else { - print(result); - idCTRL.text = result; - // Navigator.of(context).pushNamed( - // CycleDetailScreen.route, - // arguments: result, - // ); - } - }, - ); - }, - child: Container( - padding: EdgeInsets.all(8), - decoration: BoxDecoration( - shape: BoxShape.circle, - color: Colors.black, + ), + SizedBox( + height: 20, + ), + Row( + children: [ + Flexible( + flex: 8, + child: TextFormField( + controller: idCTRL, + decoration: InputDecoration( + icon: Icon( + FontAwesomeIcons.sortNumericDown, + size: 6 * _deviceBlockSize, + ), + labelStyle: TextStyle( + fontWeight: FontWeight.w100, + fontSize: 4 * _deviceBlockSize, + ), + labelText: 'ID', + isDense: true, + contentPadding: EdgeInsets.symmetric( + vertical: 2, horizontal: 3), ), - child: Icon( - FontAwesomeIcons.barcode, - size: 5 * _deviceBlockSize, + style: TextStyle( + fontWeight: FontWeight.w700, + fontSize: 5 * _deviceBlockSize, + ), + keyboardType: TextInputType.text, + textInputAction: TextInputAction.next, + // onFieldSubmitted: (_) { + // FocusScope.of(context) + // .requestFocus(_cycleNumberFocusNode); + // }, + ), + ), + Flexible( + flex: 1, + child: InkWell( + onTap: () { + scan().then( + (String result) { + if (result == 'cancel') { + print('cancel'); + } else if (result == 'error') { + print('error'); + } else if (result == 'access') { + print('access'); + } else { + print(result); + idCTRL.text = result; + // Navigator.of(context).pushNamed( + // CycleDetailScreen.route, + // arguments: result, + // ); + } + }, + ); + }, + child: Container( + padding: EdgeInsets.all(8), + decoration: BoxDecoration( + shape: BoxShape.circle, + color: Colors.black, + ), + child: Icon( + FontAwesomeIcons.barcode, + size: 5 * _deviceBlockSize, + color: Colors.white, + ), + ), + ), + ), + ], + ), + + SizedBox( + height: 25, + ), + TestResultFilterSelectorBox( + deviceBlockSize: _deviceBlockSize, + dataCTRL: labelIdCTRL, + dataVals: labelIDVals, + label: 'Label ID', + ), + SizedBox( + height: 25, + ), + + TextFormField( + controller: usernameCTRL, + decoration: InputDecoration( + icon: Icon( + FontAwesomeIcons.sortNumericDown, + size: 6 * _deviceBlockSize, + ), + labelStyle: TextStyle( + fontWeight: FontWeight.w100, + fontSize: 4 * _deviceBlockSize, + ), + labelText: 'Username', + isDense: true, + contentPadding: EdgeInsets.symmetric( + vertical: 2, horizontal: 3), + ), + style: TextStyle( + fontWeight: FontWeight.w700, + fontSize: 5 * _deviceBlockSize, + ), + keyboardType: TextInputType.visiblePassword, + textInputAction: TextInputAction.next, + // onFieldSubmitted: (_) { + // FocusScope.of(context) + // .requestFocus(_cycleNumberFocusNode); + // }, + ), + SizedBox( + height: 25, + ), + TestResultFilterSelectorBox( + deviceBlockSize: _deviceBlockSize, + dataCTRL: testTypeCTRL, + dataVals: testTypeVals, + label: 'Test Type', + ), + SizedBox( + height: 25, + ), + TestResultFilterSelectorBox( + deviceBlockSize: _deviceBlockSize, + dataCTRL: hospitalCTRL, + dataVals: hospitalVals, + label: 'Hospital', + ), + SizedBox( + height: 25, + ), + + TestResultFilterDatePicker( + dateCTRL: fDateCTRL, + deviceBlockSize: _deviceBlockSize, + label: 'Date From', + ), + SizedBox( + height: 25, + ), + TestResultFilterDatePicker( + dateCTRL: uDateCTRL, + deviceBlockSize: _deviceBlockSize, + label: 'Date Until', + ), + SizedBox( + height: 70, + ), + InkWell( + onTap: () { + Provider.of(context) + .setFilters( + idCTRL.text, + labelIdCTRL.text != '' + ? labelIdCTRL.text + : '', + usernameCTRL.text, + testTypeCTRL.text != '' + ? testTypes[testTypeCTRL.text] + : '', + hospitalCTRL.text != '' + ? hospitals[hospitalCTRL.text] + : '', + fDateCTRL.text, + uDateCTRL.text, + ); + showDialog( + context: context, + builder: (ctx) => AlertDialog( + content: Text('Filters changed.'), + actions: [ + TextButton( + onPressed: () { + Navigator.of(ctx).pop(); + // Navigator.of(context).pop(); + }, + child: Text('Ok'), + ) + ], + ), + ).then( + (_) => + Navigator.of(context).popAndPushNamed( + Routes.testResultScreen, + ), + ); + }, + child: Container( + padding: EdgeInsets.symmetric( + horizontal: 5 * _deviceBlockSize, + vertical: 10, + ), + // margin: + // EdgeInsets.symmetric(horizontal: 35, vertical: 15), + decoration: BoxDecoration( + gradient: LinearGradient( + colors: [Colors.blue, Colors.green], + ), + borderRadius: BorderRadius.circular(7), + ), + child: Align( + alignment: Alignment.center, + child: Text( + 'FILTER', + style: TextStyle( color: Colors.white, + fontSize: 5 * _deviceBlockSize, ), ), ), ), - ], - ), - - SizedBox( - height: 25, - ), - TestResultFilterSelectorBox( - deviceBlockSize: _deviceBlockSize, - dataCTRL: labelIdCTRL, - dataVals: labelIDVals, - label: 'Label ID', - ), - SizedBox( - height: 25, - ), - - TextFormField( - controller: usernameCTRL, - decoration: InputDecoration( - icon: Icon( - FontAwesomeIcons.sortNumericDown, - size: 6 * _deviceBlockSize, - ), - labelStyle: TextStyle( - fontWeight: FontWeight.w100, - fontSize: 4 * _deviceBlockSize, - ), - labelText: 'Username', - isDense: true, - contentPadding: EdgeInsets.symmetric( - vertical: 2, horizontal: 3), ), - style: TextStyle( - fontWeight: FontWeight.w700, - fontSize: 5 * _deviceBlockSize, + SizedBox( + height: 70, ), - keyboardType: TextInputType.visiblePassword, - textInputAction: TextInputAction.next, - // onFieldSubmitted: (_) { - // FocusScope.of(context) - // .requestFocus(_cycleNumberFocusNode); - // }, - ), - SizedBox( - height: 25, - ), - TestResultFilterSelectorBox( - deviceBlockSize: _deviceBlockSize, - dataCTRL: testTypeCTRL, - dataVals: testTypeVals, - label: 'Test Type', - ), - SizedBox( - height: 25, - ), - TestResultFilterSelectorBox( - deviceBlockSize: _deviceBlockSize, - dataCTRL: hospitalCTRL, - dataVals: hospitalVals, - label: 'Hospital', - ), - SizedBox( - height: 25, - ), - - TestResultFilterDatePicker( - dateCTRL: fDateCTRL, - deviceBlockSize: _deviceBlockSize, - label: 'Date From', - ), - SizedBox( - height: 25, - ), - TestResultFilterDatePicker( - dateCTRL: uDateCTRL, - deviceBlockSize: _deviceBlockSize, - label: 'Date Until', - ), - SizedBox( - height: 70, - ), - InkWell( - onTap: () { - Provider.of(context) - .setFilters( - idCTRL.text, - labelIdCTRL.text != '' - ? labelIdCTRL.text - : '', - usernameCTRL.text, - testTypeCTRL.text != '' - ? testTypes[testTypeCTRL.text] - : '', - hospitalCTRL.text != '' - ? hospitals[hospitalCTRL.text] - : '', - fDateCTRL.text, - uDateCTRL.text, - ); - showDialog( - context: context, - builder: (ctx) => AlertDialog( - content: Text('Filters changed.'), - actions: [ - FlatButton( - onPressed: () { - Navigator.of(ctx).pop(); - // Navigator.of(context).pop(); - }, - child: Text('Ok'), - ) - ], - ), - ).then( - (_) => Navigator.of(context).popAndPushNamed( - Routes.testResultScreen, - ), - ); - }, - child: Container( - padding: EdgeInsets.symmetric( - horizontal: 5 * _deviceBlockSize, - vertical: 10, - ), - // margin: - // EdgeInsets.symmetric(horizontal: 35, vertical: 15), - decoration: BoxDecoration( - gradient: LinearGradient( - colors: [Colors.blue, Colors.green], - ), - borderRadius: BorderRadius.circular(7), - ), - child: Align( - alignment: Alignment.center, - child: Text( - 'FILTER', - style: TextStyle( - color: Colors.white, - fontSize: 5 * _deviceBlockSize, - ), - ), - ), - ), - ), - SizedBox( - height: 70, - ), - // DropDownBox(values: ['Washer ID']), - ], - ), - ) - : ConnectionErrorBox(); - }, + // DropDownBox(values: ['Washer ID']), + ], + ), + ) + : ConnectionErrorBox(); + }, + ), ), ), ); diff --git a/lib/pages/test_form_page.dart b/lib/pages/test_form_page.dart index 1064ede..44edd76 100644 --- a/lib/pages/test_form_page.dart +++ b/lib/pages/test_form_page.dart @@ -1,11 +1,12 @@ -import 'package:cssd/config/routes.dart'; -import 'package:cssd/providers/input.dart'; -import 'package:cssd/providers/test_results.dart'; -import 'package:cssd/widgets/TestResultScreens/Add/form_creator.dart'; import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; import 'package:random_string/random_string.dart'; +import '../config/routes.dart'; +import '../providers/input.dart'; +import '../providers/test_results.dart'; +import '../widgets/TestResultScreens/Add/form_creator.dart'; + class FormPage extends StatefulWidget { final String name; final String uniqueCode; @@ -50,7 +51,7 @@ class _FormPageState extends State { builder: (ctx) => AlertDialog( content: Text('Test added.'), actions: [ - FlatButton( + TextButton( onPressed: () { Navigator.of(ctx).pop(); }, @@ -97,73 +98,76 @@ class _FormPageState extends State { ); return true; }, - child: Scaffold( - appBar: AppBar( - centerTitle: true, - title: Text('Add Test Result'), - actions: [ - IconButton( - icon: Icon(Icons.save), + child: SafeArea( + child: Scaffold( + appBar: AppBar( + centerTitle: true, + title: Text('Add Test Result'), + actions: [ + IconButton( + icon: Icon(Icons.save), + onPressed: () { + _saveForm(); + }, + ) + ], + leading: IconButton( + icon: Icon( + Icons.keyboard_arrow_left, + size: 35, + ), onPressed: () { - _saveForm(); + Navigator.of(context) + .popAndPushNamed(Routes.testResultScreen); }, - ) - ], - leading: IconButton( - icon: Icon( - Icons.keyboard_arrow_left, - size: 35, ), - onPressed: () { - Navigator.of(context).popAndPushNamed(Routes.testResultScreen); - }, ), - ), - body: Column( - children: [ - Expanded( - child: _isLoading - ? Center(child: CircularProgressIndicator()) - : Form( - key: _form, - child: Consumer( - builder: (context, inputs, _) { - formInputs = inputs.inputItems; - return formInputs.length != 0 - ? FormCreator( - form: inputs.inputItems, - onChanged: (value) { - formInputs = value; - }, - ) - : Center( - child: Text('An error happen!!!'), - ); - }, + body: Column( + children: [ + Expanded( + child: _isLoading + ? Center(child: CircularProgressIndicator()) + : Form( + key: _form, + child: Consumer( + builder: (context, inputs, _) { + formInputs = inputs.inputItems; + return formInputs.length != 0 + ? FormCreator( + form: inputs.inputItems, + onChanged: (value) { + formInputs = value; + }, + ) + : Center( + child: Text('An error happen!!!'), + ); + }, + ), ), - ), - ), - // https://www.cssd-doc.com/api/GetInfo - // InkWell( - // onTap: () { - // _saveForm(); - // }, - // child: Container( - // padding: EdgeInsets.symmetric(horizontal: 60, vertical: 15), - // margin: EdgeInsets.symmetric(vertical: 20, horizontal: 50), - // decoration: BoxDecoration( - // gradient: LinearGradient(colors: [Colors.blue, Colors.green]), - // borderRadius: BorderRadius.circular(10), - // ), - // child: Text( - // 'Save', - // style: TextStyle(color: Colors.white, fontSize: 17), - // textAlign: TextAlign.center, - // ), - // ), - // ), - ], - )), + ), + // https://www.cssd-doc.com/api/GetInfo + // InkWell( + // onTap: () { + // _saveForm(); + // }, + // child: Container( + // padding: EdgeInsets.symmetric(horizontal: 60, vertical: 15), + // margin: EdgeInsets.symmetric(vertical: 20, horizontal: 50), + // decoration: BoxDecoration( + // gradient: LinearGradient(colors: [Colors.blue, Colors.green]), + // borderRadius: BorderRadius.circular(10), + // ), + // child: Text( + // 'Save', + // style: TextStyle(color: Colors.white, fontSize: 17), + // textAlign: TextAlign.center, + // ), + // ), + // ), + ], + )), + ), ); } diff --git a/lib/pages/test_result_screen.dart b/lib/pages/test_result_screen.dart index 8ec1d02..15819f8 100644 --- a/lib/pages/test_result_screen.dart +++ b/lib/pages/test_result_screen.dart @@ -1,6 +1,3 @@ -import 'package:cssd/config/routes.dart'; -import 'package:cssd/models/test_result_models.dart'; -import 'package:cssd/providers/connectivity.dart'; // import 'package:cssd/providers/test_result.dart'; import 'package:cssd/providers/test_results.dart'; import 'package:cssd/widgets/Global/internet_error.dart'; @@ -11,6 +8,10 @@ import 'package:flutter/material.dart'; import 'package:font_awesome_flutter/font_awesome_flutter.dart'; import 'package:provider/provider.dart'; +import '../config/routes.dart'; +import '../models/test_result_models.dart'; +import '../providers/connectivity.dart'; + class TestResultScreen extends StatefulWidget { // static const route = '/TestResultScreen'; final bool isAdmin; @@ -69,225 +70,227 @@ class _TestResultScreenState extends State { // final double _pixelRatio = (_media.size.height / _media.size.width * 7 / 5); final double _devicewidth = _media.size.width; final double _deviceBlockSize = _devicewidth / 100; - return Scaffold( - floatingActionButton: - TestResultFloatingButton(deviceBlockSize: _deviceBlockSize), - appBar: AppBar( - titleSpacing: -10, - title: Text('Home'), - leading: IconButton( - icon: Icon( - Icons.keyboard_arrow_left, - size: 35, + return SafeArea( + child: Scaffold( + floatingActionButton: + TestResultFloatingButton(deviceBlockSize: _deviceBlockSize), + appBar: AppBar( + titleSpacing: -10, + title: Text('Home'), + leading: IconButton( + icon: Icon( + Icons.keyboard_arrow_left, + size: 35, + ), + onPressed: () => Navigator.of(context).pop(), ), - onPressed: () => Navigator.of(context).pop(), ), - ), - body: Consumer( - builder: (ct, connection, _) { - return connection.conStatus != 'offline' - ? Padding( - padding: - EdgeInsets.only(top: 20, left: 20, right: 20, bottom: 60), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Row( - // crossAxisAlignment: CrossAxisAlignment.center, - children: [ - Container( - // padding: EdgeInsets.only(top: 20, bottom: 40), - child: Text( - 'MY TEST RESULTS', - // textAlign: TextAlign.left, - style: TextStyle( - color: Colors.black, - fontSize: 6 * _deviceBlockSize, - fontWeight: FontWeight.w700, - letterSpacing: 2, - ), - ), - ), - Spacer(), - InkWell( - onTap: () { - Navigator.of(context) - .popAndPushNamed(Routes.testFilterScreen); - }, - child: Container( - padding: EdgeInsets.all(7), - child: Icon( - FontAwesomeIcons.filter, - size: 7 * _deviceBlockSize, - ), - ), - ), - ], - ), - SizedBox( - height: 20, - ), - Consumer( - builder: (context, testResult, _) { - return Container( - height: 50, - child: ListView( - scrollDirection: Axis.horizontal, - shrinkWrap: true, - children: [ - InkWell( - onTap: () { - Navigator.of(context).popAndPushNamed( - Routes.testFilterScreen); - }, - child: Chip( - backgroundColor: Colors.black, - label: Text( - 'Filters', - style: TextStyle( - color: Colors.white, - ), - ), - deleteIcon: Icon( - FontAwesomeIcons.filter, - color: Colors.white, - size: 4 * _deviceBlockSize, - ), - onDeleted: () { - Navigator.of(context).popAndPushNamed( - Routes.testFilterScreen, - ); - }, - ), + body: Consumer( + builder: (ct, connection, _) { + return connection.conStatus != 'offline' + ? Padding( + padding: EdgeInsets.only( + top: 20, left: 20, right: 20, bottom: 60), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + // crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Container( + // padding: EdgeInsets.only(top: 20, bottom: 40), + child: Text( + 'MY TEST RESULTS', + // textAlign: TextAlign.left, + style: TextStyle( + color: Colors.black, + fontSize: 6 * _deviceBlockSize, + fontWeight: FontWeight.w700, + letterSpacing: 2, ), - testResult.filters.id != '' - ? TestResultChip( - deviceBlockSize: _deviceBlockSize, - label: 'ID', - id: '', - labelID: testResult.filters.labelID, - testType: testResult.filters.testType, - hospital: testResult.filters.hospital, - username: testResult.filters.userName, - fDate: testResult.filters.fDate, - uDate: testResult.filters.uDate, - ) - : Container(), - testResult.filters.labelID != '' - ? TestResultChip( - deviceBlockSize: _deviceBlockSize, - label: 'Label ID', - id: testResult.filters.id, - labelID: '', - testType: testResult.filters.testType, - hospital: testResult.filters.hospital, - username: testResult.filters.userName, - fDate: testResult.filters.fDate, - uDate: testResult.filters.uDate, - ) - : Container(), - testResult.filters.testType != '' - ? TestResultChip( - deviceBlockSize: _deviceBlockSize, - label: 'Test Type', - id: testResult.filters.id, - labelID: testResult.filters.labelID, - testType: '', - hospital: testResult.filters.hospital, - username: testResult.filters.userName, - fDate: testResult.filters.fDate, - uDate: testResult.filters.uDate, - ) - : Container(), - testResult.filters.hospital != '' - ? TestResultChip( - deviceBlockSize: _deviceBlockSize, - label: 'Hospital', - id: testResult.filters.id, - labelID: testResult.filters.labelID, - testType: testResult.filters.testType, - hospital: '', - username: testResult.filters.userName, - fDate: testResult.filters.fDate, - uDate: testResult.filters.uDate, - ) - : Container(), - testResult.filters.userName != '' - ? TestResultChip( - deviceBlockSize: _deviceBlockSize, - label: 'Username', - id: testResult.filters.id, - labelID: testResult.filters.labelID, - testType: testResult.filters.testType, - hospital: testResult.filters.hospital, - username: '', - fDate: testResult.filters.fDate, - uDate: testResult.filters.uDate, - ) - : Container(), - testResult.filters.fDate != '' - ? TestResultChip( - deviceBlockSize: _deviceBlockSize, - label: 'From Date', - id: testResult.filters.id, - labelID: testResult.filters.labelID, - testType: testResult.filters.testType, - hospital: testResult.filters.hospital, - username: testResult.filters.userName, - fDate: '', - uDate: testResult.filters.uDate, - ) - : Container(), - testResult.filters.uDate != '' - ? TestResultChip( - deviceBlockSize: _deviceBlockSize, - label: 'Until Date', - id: testResult.filters.id, - labelID: testResult.filters.labelID, - testType: testResult.filters.testType, - hospital: testResult.filters.hospital, - username: testResult.filters.userName, - fDate: testResult.filters.fDate, - uDate: '', - ) - : Container(), - ], + ), ), - ); - }, - ), - TestResultSearchBox( - searchCTRL: searchCTRL, - deviceBlockSize: _deviceBlockSize, - ), - SizedBox( - height: 20, - ), - Expanded( - child: Consumer( - builder: (context, testResults, _) { - return testResults.isloading - ? Center( - child: CircularProgressIndicator(), - ) - : ListView.builder( - controller: sc, - itemBuilder: (context, index) => - TestItemBox( - deviceBlockSize: _deviceBlockSize, - item: testResults.items[index], + Spacer(), + InkWell( + onTap: () { + Navigator.of(context) + .popAndPushNamed(Routes.testFilterScreen); + }, + child: Container( + padding: EdgeInsets.all(7), + child: Icon( + FontAwesomeIcons.filter, + size: 7 * _deviceBlockSize, + ), + ), + ), + ], + ), + SizedBox( + height: 20, + ), + Consumer( + builder: (context, testResult, _) { + return Container( + height: 50, + child: ListView( + scrollDirection: Axis.horizontal, + shrinkWrap: true, + children: [ + InkWell( + onTap: () { + Navigator.of(context).popAndPushNamed( + Routes.testFilterScreen); + }, + child: Chip( + backgroundColor: Colors.black, + label: Text( + 'Filters', + style: TextStyle( + color: Colors.white, + ), + ), + deleteIcon: Icon( + FontAwesomeIcons.filter, + color: Colors.white, + size: 4 * _deviceBlockSize, + ), + onDeleted: () { + Navigator.of(context).popAndPushNamed( + Routes.testFilterScreen, + ); + }, ), - itemCount: testResults.items.length, - shrinkWrap: true, - ); + ), + testResult.filters.id != '' + ? TestResultChip( + deviceBlockSize: _deviceBlockSize, + label: 'ID', + id: '', + labelID: testResult.filters.labelID, + testType: testResult.filters.testType, + hospital: testResult.filters.hospital, + username: testResult.filters.userName, + fDate: testResult.filters.fDate, + uDate: testResult.filters.uDate, + ) + : Container(), + testResult.filters.labelID != '' + ? TestResultChip( + deviceBlockSize: _deviceBlockSize, + label: 'Label ID', + id: testResult.filters.id, + labelID: '', + testType: testResult.filters.testType, + hospital: testResult.filters.hospital, + username: testResult.filters.userName, + fDate: testResult.filters.fDate, + uDate: testResult.filters.uDate, + ) + : Container(), + testResult.filters.testType != '' + ? TestResultChip( + deviceBlockSize: _deviceBlockSize, + label: 'Test Type', + id: testResult.filters.id, + labelID: testResult.filters.labelID, + testType: '', + hospital: testResult.filters.hospital, + username: testResult.filters.userName, + fDate: testResult.filters.fDate, + uDate: testResult.filters.uDate, + ) + : Container(), + testResult.filters.hospital != '' + ? TestResultChip( + deviceBlockSize: _deviceBlockSize, + label: 'Hospital', + id: testResult.filters.id, + labelID: testResult.filters.labelID, + testType: testResult.filters.testType, + hospital: '', + username: testResult.filters.userName, + fDate: testResult.filters.fDate, + uDate: testResult.filters.uDate, + ) + : Container(), + testResult.filters.userName != '' + ? TestResultChip( + deviceBlockSize: _deviceBlockSize, + label: 'Username', + id: testResult.filters.id, + labelID: testResult.filters.labelID, + testType: testResult.filters.testType, + hospital: testResult.filters.hospital, + username: '', + fDate: testResult.filters.fDate, + uDate: testResult.filters.uDate, + ) + : Container(), + testResult.filters.fDate != '' + ? TestResultChip( + deviceBlockSize: _deviceBlockSize, + label: 'From Date', + id: testResult.filters.id, + labelID: testResult.filters.labelID, + testType: testResult.filters.testType, + hospital: testResult.filters.hospital, + username: testResult.filters.userName, + fDate: '', + uDate: testResult.filters.uDate, + ) + : Container(), + testResult.filters.uDate != '' + ? TestResultChip( + deviceBlockSize: _deviceBlockSize, + label: 'Until Date', + id: testResult.filters.id, + labelID: testResult.filters.labelID, + testType: testResult.filters.testType, + hospital: testResult.filters.hospital, + username: testResult.filters.userName, + fDate: testResult.filters.fDate, + uDate: '', + ) + : Container(), + ], + ), + ); }, ), - ), - ], - ), - ) - : ConnectionErrorBox(); - }, + TestResultSearchBox( + searchCTRL: searchCTRL, + deviceBlockSize: _deviceBlockSize, + ), + SizedBox( + height: 20, + ), + Expanded( + child: Consumer( + builder: (context, testResults, _) { + return testResults.isloading + ? Center( + child: CircularProgressIndicator(), + ) + : ListView.builder( + controller: sc, + itemBuilder: (context, index) => + TestItemBox( + deviceBlockSize: _deviceBlockSize, + item: testResults.items[index], + ), + itemCount: testResults.items.length, + shrinkWrap: true, + ); + }, + ), + ), + ], + ), + ) + : ConnectionErrorBox(); + }, + ), ), ); } @@ -376,7 +379,7 @@ class TestItemBox extends StatelessWidget { // content: Text( // 'Are you sure for delete this test?'), // actions: [ - // FlatButton( + // TextButton( // onPressed: () { // Provider.of( // context) @@ -388,7 +391,7 @@ class TestItemBox extends StatelessWidget { // }, // child: Text('Yes'), // ), - // FlatButton( + // TextButton( // onPressed: () { // Navigator.of(ctx).pop(); // }, diff --git a/lib/pages/test_scan_screen.dart b/lib/pages/test_scan_screen.dart index f531ff4..1a32696 100644 --- a/lib/pages/test_scan_screen.dart +++ b/lib/pages/test_scan_screen.dart @@ -1,13 +1,13 @@ -import 'package:cssd/providers/connectivity.dart'; -import 'package:cssd/widgets/Global/internet_error.dart'; +import 'package:barcode_scan2/barcode_scan2.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; -import 'package:barcode_scan/barcode_scan.dart'; - import 'package:font_awesome_flutter/font_awesome_flutter.dart'; import 'package:provider/provider.dart'; import 'package:url_launcher/url_launcher.dart'; +import '../providers/connectivity.dart'; +import '../widgets/Global/internet_error.dart'; + class TestScanScreen extends StatefulWidget { // static const route = '/TestScanScreen'; @override @@ -27,163 +27,166 @@ class _TestScanScreenState extends State { // final double _pixelRatio = (_media.size.height / _media.size.width * 7 / 5); final double _devicewidth = _media.size.width; final double _deviceBlockSize = _devicewidth / 100; - return Scaffold( - appBar: AppBar( - centerTitle: true, - titleSpacing: -10, - title: Text('CSSD'), - leading: IconButton( - icon: Icon( - Icons.keyboard_arrow_left, - size: 35, + return SafeArea( + child: Scaffold( + appBar: AppBar( + centerTitle: true, + titleSpacing: -10, + title: Text('CSSD'), + leading: IconButton( + icon: Icon( + Icons.keyboard_arrow_left, + size: 35, + ), + onPressed: () => Navigator.of(context).pop(), ), - onPressed: () => Navigator.of(context).pop(), ), - ), - body: Consumer(builder: (ct, connection, _) { - return connection.conStatus != 'offline' - ? ListView( - padding: EdgeInsets.symmetric(horizontal: 20), - children: [ - Container( - padding: EdgeInsets.only(top: 30), - child: Text( - 'LOOKING FOR A Test Result?', - textAlign: TextAlign.left, - style: TextStyle( - color: Colors.black, - fontSize: 5.5 * _deviceBlockSize, - fontWeight: FontWeight.w700, - letterSpacing: 3, - ), - ), - ), - GestureDetector( - child: Container( - margin: EdgeInsets.symmetric(vertical: 10), - height: 200, - decoration: BoxDecoration(border: Border.all()), - child: Center( - child: Text( - 'Please Scan The Test Result Barcode', - style: TextStyle( - color: Colors.black, - fontSize: 5 * _deviceBlockSize, - fontWeight: FontWeight.w100, - letterSpacing: 3, - ), - textAlign: TextAlign.center, + body: Consumer(builder: (ct, connection, _) { + return connection.conStatus != 'offline' + ? ListView( + padding: EdgeInsets.symmetric(horizontal: 20), + children: [ + Container( + padding: EdgeInsets.only(top: 30), + child: Text( + 'LOOKING FOR A Test Result?', + textAlign: TextAlign.left, + style: TextStyle( + color: Colors.black, + fontSize: 5.5 * _deviceBlockSize, + fontWeight: FontWeight.w700, + letterSpacing: 3, ), ), ), - onTap: () { - scan().then( - (String result) { - if (result == 'cancel') { - print('cancel'); - } else if (result == 'error') { - print('error'); - } else if (result == 'access') { - print('access'); - } else { - launch( - 'https://cssd-doc.com/Show/TestResult/$result', - ); - // Navigator.of(context).pushNamed( - // Routes.cycleDetailScreen, - // arguments: result, - // ); - } - }, - ); - }, - ), - Form( - key: _form, - child: TextFormField( - validator: (val) { - if (val.isEmpty) { - return 'Id required!!'; - } - return null; + GestureDetector( + child: Container( + margin: EdgeInsets.symmetric(vertical: 10), + height: 200, + decoration: BoxDecoration(border: Border.all()), + child: Center( + child: Text( + 'Please Scan The Test Result Barcode', + style: TextStyle( + color: Colors.black, + fontSize: 5 * _deviceBlockSize, + fontWeight: FontWeight.w100, + letterSpacing: 3, + ), + textAlign: TextAlign.center, + ), + ), + ), + onTap: () { + scan().then( + (String result) { + if (result == 'cancel') { + print('cancel'); + } else if (result == 'error') { + print('error'); + } else if (result == 'access') { + print('access'); + } else { + launch( + 'https://cssd-doc.com/Show/TestResult/$result', + ); + // Navigator.of(context).pushNamed( + // Routes.cycleDetailScreen, + // arguments: result, + // ); + } + }, + ); }, - controller: idCTRL, - decoration: InputDecoration( - icon: Icon( - FontAwesomeIcons.sortNumericDown, - size: 6 * _deviceBlockSize, - ), - labelStyle: TextStyle( - fontWeight: FontWeight.w100, - fontSize: 4 * _deviceBlockSize, - ), - isDense: true, - labelText: 'Or enter a Test Result ID', - contentPadding: EdgeInsets.symmetric( - vertical: 2, - horizontal: 3, - ), - focusedBorder: UnderlineInputBorder( - // borderRadius: BorderRadius.only(Radius.circular(4)), - borderSide: BorderSide( - color: Colors.grey, + ), + Form( + key: _form, + child: TextFormField( + validator: (val) { + if (val.isEmpty) { + return 'Id required!!'; + } + return null; + }, + controller: idCTRL, + decoration: InputDecoration( + icon: Icon( + FontAwesomeIcons.sortNumericDown, + size: 6 * _deviceBlockSize, + ), + labelStyle: TextStyle( + fontWeight: FontWeight.w100, + fontSize: 4 * _deviceBlockSize, + ), + isDense: true, + labelText: 'Or enter a Test Result ID', + contentPadding: EdgeInsets.symmetric( + vertical: 2, + horizontal: 3, + ), + focusedBorder: UnderlineInputBorder( + // borderRadius: BorderRadius.only(Radius.circular(4)), + borderSide: BorderSide( + color: Colors.grey, + ), ), ), - ), - style: TextStyle( - fontWeight: FontWeight.w700, - fontSize: 5 * _deviceBlockSize, - ), - keyboardType: TextInputType.number, - ), - ), - SizedBox( - height: 40, - ), - Divider( - color: Colors.black, - thickness: 3, - ), - SizedBox( - height: 30, - ), - InkWell( - onTap: () { - if (!_form.currentState.validate()) { - return; - } - launch( - 'https://cssd-doc.com/Show/TestResult/${idCTRL.text}', - ); - }, - child: Container( - padding: EdgeInsets.symmetric( - horizontal: 5 * _deviceBlockSize, - vertical: 10, - ), - margin: EdgeInsets.only(bottom: 50, left: 20, right: 20), - decoration: BoxDecoration( - gradient: LinearGradient( - colors: [Colors.red, Colors.orange], + style: TextStyle( + fontWeight: FontWeight.w700, + fontSize: 5 * _deviceBlockSize, ), - borderRadius: BorderRadius.circular(7), + keyboardType: TextInputType.number, ), - child: Align( - alignment: Alignment.center, - child: Text( - 'GO!', - style: TextStyle( - color: Colors.white, - fontSize: 5 * _deviceBlockSize, + ), + SizedBox( + height: 40, + ), + Divider( + color: Colors.black, + thickness: 3, + ), + SizedBox( + height: 30, + ), + InkWell( + onTap: () { + if (!_form.currentState.validate()) { + return; + } + launch( + 'https://cssd-doc.com/Show/TestResult/${idCTRL.text}', + ); + }, + child: Container( + padding: EdgeInsets.symmetric( + horizontal: 5 * _deviceBlockSize, + vertical: 10, + ), + margin: + EdgeInsets.only(bottom: 50, left: 20, right: 20), + decoration: BoxDecoration( + gradient: LinearGradient( + colors: [Colors.red, Colors.orange], + ), + borderRadius: BorderRadius.circular(7), + ), + child: Align( + alignment: Alignment.center, + child: Text( + 'GO!', + style: TextStyle( + color: Colors.white, + fontSize: 5 * _deviceBlockSize, + ), ), ), ), ), - ), - ], - ) - : ConnectionErrorBox(); - }), + ], + ) + : ConnectionErrorBox(); + }), + ), ); } diff --git a/lib/pages/test_verify_screen.dart b/lib/pages/test_verify_screen.dart index db0b7f8..2b1a570 100644 --- a/lib/pages/test_verify_screen.dart +++ b/lib/pages/test_verify_screen.dart @@ -1,11 +1,11 @@ -import 'package:cssd/providers/test_results.dart'; -import 'package:cssd/widgets/TestResultScreens/Main/search_box.dart'; import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; import '../config/routes.dart'; import '../models/test_result_models.dart'; import '../providers/auth.dart'; +import '../providers/test_results.dart'; +import '../widgets/TestResultScreens/Main/search_box.dart'; class TestVerifyScreen extends StatefulWidget { // static const route = '/TestVerifyScreen'; @@ -70,236 +70,238 @@ class _TestVerifyScreenState extends State { // final double _pixelRatio = (_media.size.height / _media.size.width * 7 / 5); final double _devicewidth = _media.size.width; final double _deviceBlockSize = _devicewidth / 100; - return Scaffold( - appBar: AppBar( - titleSpacing: -10, - title: Text('Home'), - leading: IconButton( - icon: Icon( - Icons.keyboard_arrow_left, - size: 35, + return SafeArea( + child: Scaffold( + appBar: AppBar( + titleSpacing: -10, + title: Text('Home'), + leading: IconButton( + icon: Icon( + Icons.keyboard_arrow_left, + size: 35, + ), + onPressed: () => Navigator.of(context).pop(), ), - onPressed: () => Navigator.of(context).pop(), ), - ), - body: Padding( - padding: EdgeInsets.only(top: 20, left: 20, right: 20, bottom: 60), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Row( - // crossAxisAlignment: CrossAxisAlignment.center, - children: [ - Container( - // padding: EdgeInsets.only(top: 20, bottom: 40), - child: Text( - 'TESTS TO VERIFY', - // textAlign: TextAlign.left, - style: TextStyle( - color: Colors.black, - fontSize: 6 * _deviceBlockSize, - fontWeight: FontWeight.w700, - letterSpacing: 2, + body: Padding( + padding: EdgeInsets.only(top: 20, left: 20, right: 20, bottom: 60), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + // crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Container( + // padding: EdgeInsets.only(top: 20, bottom: 40), + child: Text( + 'TESTS TO VERIFY', + // textAlign: TextAlign.left, + style: TextStyle( + color: Colors.black, + fontSize: 6 * _deviceBlockSize, + fontWeight: FontWeight.w700, + letterSpacing: 2, + ), ), ), - ), - // Spacer(), - // InkWell( - // onTap: () { - // Navigator.of(context) - // .popAndPushNamed(Routes.testFilterScreen); - // }, - // child: Container( - // padding: EdgeInsets.all(7), - // child: Icon( - // FontAwesomeIcons.filter, - // size: 7 * _deviceBlockSize, - // ), - // ), - // ), - ], - ), - SizedBox( - height: 20, - ), - // Consumer( - // builder: (context, testResult, _) { - // return Container( - // height: 50, - // child: ListView( - // scrollDirection: Axis.horizontal, - // shrinkWrap: true, - // children: [ - // InkWell( - // onTap: () { - // Navigator.of(context) - // .popAndPushNamed(Routes.testFilterScreen); - // }, - // child: Chip( - // backgroundColor: Colors.black, - // label: Text( - // 'Filters', - // style: TextStyle( - // color: Colors.white, - // ), - // ), - // deleteIcon: Icon( - // FontAwesomeIcons.filter, - // color: Colors.white, - // size: 4 * _deviceBlockSize, - // ), - // onDeleted: () { - // Navigator.of(context) - // .popAndPushNamed(Routes.testFilterScreen); - // }, - // ), - // ), - // testResult.filters.id != '' - // ? TestResultChip( - // deviceBlockSize: _deviceBlockSize, - // label: 'ID', - // id: '', - // labelID: testResult.filters.labelID, - // testType: testResult.filters.testType, - // hospital: testResult.filters.hospital, - // username: testResult.filters.userName, - // fDate: testResult.filters.fDate, - // uDate: testResult.filters.uDate, - // ) - // : Container(), - // testResult.filters.labelID != '' - // ? TestResultChip( - // deviceBlockSize: _deviceBlockSize, - // label: 'Label ID', - // id: testResult.filters.id, - // labelID: '', - // testType: testResult.filters.testType, - // hospital: testResult.filters.hospital, - // username: testResult.filters.userName, - // fDate: testResult.filters.fDate, - // uDate: testResult.filters.uDate, - // ) - // : Container(), - // testResult.filters.testType != '' - // ? TestResultChip( - // deviceBlockSize: _deviceBlockSize, - // label: 'Test Type', - // id: testResult.filters.id, - // labelID: testResult.filters.labelID, - // testType: '', - // hospital: testResult.filters.hospital, - // username: testResult.filters.userName, - // fDate: testResult.filters.fDate, - // uDate: testResult.filters.uDate, - // ) - // : Container(), - // testResult.filters.hospital != '' - // ? TestResultChip( - // deviceBlockSize: _deviceBlockSize, - // label: 'Hospital', - // id: testResult.filters.id, - // labelID: testResult.filters.labelID, - // testType: testResult.filters.testType, - // hospital: '', - // username: testResult.filters.userName, - // fDate: testResult.filters.fDate, - // uDate: testResult.filters.uDate, - // ) - // : Container(), - // testResult.filters.userName != '' - // ? TestResultChip( - // deviceBlockSize: _deviceBlockSize, - // label: 'Username', - // id: testResult.filters.id, - // labelID: testResult.filters.labelID, - // testType: testResult.filters.testType, - // hospital: testResult.filters.hospital, - // username: '', - // fDate: testResult.filters.fDate, - // uDate: testResult.filters.uDate, - // ) - // : Container(), - // testResult.filters.fDate != '' - // ? TestResultChip( - // deviceBlockSize: _deviceBlockSize, - // label: 'From Date', - // id: testResult.filters.id, - // labelID: testResult.filters.labelID, - // testType: testResult.filters.testType, - // hospital: testResult.filters.hospital, - // username: testResult.filters.userName, - // fDate: '', - // uDate: testResult.filters.uDate, - // ) - // : Container(), - // testResult.filters.uDate != '' - // ? TestResultChip( - // deviceBlockSize: _deviceBlockSize, - // label: 'Until Date', - // id: testResult.filters.id, - // labelID: testResult.filters.labelID, - // testType: testResult.filters.testType, - // hospital: testResult.filters.hospital, - // username: testResult.filters.userName, - // fDate: testResult.filters.fDate, - // uDate: '', - // ) - // : Container(), - // ], - // ), - // ); - // }, - // ), - TestResultSearchBox( - searchCTRL: searchCTRL, - deviceBlockSize: _deviceBlockSize, - ), - SizedBox( - height: 20, - ), - Expanded( - child: Consumer( - builder: (context, testResults, _) { - return testResults.isloading - ? Center( - child: CircularProgressIndicator(), - ) - : ListView.builder( - controller: sc, - itemBuilder: (context, index) => - (testResults.items[index].verified == 'None' && - userData['roles'] - .contains('Supervisor')) || - userData['roles'].contains('Admin') - ? TestItemBox( - deviceBlockSize: _deviceBlockSize, - item: testResults.items[index], - id: testResults.items[index].id, - userData: userData, - ) - : Container(), - // Column( - // children: [ - // Text(testResults.items[index].name), - // Text(testResults.items[index].isVerified.toString()), - // Text(testResults.items[index].hospital), - // Text(testResults.items[index].date), - - // ], - // ), - // ChangeNotifierProvider.value( - // value: testResults.items[index], - // child: ResultCard( - // isAdmin: widget.isAdmin, - // ), - // ), - itemCount: testResults.items.length, - shrinkWrap: true, - ); - }, + // Spacer(), + // InkWell( + // onTap: () { + // Navigator.of(context) + // .popAndPushNamed(Routes.testFilterScreen); + // }, + // child: Container( + // padding: EdgeInsets.all(7), + // child: Icon( + // FontAwesomeIcons.filter, + // size: 7 * _deviceBlockSize, + // ), + // ), + // ), + ], ), - ), - ], + SizedBox( + height: 20, + ), + // Consumer( + // builder: (context, testResult, _) { + // return Container( + // height: 50, + // child: ListView( + // scrollDirection: Axis.horizontal, + // shrinkWrap: true, + // children: [ + // InkWell( + // onTap: () { + // Navigator.of(context) + // .popAndPushNamed(Routes.testFilterScreen); + // }, + // child: Chip( + // backgroundColor: Colors.black, + // label: Text( + // 'Filters', + // style: TextStyle( + // color: Colors.white, + // ), + // ), + // deleteIcon: Icon( + // FontAwesomeIcons.filter, + // color: Colors.white, + // size: 4 * _deviceBlockSize, + // ), + // onDeleted: () { + // Navigator.of(context) + // .popAndPushNamed(Routes.testFilterScreen); + // }, + // ), + // ), + // testResult.filters.id != '' + // ? TestResultChip( + // deviceBlockSize: _deviceBlockSize, + // label: 'ID', + // id: '', + // labelID: testResult.filters.labelID, + // testType: testResult.filters.testType, + // hospital: testResult.filters.hospital, + // username: testResult.filters.userName, + // fDate: testResult.filters.fDate, + // uDate: testResult.filters.uDate, + // ) + // : Container(), + // testResult.filters.labelID != '' + // ? TestResultChip( + // deviceBlockSize: _deviceBlockSize, + // label: 'Label ID', + // id: testResult.filters.id, + // labelID: '', + // testType: testResult.filters.testType, + // hospital: testResult.filters.hospital, + // username: testResult.filters.userName, + // fDate: testResult.filters.fDate, + // uDate: testResult.filters.uDate, + // ) + // : Container(), + // testResult.filters.testType != '' + // ? TestResultChip( + // deviceBlockSize: _deviceBlockSize, + // label: 'Test Type', + // id: testResult.filters.id, + // labelID: testResult.filters.labelID, + // testType: '', + // hospital: testResult.filters.hospital, + // username: testResult.filters.userName, + // fDate: testResult.filters.fDate, + // uDate: testResult.filters.uDate, + // ) + // : Container(), + // testResult.filters.hospital != '' + // ? TestResultChip( + // deviceBlockSize: _deviceBlockSize, + // label: 'Hospital', + // id: testResult.filters.id, + // labelID: testResult.filters.labelID, + // testType: testResult.filters.testType, + // hospital: '', + // username: testResult.filters.userName, + // fDate: testResult.filters.fDate, + // uDate: testResult.filters.uDate, + // ) + // : Container(), + // testResult.filters.userName != '' + // ? TestResultChip( + // deviceBlockSize: _deviceBlockSize, + // label: 'Username', + // id: testResult.filters.id, + // labelID: testResult.filters.labelID, + // testType: testResult.filters.testType, + // hospital: testResult.filters.hospital, + // username: '', + // fDate: testResult.filters.fDate, + // uDate: testResult.filters.uDate, + // ) + // : Container(), + // testResult.filters.fDate != '' + // ? TestResultChip( + // deviceBlockSize: _deviceBlockSize, + // label: 'From Date', + // id: testResult.filters.id, + // labelID: testResult.filters.labelID, + // testType: testResult.filters.testType, + // hospital: testResult.filters.hospital, + // username: testResult.filters.userName, + // fDate: '', + // uDate: testResult.filters.uDate, + // ) + // : Container(), + // testResult.filters.uDate != '' + // ? TestResultChip( + // deviceBlockSize: _deviceBlockSize, + // label: 'Until Date', + // id: testResult.filters.id, + // labelID: testResult.filters.labelID, + // testType: testResult.filters.testType, + // hospital: testResult.filters.hospital, + // username: testResult.filters.userName, + // fDate: testResult.filters.fDate, + // uDate: '', + // ) + // : Container(), + // ], + // ), + // ); + // }, + // ), + TestResultSearchBox( + searchCTRL: searchCTRL, + deviceBlockSize: _deviceBlockSize, + ), + SizedBox( + height: 20, + ), + Expanded( + child: Consumer( + builder: (context, testResults, _) { + return testResults.isloading + ? Center( + child: CircularProgressIndicator(), + ) + : ListView.builder( + controller: sc, + itemBuilder: (context, index) => + (testResults.items[index].verified == 'None' && + userData['roles'] + .contains('Supervisor')) || + userData['roles'].contains('Admin') + ? TestItemBox( + deviceBlockSize: _deviceBlockSize, + item: testResults.items[index], + id: testResults.items[index].id, + userData: userData, + ) + : Container(), + // Column( + // children: [ + // Text(testResults.items[index].name), + // Text(testResults.items[index].isVerified.toString()), + // Text(testResults.items[index].hospital), + // Text(testResults.items[index].date), + + // ], + // ), + // ChangeNotifierProvider.value( + // value: testResults.items[index], + // child: ResultCard( + // isAdmin: widget.isAdmin, + // ), + // ), + itemCount: testResults.items.length, + shrinkWrap: true, + ); + }, + ), + ), + ], + ), ), ), ); @@ -401,7 +403,7 @@ class TestItemBox extends StatelessWidget { content: Text( 'Are you sure for verify this test?'), actions: [ - FlatButton( + TextButton( onPressed: () async { Provider.of( context) @@ -418,7 +420,7 @@ class TestItemBox extends StatelessWidget { }, child: Text('Yes'), ), - FlatButton( + TextButton( onPressed: () { Navigator.of(ctx).pop(); }, @@ -454,7 +456,7 @@ class TestItemBox extends StatelessWidget { content: Text( 'Are you sure for reject this test?'), actions: [ - FlatButton( + TextButton( onPressed: () async { await Provider.of( context) @@ -471,7 +473,7 @@ class TestItemBox extends StatelessWidget { }, child: Text('Yes'), ), - FlatButton( + TextButton( onPressed: () { Navigator.of(ctx).pop(); }, diff --git a/lib/pages/verify_pass_screen.dart b/lib/pages/verify_pass_screen.dart index 17fa79c..5bf8423 100644 --- a/lib/pages/verify_pass_screen.dart +++ b/lib/pages/verify_pass_screen.dart @@ -1,11 +1,12 @@ -import 'package:cssd/config/routes.dart'; -import 'package:cssd/providers/auth.dart'; -import 'package:cssd/providers/connectivity.dart'; -import 'package:cssd/widgets/Global/internet_error.dart'; import 'package:flutter/material.dart'; import 'package:font_awesome_flutter/font_awesome_flutter.dart'; import 'package:provider/provider.dart'; +import '../config/routes.dart'; +import '../providers/auth.dart'; +import '../providers/connectivity.dart'; +import '../widgets/Global/internet_error.dart'; + class VerifyPassScreen extends StatefulWidget { // static const route = '/HomeScreen'; @@ -38,7 +39,7 @@ class _VerifyPassScreenState extends State { title: Text('Error'), content: Text(message), actions: [ - FlatButton( + TextButton( child: Text('Ok'), onPressed: () { Navigator.of(ctx).pop(); @@ -85,108 +86,110 @@ class _VerifyPassScreenState extends State { // final double _pixelRatio = (_media.size.height / _media.size.width * 7 / 5); final double _devicewidth = _media.size.width; final double _deviceBlockSize = _devicewidth / 100; - return Scaffold( - appBar: AppBar( - centerTitle: true, - title: Text('CSSD'), - ), - body: Selector( - builder: (ctx, value, _) => value != 'offline' - ? _isLoading - ? Center( - child: CircularProgressIndicator(), - ) - : Form( - key: _form, - child: ListView( - padding: EdgeInsets.symmetric(horizontal: 20), - children: [ - Container( - padding: EdgeInsets.symmetric(vertical: 20), - child: Text( - 'Send Verification Code', - textAlign: TextAlign.left, - style: TextStyle( - color: Colors.black, - fontSize: 5 * _deviceBlockSize, - letterSpacing: 3, - fontWeight: FontWeight.w700, - ), - ), - ), - TextFormField( - validator: (value) { - if (value.isEmpty) { - return 'Code is required.'; - } - if (value.length != 6) { - return 'Code most be 6 characters'; - } - return null; - }, - controller: codeCTRL, - decoration: InputDecoration( - icon: Icon( - FontAwesomeIcons.starOfLife, - size: 6 * _deviceBlockSize, - ), - labelStyle: TextStyle( - fontWeight: FontWeight.w100, - fontSize: 4 * _deviceBlockSize, - ), - labelText: 'Code', - isDense: true, - contentPadding: EdgeInsets.symmetric( - vertical: 2, - horizontal: 3, - ), - ), - style: TextStyle( - fontWeight: FontWeight.w700, - fontSize: 5 * _deviceBlockSize, - letterSpacing: 3, - ), - keyboardType: TextInputType.number, - onSaved: (value) { - codeCTRL.text = value; - }, - maxLength: 6, - ), - SizedBox(height: 40), - Row( - children: [ - InkWell( - onTap: () => _sendCode(), - child: Container( - width: 40 * _deviceBlockSize, - padding: EdgeInsets.symmetric( - horizontal: 5 * _deviceBlockSize, - vertical: 10, - ), - // margin: - // EdgeInsets.symmetric(horizontal: 35, vertical: 15), - decoration: BoxDecoration( - gradient: LinearGradient( - colors: [Colors.blue, Colors.green], - ), - borderRadius: BorderRadius.circular(7), - ), - child: Text( - 'Send Code', - textAlign: TextAlign.center, - style: TextStyle(color: Colors.white), - ), + return SafeArea( + child: Scaffold( + appBar: AppBar( + centerTitle: true, + title: Text('CSSD'), + ), + body: Selector( + builder: (ctx, value, _) => value != 'offline' + ? _isLoading + ? Center( + child: CircularProgressIndicator(), + ) + : Form( + key: _form, + child: ListView( + padding: EdgeInsets.symmetric(horizontal: 20), + children: [ + Container( + padding: EdgeInsets.symmetric(vertical: 20), + child: Text( + 'Send Verification Code', + textAlign: TextAlign.left, + style: TextStyle( + color: Colors.black, + fontSize: 5 * _deviceBlockSize, + letterSpacing: 3, + fontWeight: FontWeight.w700, ), ), - Spacer(), - ], - ), - SizedBox(height: 10), - ], - ), - ) - : ConnectionErrorBox(), - selector: (_, connectivity) => connectivity.conStatus, + ), + TextFormField( + validator: (value) { + if (value.isEmpty) { + return 'Code is required.'; + } + if (value.length != 6) { + return 'Code most be 6 characters'; + } + return null; + }, + controller: codeCTRL, + decoration: InputDecoration( + icon: Icon( + FontAwesomeIcons.starOfLife, + size: 6 * _deviceBlockSize, + ), + labelStyle: TextStyle( + fontWeight: FontWeight.w100, + fontSize: 4 * _deviceBlockSize, + ), + labelText: 'Code', + isDense: true, + contentPadding: EdgeInsets.symmetric( + vertical: 2, + horizontal: 3, + ), + ), + style: TextStyle( + fontWeight: FontWeight.w700, + fontSize: 5 * _deviceBlockSize, + letterSpacing: 3, + ), + keyboardType: TextInputType.number, + onSaved: (value) { + codeCTRL.text = value; + }, + maxLength: 6, + ), + SizedBox(height: 40), + Row( + children: [ + InkWell( + onTap: () => _sendCode(), + child: Container( + width: 40 * _deviceBlockSize, + padding: EdgeInsets.symmetric( + horizontal: 5 * _deviceBlockSize, + vertical: 10, + ), + // margin: + // EdgeInsets.symmetric(horizontal: 35, vertical: 15), + decoration: BoxDecoration( + gradient: LinearGradient( + colors: [Colors.blue, Colors.green], + ), + borderRadius: BorderRadius.circular(7), + ), + child: Text( + 'Send Code', + textAlign: TextAlign.center, + style: TextStyle(color: Colors.white), + ), + ), + ), + Spacer(), + ], + ), + SizedBox(height: 10), + ], + ), + ) + : ConnectionErrorBox(), + selector: (_, connectivity) => connectivity.conStatus, + ), ), ); } diff --git a/lib/providers/auth.dart b/lib/providers/auth.dart index 3264043..8ca040b 100644 --- a/lib/providers/auth.dart +++ b/lib/providers/auth.dart @@ -1,12 +1,13 @@ import 'dart:convert'; import 'dart:io'; -import 'package:cssd/config/user.dart'; import 'package:flutter/material.dart'; -import 'package:cssd/config/urls.dart'; import 'package:http/http.dart' as http; import 'package:shared_preferences/shared_preferences.dart'; +import '../config/urls.dart'; +import '../config/user.dart'; + class Auth with ChangeNotifier { String _token; DateTime _expiaryDate; @@ -32,7 +33,7 @@ class Auth with ChangeNotifier { Future requestCode(String cellNumber) async { final response = await http.post( - Url.requestResetPass, + Uri.parse(Url.requestResetPass), body: { 'cell_number': cellNumber, }, @@ -49,7 +50,7 @@ class Auth with ChangeNotifier { Future sendCode(String code) async { final response = await http.post( - Url.verifyResetPass, + Uri.parse(Url.verifyResetPass), body: { 'code': code, }, @@ -74,7 +75,7 @@ class Auth with ChangeNotifier { print(token); final response = await http.post( - Url.sendResetPass, + Uri.parse(Url.sendResetPass), body: { 'password': password, 'password_confirmation': password, @@ -98,7 +99,7 @@ class Auth with ChangeNotifier { Future login(String cellNumber, String password) async { final response = await http.post( - Url.login, + Uri.parse(Url.login), body: { 'cell_number': cellNumber, 'password': password, @@ -160,7 +161,7 @@ class Auth with ChangeNotifier { Future> getUserData() async { final response = await http.get( - Url.getUserInfo, + Uri.parse(Url.getUserInfo), headers: {'Authorization': 'Bearer ' + token}, ); // print(response.body); @@ -188,7 +189,7 @@ class Auth with ChangeNotifier { Future setUserData(id, name, email) async { var response = await http.post( - 'https://cssd-doc.com/api/UpdateInfo', + Uri.parse('https://cssd-doc.com/api/UpdateInfo'), headers: { 'Authorization': 'Bearer ' + token, HttpHeaders.contentTypeHeader: 'application/json', diff --git a/lib/providers/cycles.dart b/lib/providers/cycles.dart index 3f9308c..abba973 100644 --- a/lib/providers/cycles.dart +++ b/lib/providers/cycles.dart @@ -1,8 +1,8 @@ import 'dart:convert'; -import 'package:cssd/config/urls.dart'; -import 'package:cssd/config/user.dart'; -import 'package:cssd/models/cycles_models.dart'; +import '../config/urls.dart'; +import '../config/user.dart'; +import '../models/cycles_models.dart'; import 'package:flutter/material.dart'; import 'package:http/http.dart' as http; @@ -61,7 +61,7 @@ class CyclesProvider extends ChangeNotifier { Future>> getHospitalsFilters() async { var response = await http.get( - Url.filterItems, + Uri.parse(Url.filterItems), headers: { 'Authorization': User.token, }, @@ -80,7 +80,7 @@ class CyclesProvider extends ChangeNotifier { Future> getLabelFilters() async { var response = await http.get( - Url.labelItems, + Uri.parse(Url.labelItems), headers: { 'Authorization': User.token, }, @@ -107,7 +107,7 @@ class CyclesProvider extends ChangeNotifier { labs.add({'name': '', 'id': label}); } // print(labs); - var response = await http.post(Url.createCycleResult, + var response = await http.post(Uri.parse(Url.createCycleResult), body: json.encode( { 'note': note, @@ -181,7 +181,7 @@ class CyclesProvider extends ChangeNotifier { } // print(url); var response = await http.get( - url, + Uri.parse(url), headers: { 'Authorization': User.token, }, @@ -214,7 +214,7 @@ class CyclesProvider extends ChangeNotifier { } Future showCycleResult(String id) async { - var response = await http.get(Url.getCycleResult(id), headers: { + var response = await http.get(Uri.parse(Url.getCycleResult(id)), headers: { 'Authorization': User.token, }); if (response.statusCode != 200) { diff --git a/lib/providers/input.dart b/lib/providers/input.dart index cee0360..67befe1 100644 --- a/lib/providers/input.dart +++ b/lib/providers/input.dart @@ -2,8 +2,9 @@ import 'dart:convert'; import 'package:flutter/material.dart'; import 'package:http/http.dart' as http; -import 'package:cssd/config/urls.dart'; -import 'package:cssd/config/user.dart'; + +import '../config/urls.dart'; +import '../config/user.dart'; class Inputs with ChangeNotifier { List> inputItems = []; @@ -22,7 +23,7 @@ class Inputs with ChangeNotifier { // }, // ); var response = await http.post( - Url.getInputs, + Uri.parse(Url.getInputs), body: { 'test_type_id': testTypeId, 'test_result_id': testResultId, @@ -47,7 +48,7 @@ class Inputs with ChangeNotifier { // } Map values; if (testResultId.isNotEmpty) { - response = await http.get(Url.testResultFormValues(testResultId), + response = await http.get(Uri.parse(Url.testResultFormValues(testResultId)), headers: {'Authorization': User.token}); values = json.decode(response.body)['data']; } diff --git a/lib/providers/labels.dart b/lib/providers/labels.dart index f71df06..fb91ac7 100644 --- a/lib/providers/labels.dart +++ b/lib/providers/labels.dart @@ -1,8 +1,8 @@ import 'dart:convert'; -import 'package:cssd/config/urls.dart'; -import 'package:cssd/config/user.dart'; -import 'package:cssd/models/label_models.dart'; +import '../config/urls.dart'; +import '../config/user.dart'; +import '../models/label_models.dart'; import 'package:flutter/material.dart'; import 'package:http/http.dart' as http; @@ -34,7 +34,7 @@ class LabelsProvider extends ChangeNotifier { Future>> getHospitalsFilters() async { var response = await http.get( - Url.filterItems, + Uri.parse(Url.filterItems), headers: { 'Authorization': User.token, }, @@ -53,7 +53,7 @@ class LabelsProvider extends ChangeNotifier { Future>> getPackageFilters() async { var response = await http.get( - Url.packageItems, + Uri.parse(Url.packageItems), headers: { 'Authorization': User.token, }, @@ -77,7 +77,7 @@ class LabelsProvider extends ChangeNotifier { Future createLabelResult(lotNumber, cycleNumber, sterileDate, package, expireDate, sterilizerId) async { // print(labs); - var response = await http.post(Url.createLabelResult, + var response = await http.post(Uri.parse(Url.createLabelResult), body: json.encode( { 'sterile_date': sterileDate, @@ -112,7 +112,7 @@ class LabelsProvider extends ChangeNotifier { sterilizerId, ) async { // print(labs); - var response = await http.put(Url.updateLabelResult(id), + var response = await http.put(Uri.parse(Url.updateLabelResult(id)), body: json.encode( { 'sterile_date': sterileDate, @@ -187,7 +187,7 @@ class LabelsProvider extends ChangeNotifier { } var response = await http.get( - url, + Uri.parse(url), headers: { 'Authorization': User.token, }, @@ -216,7 +216,7 @@ class LabelsProvider extends ChangeNotifier { Future showLabelResult(String id) async { var response = await http.get( - Url.getLabelResult(id), + Uri.parse(Url.getLabelResult(id)), headers: { 'Authorization': User.token, }, diff --git a/lib/providers/my_info.dart b/lib/providers/my_info.dart index 2af2117..979e6e5 100644 --- a/lib/providers/my_info.dart +++ b/lib/providers/my_info.dart @@ -1,6 +1,6 @@ import 'dart:convert'; import 'package:http/http.dart' as http; -import 'package:cssd/config/urls.dart'; +import '../config/urls.dart'; import 'package:flutter/material.dart'; import 'package:shared_preferences/shared_preferences.dart'; @@ -28,7 +28,7 @@ class MyInfoProvider extends ChangeNotifier { final auth = json.decode(prefs.getString('auth')) as Map; _token = auth['token']; final response = await http.get( - Url.getUserInfo, + Uri.parse(Url.getUserInfo), headers: { 'Authorization': 'Bearer ' + _token, }, diff --git a/lib/providers/test_result_old.dart b/lib/providers/test_result_old.dart index 363630a..7be764c 100644 --- a/lib/providers/test_result_old.dart +++ b/lib/providers/test_result_old.dart @@ -1,5 +1,5 @@ -import 'package:cssd/config/urls.dart'; -import 'package:cssd/config/user.dart'; +import '../config/urls.dart'; +import '../config/user.dart'; import 'package:flutter/material.dart'; import 'package:http/http.dart' as http; @@ -24,7 +24,7 @@ class TestResult with ChangeNotifier{ Future toggleVerify() async { final response = await http.post( - Url.verifyTest(id), headers: { + Uri.parse(Url.verifyTest(id)), headers: { 'Authorization': User.token } ); diff --git a/lib/providers/test_results.dart b/lib/providers/test_results.dart index 1340d28..d4bd42a 100644 --- a/lib/providers/test_results.dart +++ b/lib/providers/test_results.dart @@ -1,5 +1,4 @@ import 'dart:convert'; -import 'dart:io'; import 'dart:typed_data'; // import 'dart:typed_data'; import 'package:dio/dio.dart' as di; @@ -7,6 +6,7 @@ import 'package:dio/dio.dart' as di; import 'package:cssd/config/urls.dart'; import 'package:cssd/config/user.dart'; import 'package:cssd/models/test_result_models.dart'; +import 'package:file_picker/file_picker.dart'; // import 'package:cssd/providers/test_result.dart'; import 'package:flutter/material.dart'; import 'package:http/http.dart' as http; @@ -14,13 +14,13 @@ import 'package:random_string/random_string.dart'; // import 'package:multi_image_picker/multi_image_picker.dart'; class TestResultsProvider with ChangeNotifier { - List catchImages = []; + List catchImages = []; List images = []; setImages() async { images = []; for (var image in catchImages) { - var result = image.readAsBytesSync(); + var result = image.bytes; // final batchId = randomString(10); // addImage(batchId, result, image.path); images.add(result.buffer @@ -29,7 +29,7 @@ class TestResultsProvider with ChangeNotifier { notifyListeners(); } - setCatchImages(List images) { + setCatchImages(List images) { catchImages = images; notifyListeners(); } @@ -136,7 +136,7 @@ class TestResultsProvider with ChangeNotifier { Future>> getFilterItems() async { var response = await http.get( - Url.filterItems, + Uri.parse(Url.filterItems), headers: { 'Authorization': User.token, }, @@ -187,7 +187,7 @@ class TestResultsProvider with ChangeNotifier { } //'device_id=3526&testType_id=107&medicalCenter_id=2&user_name=erfan&fromPicker=2020-05-12&upToPicker=2020-05-19&device_label=Instrument%20ID&page=1' var response = await http.get( - url, + Uri.parse(url), headers: { 'Authorization': User.token, // 'X-Requested-With': 'XMLHttpRequest', @@ -221,7 +221,7 @@ class TestResultsProvider with ChangeNotifier { static Future updateTestResult(String id, values) async { var response = await http.post( - Url.updateTestResult(id), + Uri.parse(Url.updateTestResult(id)), body: json.encode(values), headers: { 'Authorization': User.token, @@ -262,7 +262,7 @@ class TestResultsProvider with ChangeNotifier { final batchId = randomString(10); for (var image in catchImages) { - await addImage(batchId, image.readAsBytesSync(), image.path); + await addImage(batchId, image.bytes, image.path); } dynamic vals = values; vals['file_batch_id'] = batchId; @@ -305,7 +305,7 @@ class TestResultsProvider with ChangeNotifier { } Future> showTestResult(String id) async { - var response = await http.get(Url.getTestResult(id), headers: { + var response = await http.get(Uri.parse(Url.getTestResult(id)), headers: { 'Authorization': User.token, }); @@ -333,7 +333,7 @@ class TestResultsProvider with ChangeNotifier { } Future removeTestResult(String id) async { - var response = await http.post(Url.removeTestResult(id), body: { + var response = await http.post(Uri.parse(Url.removeTestResult(id)), body: { '_method': 'delete' }, headers: { 'Authorization': User.token, @@ -353,7 +353,7 @@ class TestResultsProvider with ChangeNotifier { print(id); print(value); var response = await http.post( - Url.testResultVerification(id, value), + Uri.parse(Url.testResultVerification(id, value)), headers: { 'Authorization': User.token, 'X-Requested-With': 'XMLHttpRequest', diff --git a/lib/widgets/CycleScreens/Add/add_label_box.dart b/lib/widgets/CycleScreens/Add/add_label_box.dart index fd577f0..d4ff237 100644 --- a/lib/widgets/CycleScreens/Add/add_label_box.dart +++ b/lib/widgets/CycleScreens/Add/add_label_box.dart @@ -1,9 +1,10 @@ -import 'package:barcode_scan/barcode_scan.dart'; +import 'package:barcode_scan2/barcode_scan2.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; import 'package:font_awesome_flutter/font_awesome_flutter.dart'; import 'package:provider/provider.dart'; -import 'package:cssd/providers/cycles.dart'; + +import '../../../providers/cycles.dart'; class CycleAddLabelBox extends StatelessWidget { const CycleAddLabelBox({ diff --git a/lib/widgets/CycleScreens/Add/save_button.dart b/lib/widgets/CycleScreens/Add/save_button.dart index 8a770da..60a5c72 100644 --- a/lib/widgets/CycleScreens/Add/save_button.dart +++ b/lib/widgets/CycleScreens/Add/save_button.dart @@ -1,7 +1,8 @@ -import 'package:cssd/config/routes.dart'; import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; -import 'package:cssd/providers/cycles.dart'; + +import '../../../config/routes.dart'; +import '../../../providers/cycles.dart'; class CycleAddSaveButton extends StatelessWidget { const CycleAddSaveButton({ @@ -49,7 +50,7 @@ class CycleAddSaveButton extends StatelessWidget { builder: (ctx) => AlertDialog( content: Text('Cycle added.'), actions: [ - FlatButton( + TextButton( onPressed: () { Navigator.of(ctx).pop(); }, diff --git a/lib/widgets/CycleScreens/Filter/save_button.dart b/lib/widgets/CycleScreens/Filter/save_button.dart index 8b92064..c6bb674 100644 --- a/lib/widgets/CycleScreens/Filter/save_button.dart +++ b/lib/widgets/CycleScreens/Filter/save_button.dart @@ -1,7 +1,8 @@ -import 'package:cssd/config/routes.dart'; import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; -import 'package:cssd/providers/cycles.dart'; + +import '../../../config/routes.dart'; +import '../../../providers/cycles.dart'; class CycleFilterSaveButton extends StatelessWidget { const CycleFilterSaveButton({ @@ -48,7 +49,7 @@ class CycleFilterSaveButton extends StatelessWidget { builder: (ctx) => AlertDialog( content: Text('Filters changed.'), actions: [ - FlatButton( + TextButton( onPressed: () { Navigator.of(ctx).pop(); }, diff --git a/lib/widgets/CycleScreens/Result/banner.dart b/lib/widgets/CycleScreens/Result/banner.dart index 33a545a..2a9d3c1 100644 --- a/lib/widgets/CycleScreens/Result/banner.dart +++ b/lib/widgets/CycleScreens/Result/banner.dart @@ -1,7 +1,8 @@ -import 'package:cssd/config/routes.dart'; import 'package:flutter/material.dart'; import 'package:font_awesome_flutter/font_awesome_flutter.dart'; +import '../../../config/routes.dart'; + class CycleResultBanner extends StatelessWidget { const CycleResultBanner({ Key key, diff --git a/lib/widgets/CycleScreens/Result/data_box.dart b/lib/widgets/CycleScreens/Result/data_box.dart index 6da86ee..8bc3f0f 100644 --- a/lib/widgets/CycleScreens/Result/data_box.dart +++ b/lib/widgets/CycleScreens/Result/data_box.dart @@ -1,9 +1,10 @@ -import 'package:cssd/config/routes.dart'; -import 'package:cssd/models/cycles_models.dart'; import 'package:flutter/material.dart'; import 'package:font_awesome_flutter/font_awesome_flutter.dart'; import 'package:intl/intl.dart'; +import '../../../config/routes.dart'; +import '../../../models/cycles_models.dart'; + class CycleItemBox extends StatelessWidget { final CycleResultObject item; final String labels; diff --git a/lib/widgets/CycleScreens/Result/filter_objects.dart b/lib/widgets/CycleScreens/Result/filter_objects.dart index 8c50518..76c3d9c 100644 --- a/lib/widgets/CycleScreens/Result/filter_objects.dart +++ b/lib/widgets/CycleScreens/Result/filter_objects.dart @@ -1,8 +1,9 @@ -import 'package:cssd/config/routes.dart'; import 'package:flutter/material.dart'; import 'package:font_awesome_flutter/font_awesome_flutter.dart'; import 'package:provider/provider.dart'; -import 'package:cssd/providers/cycles.dart'; + +import '../../../config/routes.dart'; +import '../../../providers/cycles.dart'; class CycleFilterBaner extends StatelessWidget { const CycleFilterBaner({ diff --git a/lib/widgets/CycleScreens/Result/search_box.dart b/lib/widgets/CycleScreens/Result/search_box.dart index e5f07e4..98159b5 100644 --- a/lib/widgets/CycleScreens/Result/search_box.dart +++ b/lib/widgets/CycleScreens/Result/search_box.dart @@ -1,7 +1,8 @@ import 'package:flutter/material.dart'; import 'package:font_awesome_flutter/font_awesome_flutter.dart'; import 'package:provider/provider.dart'; -import 'package:cssd/providers/cycles.dart'; + +import '../../../providers/cycles.dart'; class CycleResultSearchBox extends StatelessWidget { const CycleResultSearchBox({ Key key, diff --git a/lib/widgets/Global/drawer.dart b/lib/widgets/Global/drawer.dart index 1763aaf..574209a 100644 --- a/lib/widgets/Global/drawer.dart +++ b/lib/widgets/Global/drawer.dart @@ -1,8 +1,9 @@ -import 'package:cssd/config/routes.dart'; // import 'package:cssd/pages/test_result_screen.dart'; import 'package:flutter/material.dart'; import 'package:font_awesome_flutter/font_awesome_flutter.dart'; +import '../../config/routes.dart'; + class AppDrawer extends StatelessWidget { @override Widget build(BuildContext context) { diff --git a/lib/widgets/LabelScreens/Add/save_button.dart b/lib/widgets/LabelScreens/Add/save_button.dart index 3bef135..002a869 100644 --- a/lib/widgets/LabelScreens/Add/save_button.dart +++ b/lib/widgets/LabelScreens/Add/save_button.dart @@ -1,7 +1,8 @@ -import 'package:cssd/config/routes.dart'; import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; -import 'package:cssd/providers/labels.dart'; + +import '../../../config/routes.dart'; +import '../../../providers/labels.dart'; class LabelAddSaveButton extends StatelessWidget { const LabelAddSaveButton({ @@ -49,7 +50,7 @@ class LabelAddSaveButton extends StatelessWidget { builder: (ctx) => AlertDialog( content: Text('Label added.'), actions: [ - FlatButton( + TextButton( onPressed: () { Navigator.of(ctx).pop(); }, diff --git a/lib/widgets/LabelScreens/Add/update_button.dart b/lib/widgets/LabelScreens/Add/update_button.dart index 77641b6..ea67a90 100644 --- a/lib/widgets/LabelScreens/Add/update_button.dart +++ b/lib/widgets/LabelScreens/Add/update_button.dart @@ -1,7 +1,7 @@ -import 'package:cssd/config/routes.dart'; +import '../../../config/routes.dart'; import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; -import 'package:cssd/providers/labels.dart'; +import '../../../providers/labels.dart'; class LabelUpdateButton extends StatelessWidget { const LabelUpdateButton({ @@ -52,7 +52,7 @@ class LabelUpdateButton extends StatelessWidget { builder: (ctx) => AlertDialog( content: Text('Label updated.'), actions: [ - FlatButton( + TextButton( onPressed: () { Navigator.of(ctx).pop(); }, diff --git a/lib/widgets/LabelScreens/Filter/save_button.dart b/lib/widgets/LabelScreens/Filter/save_button.dart index 13a9e30..2642d13 100644 --- a/lib/widgets/LabelScreens/Filter/save_button.dart +++ b/lib/widgets/LabelScreens/Filter/save_button.dart @@ -1,7 +1,8 @@ -import 'package:cssd/config/routes.dart'; import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; -import 'package:cssd/providers/labels.dart'; + +import '../../../config/routes.dart'; +import '../../../providers/labels.dart'; class LabelFilterSaveButton extends StatelessWidget { const LabelFilterSaveButton({ @@ -45,7 +46,7 @@ class LabelFilterSaveButton extends StatelessWidget { builder: (ctx) => AlertDialog( content: Text('Filters changed.'), actions: [ - FlatButton( + TextButton( onPressed: () { Navigator.of(ctx).pop(); }, diff --git a/lib/widgets/LabelScreens/Result/data_box.dart b/lib/widgets/LabelScreens/Result/data_box.dart index d2673cd..d30146e 100644 --- a/lib/widgets/LabelScreens/Result/data_box.dart +++ b/lib/widgets/LabelScreens/Result/data_box.dart @@ -1,8 +1,9 @@ -import 'package:cssd/config/routes.dart'; -import 'package:cssd/models/label_models.dart'; import 'package:flutter/material.dart'; import 'package:font_awesome_flutter/font_awesome_flutter.dart'; +import '../../../config/routes.dart'; +import '../../../models/label_models.dart'; + class LabelItemBox extends StatelessWidget { final LabelResultObject item; const LabelItemBox({ diff --git a/lib/widgets/LabelScreens/Result/filter_chip_box.dart b/lib/widgets/LabelScreens/Result/filter_chip_box.dart index 6f07b14..54180fd 100644 --- a/lib/widgets/LabelScreens/Result/filter_chip_box.dart +++ b/lib/widgets/LabelScreens/Result/filter_chip_box.dart @@ -1,5 +1,6 @@ import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; + import '../../../providers/labels.dart'; class LabelFilterChip extends StatelessWidget { const LabelFilterChip({ diff --git a/lib/widgets/LabelScreens/Result/floating_buttons.dart b/lib/widgets/LabelScreens/Result/floating_buttons.dart index a83c8f7..80f91dd 100644 --- a/lib/widgets/LabelScreens/Result/floating_buttons.dart +++ b/lib/widgets/LabelScreens/Result/floating_buttons.dart @@ -1,7 +1,8 @@ -import 'package:cssd/config/routes.dart'; import 'package:flutter/material.dart'; import 'package:font_awesome_flutter/font_awesome_flutter.dart'; +import '../../../config/routes.dart'; + class LabelFloatingButtons extends StatelessWidget { const LabelFloatingButtons({ Key key, diff --git a/lib/widgets/LabelScreens/Result/search_box.dart b/lib/widgets/LabelScreens/Result/search_box.dart index 582f8c0..aa6b271 100644 --- a/lib/widgets/LabelScreens/Result/search_box.dart +++ b/lib/widgets/LabelScreens/Result/search_box.dart @@ -1,6 +1,7 @@ import 'package:flutter/material.dart'; import 'package:font_awesome_flutter/font_awesome_flutter.dart'; import 'package:provider/provider.dart'; + import '../../../providers/labels.dart'; class LabelSearchBox extends StatelessWidget { diff --git a/lib/widgets/LabelScreens/Scan/scan_box.dart b/lib/widgets/LabelScreens/Scan/scan_box.dart index c5c50f5..51a5d53 100644 --- a/lib/widgets/LabelScreens/Scan/scan_box.dart +++ b/lib/widgets/LabelScreens/Scan/scan_box.dart @@ -1,4 +1,4 @@ -import 'package:barcode_scan/barcode_scan.dart'; +import 'package:barcode_scan2/barcode_scan2.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; import 'package:url_launcher/url_launcher.dart'; diff --git a/lib/widgets/TestResultScreens/Add/capture_image.dart b/lib/widgets/TestResultScreens/Add/capture_image.dart index 8c12365..877c82f 100644 --- a/lib/widgets/TestResultScreens/Add/capture_image.dart +++ b/lib/widgets/TestResultScreens/Add/capture_image.dart @@ -2,11 +2,13 @@ import 'dart:async'; import 'dart:io'; import 'package:camera/camera.dart'; -import 'package:cssd/providers/test_results.dart'; +import 'package:file_picker/file_picker.dart'; import 'package:flutter/material.dart'; import 'package:path_provider/path_provider.dart'; import 'package:provider/provider.dart'; +import '../../../providers/test_results.dart'; + class CaptureImage extends StatefulWidget { @override _CaptureImageState createState() { @@ -201,7 +203,7 @@ class _CaptureImageState extends State // } // } - // return Row(children: toggles); + // return Row(children: toggles); // } String timestamp() => DateTime.now().millisecondsSinceEpoch.toString(); @@ -247,8 +249,13 @@ class _CaptureImageState extends State imagePath = filePath; var profileProviderObject = Provider.of(context, listen: false); - List files = profileProviderObject.catchImages; - files.add(File(imagePath)); + List files = profileProviderObject.catchImages; + print(imagePath); + files.add(PlatformFile( + name: 'test', + size: 0, + path: imagePath, + bytes: File(imagePath).readAsBytesSync())); profileProviderObject.setCatchImages(files); profileProviderObject.setImages(); print(imagePath); diff --git a/lib/widgets/TestResultScreens/Add/form_creator.dart b/lib/widgets/TestResultScreens/Add/form_creator.dart index d045e78..5181356 100644 --- a/lib/widgets/TestResultScreens/Add/form_creator.dart +++ b/lib/widgets/TestResultScreens/Add/form_creator.dart @@ -1,7 +1,4 @@ -import 'dart:io'; - -import 'package:barcode_scan/barcode_scan.dart'; -import 'package:cssd/config/routes.dart'; +import 'package:barcode_scan2/barcode_scan2.dart'; import 'package:file_picker/file_picker.dart'; import 'package:flutter/material.dart'; import 'package:flutter/rendering.dart'; @@ -12,6 +9,7 @@ import 'package:meta/meta.dart'; import 'package:multiselect_formfield/multiselect_formfield.dart'; import 'package:provider/provider.dart'; +import '../../../config/routes.dart'; import '../../../providers/test_results.dart'; class FormCreator extends StatefulWidget { @@ -528,7 +526,7 @@ class _FormCreatorState extends State { Future captureImage(BuildContext context) async { var profileProviderObject = Provider.of(context, listen: false); - List files = profileProviderObject.catchImages; + List files = profileProviderObject.catchImages; try { files.add( await ImagePickerGC.pickImage( @@ -552,12 +550,17 @@ class _FormCreatorState extends State { Future loadAssets(BuildContext context) async { var profileProviderObject = Provider.of(context, listen: false); - List files = profileProviderObject.catchImages; + List files = profileProviderObject.catchImages; try { - files += await FilePicker.getMultiFile( + var datas = await FilePicker.platform.pickFiles( type: FileType.custom, allowedExtensions: ['jpg', 'png', 'bmp', 'jpeg', 'pdf', 'docx', 'doc'], + withData: true, + withReadStream: true, ); + files += datas.files; + // files += + // print(files); } catch (_) {} @@ -632,8 +635,9 @@ class ImageBox extends StatelessWidget { builder: (_) => Container( color: Colors.white, child: Center( - child: Image.file( - _testProvider.catchImages[index], + child: Image.memory( + _testProvider.catchImages[index].bytes, + fit: BoxFit.contain, ), ), ), @@ -653,12 +657,12 @@ class ImageBox extends StatelessWidget { height: 60, fit: BoxFit.fill, ) - : Image.file( - _testProvider.catchImages[index], + : Image.memory( + _testProvider.catchImages[index].bytes, // asset: _images[index], width: 60, height: 60, - fit: BoxFit.fill, + fit: BoxFit.contain, ), ), ), diff --git a/lib/widgets/TestResultScreens/Add/save_button.dart b/lib/widgets/TestResultScreens/Add/save_button.dart index 4a1dafc..ce0537e 100644 --- a/lib/widgets/TestResultScreens/Add/save_button.dart +++ b/lib/widgets/TestResultScreens/Add/save_button.dart @@ -1,6 +1,7 @@ -import 'package:cssd/config/routes.dart'; import 'package:flutter/material.dart'; +import '../../../config/routes.dart'; + class TestResultAddSaveButton extends StatelessWidget { const TestResultAddSaveButton({ Key key, diff --git a/lib/widgets/TestResultScreens/Main/add_button.dart b/lib/widgets/TestResultScreens/Main/add_button.dart index 2725781..150e83d 100644 --- a/lib/widgets/TestResultScreens/Main/add_button.dart +++ b/lib/widgets/TestResultScreens/Main/add_button.dart @@ -1,6 +1,7 @@ -import 'package:cssd/config/routes.dart'; import 'package:flutter/material.dart'; +import '../../../config/routes.dart'; + class TestResultAddButton extends StatelessWidget { const TestResultAddButton({ Key key, diff --git a/lib/widgets/TestResultScreens/Main/filter_chip_box.dart b/lib/widgets/TestResultScreens/Main/filter_chip_box.dart index d78c13d..864af12 100644 --- a/lib/widgets/TestResultScreens/Main/filter_chip_box.dart +++ b/lib/widgets/TestResultScreens/Main/filter_chip_box.dart @@ -1,5 +1,6 @@ import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; + import '../../../providers/test_results.dart'; class TestResultChip extends StatelessWidget { diff --git a/lib/widgets/TestResultScreens/Main/floating_button.dart b/lib/widgets/TestResultScreens/Main/floating_button.dart index e82b41f..968d5eb 100644 --- a/lib/widgets/TestResultScreens/Main/floating_button.dart +++ b/lib/widgets/TestResultScreens/Main/floating_button.dart @@ -1,7 +1,8 @@ -import 'package:cssd/config/routes.dart'; import 'package:flutter/material.dart'; import 'package:font_awesome_flutter/font_awesome_flutter.dart'; +import '../../../config/routes.dart'; + // class TestResultFloatingButton extends StatelessWidget { // const TestResultFloatingButton({ // Key key, diff --git a/lib/widgets/TestResultScreens/Main/search_box.dart b/lib/widgets/TestResultScreens/Main/search_box.dart index b1f0e5f..dba563c 100644 --- a/lib/widgets/TestResultScreens/Main/search_box.dart +++ b/lib/widgets/TestResultScreens/Main/search_box.dart @@ -1,6 +1,7 @@ import 'package:flutter/material.dart'; import 'package:font_awesome_flutter/font_awesome_flutter.dart'; import 'package:provider/provider.dart'; + import '../../../providers/test_results.dart'; class TestResultSearchBox extends StatelessWidget { diff --git a/pubspec.lock b/pubspec.lock index 60b3187..335d9be 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -21,21 +21,21 @@ packages: name: async url: "https://pub.dartlang.org" source: hosted - version: "2.5.0-nullsafety.1" - barcode_scan: + version: "2.6.1" + barcode_scan2: dependency: "direct main" description: - name: barcode_scan + name: barcode_scan2 url: "https://pub.dartlang.org" source: hosted - version: "3.0.0" + version: "4.1.3" boolean_selector: dependency: transitive description: name: boolean_selector url: "https://pub.dartlang.org" source: hosted - version: "2.1.0-nullsafety.1" + version: "2.1.0" camera: dependency: "direct main" description: @@ -49,49 +49,56 @@ packages: name: characters url: "https://pub.dartlang.org" source: hosted - version: "1.1.0-nullsafety.3" + version: "1.1.0" charcode: dependency: transitive description: name: charcode url: "https://pub.dartlang.org" source: hosted - version: "1.2.0-nullsafety.1" + version: "1.2.0" clock: dependency: transitive description: name: clock url: "https://pub.dartlang.org" source: hosted - version: "1.1.0-nullsafety.1" + version: "1.1.0" collection: dependency: transitive description: name: collection url: "https://pub.dartlang.org" source: hosted - version: "1.15.0-nullsafety.3" + version: "1.15.0" connectivity: dependency: "direct main" description: name: connectivity url: "https://pub.dartlang.org" source: hosted - version: "0.4.8+5" + version: "3.0.6" + connectivity_for_web: + dependency: transitive + description: + name: connectivity_for_web + url: "https://pub.dartlang.org" + source: hosted + version: "0.4.0" connectivity_macos: dependency: transitive description: name: connectivity_macos url: "https://pub.dartlang.org" source: hosted - version: "0.1.0+3" + version: "0.2.0" connectivity_platform_interface: dependency: transitive description: name: connectivity_platform_interface url: "https://pub.dartlang.org" source: hosted - version: "1.0.5" + version: "2.0.1" convert: dependency: transitive description: @@ -112,49 +119,56 @@ packages: name: cupertino_icons url: "https://pub.dartlang.org" source: hosted - version: "0.1.3" + version: "1.0.3" dio: dependency: "direct main" description: name: dio url: "https://pub.dartlang.org" source: hosted - version: "3.0.9" + version: "4.0.0" double_back_to_close_app: dependency: "direct main" description: name: double_back_to_close_app url: "https://pub.dartlang.org" source: hosted - version: "1.2.0" + version: "2.0.1" fake_async: dependency: transitive description: name: fake_async url: "https://pub.dartlang.org" source: hosted - version: "1.2.0-nullsafety.1" + version: "1.2.0" + ffi: + dependency: transitive + description: + name: ffi + url: "https://pub.dartlang.org" + source: hosted + version: "1.1.2" file: dependency: transitive description: name: file url: "https://pub.dartlang.org" source: hosted - version: "5.2.1" + version: "6.1.2" file_picker: dependency: "direct main" description: name: file_picker url: "https://pub.dartlang.org" source: hosted - version: "1.9.0+1" + version: "3.0.2+2" fixnum: dependency: transitive description: name: fixnum url: "https://pub.dartlang.org" source: hosted - version: "0.10.11" + version: "1.0.0" flutter: dependency: "direct main" description: flutter @@ -173,14 +187,14 @@ packages: name: flutter_phoenix url: "https://pub.dartlang.org" source: hosted - version: "0.1.0" + version: "1.0.0" flutter_plugin_android_lifecycle: dependency: transitive description: name: flutter_plugin_android_lifecycle url: "https://pub.dartlang.org" source: hosted - version: "1.0.8" + version: "2.0.2" flutter_test: dependency: "direct dev" description: flutter @@ -204,14 +218,14 @@ packages: name: http url: "https://pub.dartlang.org" source: hosted - version: "0.12.1" + version: "0.13.3" http_parser: dependency: transitive description: name: http_parser url: "https://pub.dartlang.org" source: hosted - version: "3.1.4" + version: "4.0.0" image: dependency: transitive description: @@ -225,21 +239,28 @@ packages: name: image_picker url: "https://pub.dartlang.org" source: hosted - version: "0.6.7+4" + version: "0.7.5+4" + image_picker_for_web: + dependency: transitive + description: + name: image_picker_for_web + url: "https://pub.dartlang.org" + source: hosted + version: "2.0.0" image_picker_gallery_camera: dependency: "direct main" description: name: image_picker_gallery_camera url: "https://pub.dartlang.org" source: hosted - version: "0.1.6" + version: "0.2.2" image_picker_platform_interface: dependency: transitive description: name: image_picker_platform_interface url: "https://pub.dartlang.org" source: hosted - version: "1.1.0" + version: "2.1.0" intl: dependency: "direct main" description: @@ -247,20 +268,27 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "0.16.1" + js: + dependency: transitive + description: + name: js + url: "https://pub.dartlang.org" + source: hosted + version: "0.6.3" matcher: dependency: transitive description: name: matcher url: "https://pub.dartlang.org" source: hosted - version: "0.12.10-nullsafety.1" + version: "0.12.10" meta: dependency: transitive description: name: meta url: "https://pub.dartlang.org" source: hosted - version: "1.3.0-nullsafety.3" + version: "1.3.0" multiselect_formfield: dependency: "direct main" description: @@ -268,48 +296,62 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "0.1.2" + nested: + dependency: transitive + description: + name: nested + url: "https://pub.dartlang.org" + source: hosted + version: "1.0.0" path: dependency: transitive description: name: path url: "https://pub.dartlang.org" source: hosted - version: "1.8.0-nullsafety.1" + version: "1.8.0" path_provider: dependency: "direct main" description: name: path_provider url: "https://pub.dartlang.org" source: hosted - version: "1.6.11" + version: "2.0.2" path_provider_linux: dependency: transitive description: name: path_provider_linux url: "https://pub.dartlang.org" source: hosted - version: "0.0.1+2" + version: "2.0.0" path_provider_macos: dependency: transitive description: name: path_provider_macos url: "https://pub.dartlang.org" source: hosted - version: "0.0.4+3" + version: "2.0.0" path_provider_platform_interface: dependency: transitive description: name: path_provider_platform_interface url: "https://pub.dartlang.org" source: hosted - version: "1.0.2" + version: "2.0.1" + path_provider_windows: + dependency: transitive + description: + name: path_provider_windows + url: "https://pub.dartlang.org" + source: hosted + version: "2.0.1" pedantic: dependency: transitive description: name: pedantic url: "https://pub.dartlang.org" source: hosted - version: "1.8.0+1" + version: "1.11.1" petitparser: dependency: transitive description: @@ -323,49 +365,35 @@ packages: name: platform url: "https://pub.dartlang.org" source: hosted - version: "2.2.1" - platform_detect: - dependency: transitive - description: - name: platform_detect - url: "https://pub.dartlang.org" - source: hosted - version: "1.4.0" + version: "3.0.0" plugin_platform_interface: dependency: transitive description: name: plugin_platform_interface url: "https://pub.dartlang.org" source: hosted - version: "1.0.2" + version: "2.0.0" process: dependency: transitive description: name: process url: "https://pub.dartlang.org" source: hosted - version: "3.0.13" + version: "4.2.1" protobuf: dependency: transitive description: name: protobuf url: "https://pub.dartlang.org" source: hosted - version: "1.0.1" + version: "2.0.0" provider: dependency: "direct main" description: name: provider url: "https://pub.dartlang.org" source: hosted - version: "3.2.0" - pub_semver: - dependency: transitive - description: - name: pub_semver - url: "https://pub.dartlang.org" - source: hosted - version: "1.4.4" + version: "5.0.0" random_string: dependency: "direct main" description: @@ -379,28 +407,42 @@ packages: name: shared_preferences url: "https://pub.dartlang.org" source: hosted - version: "0.5.7" + version: "2.0.6" + shared_preferences_linux: + dependency: transitive + description: + name: shared_preferences_linux + url: "https://pub.dartlang.org" + source: hosted + version: "2.0.0" shared_preferences_macos: dependency: transitive description: name: shared_preferences_macos url: "https://pub.dartlang.org" source: hosted - version: "0.0.1+7" + version: "2.0.0" shared_preferences_platform_interface: dependency: transitive description: name: shared_preferences_platform_interface url: "https://pub.dartlang.org" source: hosted - version: "1.0.3" + version: "2.0.0" shared_preferences_web: dependency: transitive description: name: shared_preferences_web url: "https://pub.dartlang.org" source: hosted - version: "0.1.2+4" + version: "2.0.0" + shared_preferences_windows: + dependency: transitive + description: + name: shared_preferences_windows + url: "https://pub.dartlang.org" + source: hosted + version: "2.0.0" sky_engine: dependency: transitive description: flutter @@ -412,112 +454,112 @@ packages: name: source_span url: "https://pub.dartlang.org" source: hosted - version: "1.8.0-nullsafety.2" + version: "1.8.1" stack_trace: dependency: transitive description: name: stack_trace url: "https://pub.dartlang.org" source: hosted - version: "1.10.0-nullsafety.1" + version: "1.10.0" stream_channel: dependency: transitive description: name: stream_channel url: "https://pub.dartlang.org" source: hosted - version: "2.1.0-nullsafety.1" + version: "2.1.0" string_scanner: dependency: transitive description: name: string_scanner url: "https://pub.dartlang.org" source: hosted - version: "1.1.0-nullsafety.1" + version: "1.1.0" term_glyph: dependency: transitive description: name: term_glyph url: "https://pub.dartlang.org" source: hosted - version: "1.2.0-nullsafety.1" + version: "1.2.0" test_api: dependency: transitive description: name: test_api url: "https://pub.dartlang.org" source: hosted - version: "0.2.19-nullsafety.2" + version: "0.3.0" typed_data: dependency: transitive description: name: typed_data url: "https://pub.dartlang.org" source: hosted - version: "1.3.0-nullsafety.3" + version: "1.3.0" url_launcher: dependency: "direct main" description: name: url_launcher url: "https://pub.dartlang.org" source: hosted - version: "5.4.10" + version: "6.0.6" + url_launcher_linux: + dependency: transitive + description: + name: url_launcher_linux + url: "https://pub.dartlang.org" + source: hosted + version: "2.0.0" url_launcher_macos: dependency: transitive description: name: url_launcher_macos url: "https://pub.dartlang.org" source: hosted - version: "0.0.1+7" + version: "2.0.0" url_launcher_platform_interface: dependency: transitive description: name: url_launcher_platform_interface url: "https://pub.dartlang.org" source: hosted - version: "1.0.7" + version: "2.0.3" url_launcher_web: dependency: transitive description: name: url_launcher_web url: "https://pub.dartlang.org" source: hosted - version: "0.1.1+6" + version: "2.0.1" + url_launcher_windows: + dependency: transitive + description: + name: url_launcher_windows + url: "https://pub.dartlang.org" + source: hosted + version: "2.0.0" vector_math: dependency: transitive description: name: vector_math url: "https://pub.dartlang.org" source: hosted - version: "2.1.0-nullsafety.3" - video_player: - dependency: "direct main" - description: - name: video_player - url: "https://pub.dartlang.org" - source: hosted - version: "0.10.11+2" - video_player_platform_interface: + version: "2.1.0" + win32: dependency: transitive description: - name: video_player_platform_interface + name: win32 url: "https://pub.dartlang.org" source: hosted - version: "2.0.2" - video_player_web: - dependency: transitive - description: - name: video_player_web - url: "https://pub.dartlang.org" - source: hosted - version: "0.1.3+2" + version: "2.2.1" xdg_directories: dependency: transitive description: name: xdg_directories url: "https://pub.dartlang.org" source: hosted - version: "0.1.0" + version: "0.2.0" xml: dependency: transitive description: @@ -533,5 +575,5 @@ packages: source: hosted version: "2.2.1" sdks: - dart: ">=2.10.0-110 <2.11.0" - flutter: ">=1.12.13+hotfix.5 <2.0.0" + dart: ">=2.13.0 <3.0.0" + flutter: ">=2.0.0" diff --git a/pubspec.yaml b/pubspec.yaml index ca43672..35e1b9b 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -11,33 +11,33 @@ description: A new Flutter project. # In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion. # Read more about iOS versioning at # https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html -version: 1.7.0+6 +version: 1.7.1+7 environment: - sdk: ">=2.2.2 <3.0.0" + sdk: ">=2.7.0 <3.0.0" dependencies: flutter: sdk: flutter - barcode_scan: ^3.0.0 + barcode_scan2: ^4.1.3 camera: ^0.5.8+2 - connectivity: ^0.4.8+5 - cupertino_icons: ^0.1.2 - dio: ^3.0.9 - double_back_to_close_app: ^1.2.0 - file_picker: ^1.9.0+1 - flutter_phoenix: ^0.1.0 + connectivity: ^3.0.6 + cupertino_icons: ^1.0.3 + dio: ^4.0.0 + double_back_to_close_app: ^2.0.1 + file_picker: ^3.0.2+2 + flutter_phoenix: ^1.0.0 font_awesome_flutter: ^8.8.1 - http: ^0.12.0+3 - image_picker_gallery_camera: ^0.1.6 + http: ^0.13.3 + image_picker_gallery_camera: ^0.2.2 intl: ^0.16.1 multiselect_formfield: ^0.1.2 - path_provider: ^1.6.11 - provider: ^3.2.0 + path_provider: ^2.0.2 + provider: ^5.0.0 random_string: ^2.0.1 - shared_preferences: ^0.5.6 - url_launcher: ^5.4.10 - video_player: ^0.10.11+2 + shared_preferences: ^2.0.6 + url_launcher: ^6.0.6 + # video_player: ^0.10.11+2 dev_dependencies: flutter_test: