mirror of
https://git.meshkee.com/applications/cssd.git
synced 2026-10-12 05:08:56 +03:30
3.2.2
This commit is contained in:
@@ -1,282 +1,282 @@
|
||||
import 'package:cssd/models/cycles_models.dart';
|
||||
import 'package:cssd/providers/cycles.dart';
|
||||
import 'package:cssd/widgets/CycleScreens/Add/cycle_update_button.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
||||
import 'package:intl/intl.dart' as DateEditor;
|
||||
import 'package:provider/provider.dart';
|
||||
import '../../config/routes.dart';
|
||||
import '../../providers/connectivity.dart';
|
||||
import '../../widgets/Global/internet_error.dart';
|
||||
import '../../widgets/LabelScreens/Add/date_picker.dart';
|
||||
// import 'package:cssd/models/cycles_models.dart';
|
||||
// import 'package:cssd/providers/cycles.dart';
|
||||
// import 'package:cssd/widgets/CycleScreens/Add/cycle_update_button.dart';
|
||||
// import 'package:flutter/material.dart';
|
||||
// import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
||||
// import 'package:intl/intl.dart' as DateEditor;
|
||||
// import 'package:provider/provider.dart';
|
||||
// import '../../config/routes.dart';
|
||||
// import '../../providers/connectivity.dart';
|
||||
// import '../../widgets/Global/internet_error.dart';
|
||||
// import '../../widgets/LabelScreens/Add/date_picker.dart';
|
||||
|
||||
class CycleUpdateScreen extends StatefulWidget {
|
||||
@override
|
||||
_CycleUpdateScreenState createState() => _CycleUpdateScreenState();
|
||||
}
|
||||
// class CycleUpdateScreen extends StatefulWidget {
|
||||
// @override
|
||||
// _CycleUpdateScreenState createState() => _CycleUpdateScreenState();
|
||||
// }
|
||||
|
||||
class _CycleUpdateScreenState extends State<CycleUpdateScreen> {
|
||||
final _cycleNumberFocusNode = FocusNode();
|
||||
final _descriptionFocusNode = FocusNode();
|
||||
TextEditingController cycleNumberCTRL = new TextEditingController();
|
||||
TextEditingController sterilizerIdCTRL = new TextEditingController();
|
||||
TextEditingController descriptionCTRL = new TextEditingController();
|
||||
TextEditingController dateCTRL = new TextEditingController();
|
||||
TextEditingController labelCTRL = new TextEditingController();
|
||||
// class _CycleUpdateScreenState extends State<CycleUpdateScreen> {
|
||||
// final _cycleNumberFocusNode = FocusNode();
|
||||
// final _descriptionFocusNode = FocusNode();
|
||||
// TextEditingController cycleNumberCTRL = new TextEditingController();
|
||||
// TextEditingController sterilizerIdCTRL = new TextEditingController();
|
||||
// TextEditingController descriptionCTRL = new TextEditingController();
|
||||
// TextEditingController dateCTRL = new TextEditingController();
|
||||
// TextEditingController labelCTRL = new TextEditingController();
|
||||
|
||||
final _form = GlobalKey<FormState>();
|
||||
// final _form = GlobalKey<FormState>();
|
||||
|
||||
// List<Map<String, String>> labelVals = [];
|
||||
// List<String> labelValue = [];
|
||||
bool isEmpty = false;
|
||||
bool isInit = true;
|
||||
CycleDetailObject? datas;
|
||||
@override
|
||||
void initState() {
|
||||
dateCTRL.text = DateEditor.DateFormat('y-M-d').format(DateTime.now());
|
||||
super.initState();
|
||||
}
|
||||
// // List<Map<String, String>> labelVals = [];
|
||||
// // List<String> labelValue = [];
|
||||
// bool isEmpty = false;
|
||||
// bool isInit = true;
|
||||
// CycleDetailObject? datas;
|
||||
// @override
|
||||
// void initState() {
|
||||
// dateCTRL.text = DateEditor.DateFormat('y-M-d').format(DateTime.now());
|
||||
// super.initState();
|
||||
// }
|
||||
|
||||
@override
|
||||
void didChangeDependencies() async {
|
||||
if (isInit) {
|
||||
var _id = ModalRoute.of(context)!.settings.arguments;
|
||||
await Provider.of<CyclesProvider>(context, listen: false)
|
||||
.showCycleResult(_id.toString())
|
||||
.then(
|
||||
(result) {
|
||||
setState(
|
||||
() {
|
||||
datas = result;
|
||||
cycleNumberCTRL.text = datas!.cycleNumber;
|
||||
sterilizerIdCTRL.text = datas!.sterileId;
|
||||
descriptionCTRL.text = datas!.description;
|
||||
dateCTRL.text = datas!.date;
|
||||
// for (var label in datas!.labels) {
|
||||
// labelCTRL.text = label;
|
||||
// }
|
||||
},
|
||||
);
|
||||
},
|
||||
);
|
||||
await Provider.of<CyclesProvider>(context, listen: false)
|
||||
.getLabelFilters()
|
||||
.then(
|
||||
(result) {
|
||||
setState(
|
||||
() {
|
||||
// labelVals = result;
|
||||
isInit = false;
|
||||
},
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
super.didChangeDependencies();
|
||||
}
|
||||
// @override
|
||||
// void didChangeDependencies() async {
|
||||
// if (isInit) {
|
||||
// var _id = ModalRoute.of(context)!.settings.arguments;
|
||||
// await Provider.of<CyclesProvider>(context, listen: false)
|
||||
// .showCycleResult(_id.toString())
|
||||
// .then(
|
||||
// (result) {
|
||||
// setState(
|
||||
// () {
|
||||
// datas = result;
|
||||
// cycleNumberCTRL.text = datas!.cycleNumber;
|
||||
// sterilizerIdCTRL.text = datas!.sterileId;
|
||||
// descriptionCTRL.text = datas!.description;
|
||||
// dateCTRL.text = datas!.date;
|
||||
// // for (var label in datas!.labels) {
|
||||
// // labelCTRL.text = label;
|
||||
// // }
|
||||
// },
|
||||
// );
|
||||
// },
|
||||
// );
|
||||
// await Provider.of<CyclesProvider>(context, listen: false)
|
||||
// .getLabelFilters()
|
||||
// .then(
|
||||
// (result) {
|
||||
// setState(
|
||||
// () {
|
||||
// // labelVals = result;
|
||||
// isInit = false;
|
||||
// },
|
||||
// );
|
||||
// },
|
||||
// );
|
||||
// }
|
||||
// super.didChangeDependencies();
|
||||
// }
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final _media = MediaQuery.of(context);
|
||||
final double _devicewidth = _media.size.width;
|
||||
final double _deviceBlockSize = _devicewidth / 100;
|
||||
return WillPopScope(
|
||||
onWillPop: () async {
|
||||
Navigator.pushReplacementNamed(
|
||||
context,
|
||||
Routes.cycleResultScreen,
|
||||
);
|
||||
return true;
|
||||
},
|
||||
child: SafeArea(
|
||||
child: Scaffold(
|
||||
appBar: AppBar(
|
||||
titleSpacing: -10,
|
||||
backgroundColor: Colors.black,
|
||||
title: Text('Cycles', style: TextStyle(color: Colors.white,),),
|
||||
leading: IconButton(
|
||||
icon: Icon(
|
||||
Icons.keyboard_arrow_left,
|
||||
color: Colors.white,
|
||||
size: 35,
|
||||
),
|
||||
onPressed: () => Navigator.of(context)
|
||||
.pushReplacementNamed(Routes.cycleResultScreen),
|
||||
),
|
||||
),
|
||||
body: Consumer<ConnectivityProvider>(
|
||||
builder: (ct, connection, _) {
|
||||
return connection.conStatus != 'offline'
|
||||
? isInit
|
||||
? Center(
|
||||
child: CircularProgressIndicator(color: Colors.black),
|
||||
)
|
||||
: Form(
|
||||
key: _form,
|
||||
child: Padding(
|
||||
padding: EdgeInsets.all(20),
|
||||
child: ListView(
|
||||
children: <Widget>[
|
||||
Text(
|
||||
'Update 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: sterilizerIdCTRL,
|
||||
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,
|
||||
),
|
||||
),
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.w700,
|
||||
fontSize: 5 * _deviceBlockSize,
|
||||
),
|
||||
keyboardType: TextInputType.visiblePassword,
|
||||
textInputAction: TextInputAction.next,
|
||||
onFieldSubmitted: (_) {
|
||||
FocusScope.of(context)
|
||||
.requestFocus(_cycleNumberFocusNode);
|
||||
},
|
||||
),
|
||||
SizedBox(
|
||||
height: 20,
|
||||
),
|
||||
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.done,
|
||||
onFieldSubmitted: (_) {
|
||||
FocusScope.of(context)
|
||||
.requestFocus(_descriptionFocusNode);
|
||||
},
|
||||
),
|
||||
SizedBox(
|
||||
height: 20,
|
||||
),
|
||||
LabelAddDatePicker(
|
||||
dateCTRL: dateCTRL,
|
||||
deviceBlockSize: _deviceBlockSize,
|
||||
label: 'Date',
|
||||
),
|
||||
// SizedBox(
|
||||
// height: 20.0,
|
||||
// ),
|
||||
// Consumer<CyclesProvider>(
|
||||
// builder: (ctx, cycleProvider, _) =>
|
||||
// ListView.builder(
|
||||
// physics: NeverScrollableScrollPhysics(),
|
||||
// shrinkWrap: true,
|
||||
// itemBuilder: (ctx, index) => AddLabelBox(
|
||||
// text: 'Select Labels included',
|
||||
// iconColor: kPinkSub,
|
||||
// deviceBlockSize: _deviceBlockSize,
|
||||
// values: cycleProvider.labelValues[index],
|
||||
// vals: cycleProvider.labelVals,
|
||||
// initialLabelValue: labelCTRL.text,
|
||||
// index: index,
|
||||
// ),
|
||||
// itemCount: cycleProvider.labelValues.length,
|
||||
// ),
|
||||
// ),
|
||||
SizedBox(
|
||||
height: 20,
|
||||
),
|
||||
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: _descriptionFocusNode,
|
||||
minLines: 1,
|
||||
maxLines: 5,
|
||||
),
|
||||
SizedBox(
|
||||
height: 70,
|
||||
),
|
||||
CycleUpdateButton(
|
||||
form: _form,
|
||||
id: datas!.id,
|
||||
cycleNumberCTRL: cycleNumberCTRL,
|
||||
dateCTRL: dateCTRL,
|
||||
// labelValue: labelCTRL,
|
||||
striizerIdCTRL: sterilizerIdCTRL,
|
||||
deviceBlockSize: _deviceBlockSize,
|
||||
descriptionCTRL: descriptionCTRL,
|
||||
),
|
||||
SizedBox(
|
||||
height: 100,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
)
|
||||
: ConnectionErrorBox();
|
||||
},
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
// @override
|
||||
// Widget build(BuildContext context) {
|
||||
// final _media = MediaQuery.of(context);
|
||||
// final double _devicewidth = _media.size.width;
|
||||
// final double _deviceBlockSize = _devicewidth / 100;
|
||||
// return WillPopScope(
|
||||
// onWillPop: () async {
|
||||
// Navigator.pushReplacementNamed(
|
||||
// context,
|
||||
// Routes.cycleResultScreen,
|
||||
// );
|
||||
// return true;
|
||||
// },
|
||||
// child: SafeArea(
|
||||
// child: Scaffold(
|
||||
// appBar: AppBar(
|
||||
// titleSpacing: -10,
|
||||
// backgroundColor: Colors.black,
|
||||
// title: Text('Cycles', style: TextStyle(color: Colors.white,),),
|
||||
// leading: IconButton(
|
||||
// icon: Icon(
|
||||
// Icons.keyboard_arrow_left,
|
||||
// color: Colors.white,
|
||||
// size: 35,
|
||||
// ),
|
||||
// onPressed: () => Navigator.of(context)
|
||||
// .pushReplacementNamed(Routes.cycleResultScreen),
|
||||
// ),
|
||||
// ),
|
||||
// body: Consumer<ConnectivityProvider>(
|
||||
// builder: (ct, connection, _) {
|
||||
// return connection.conStatus != 'offline'
|
||||
// ? isInit
|
||||
// ? Center(
|
||||
// child: CircularProgressIndicator(color: Colors.black),
|
||||
// )
|
||||
// : Form(
|
||||
// key: _form,
|
||||
// child: Padding(
|
||||
// padding: EdgeInsets.all(20),
|
||||
// child: ListView(
|
||||
// children: <Widget>[
|
||||
// Text(
|
||||
// 'Update 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: sterilizerIdCTRL,
|
||||
// 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,
|
||||
// ),
|
||||
// ),
|
||||
// style: TextStyle(
|
||||
// fontWeight: FontWeight.w700,
|
||||
// fontSize: 5 * _deviceBlockSize,
|
||||
// ),
|
||||
// keyboardType: TextInputType.visiblePassword,
|
||||
// textInputAction: TextInputAction.next,
|
||||
// onFieldSubmitted: (_) {
|
||||
// FocusScope.of(context)
|
||||
// .requestFocus(_cycleNumberFocusNode);
|
||||
// },
|
||||
// ),
|
||||
// SizedBox(
|
||||
// height: 20,
|
||||
// ),
|
||||
// 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.done,
|
||||
// onFieldSubmitted: (_) {
|
||||
// FocusScope.of(context)
|
||||
// .requestFocus(_descriptionFocusNode);
|
||||
// },
|
||||
// ),
|
||||
// SizedBox(
|
||||
// height: 20,
|
||||
// ),
|
||||
// LabelAddDatePicker(
|
||||
// dateCTRL: dateCTRL,
|
||||
// deviceBlockSize: _deviceBlockSize,
|
||||
// label: 'Date',
|
||||
// ),
|
||||
// // SizedBox(
|
||||
// // height: 20.0,
|
||||
// // ),
|
||||
// // Consumer<CyclesProvider>(
|
||||
// // builder: (ctx, cycleProvider, _) =>
|
||||
// // ListView.builder(
|
||||
// // physics: NeverScrollableScrollPhysics(),
|
||||
// // shrinkWrap: true,
|
||||
// // itemBuilder: (ctx, index) => AddLabelBox(
|
||||
// // text: 'Select Labels included',
|
||||
// // iconColor: kPinkSub,
|
||||
// // deviceBlockSize: _deviceBlockSize,
|
||||
// // values: cycleProvider.labelValues[index],
|
||||
// // vals: cycleProvider.labelVals,
|
||||
// // initialLabelValue: labelCTRL.text,
|
||||
// // index: index,
|
||||
// // ),
|
||||
// // itemCount: cycleProvider.labelValues.length,
|
||||
// // ),
|
||||
// // ),
|
||||
// SizedBox(
|
||||
// height: 20,
|
||||
// ),
|
||||
// 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: _descriptionFocusNode,
|
||||
// minLines: 1,
|
||||
// maxLines: 5,
|
||||
// ),
|
||||
// SizedBox(
|
||||
// height: 70,
|
||||
// ),
|
||||
// CycleUpdateButton(
|
||||
// form: _form,
|
||||
// id: datas!.id,
|
||||
// cycleNumberCTRL: cycleNumberCTRL,
|
||||
// dateCTRL: dateCTRL,
|
||||
// // labelValue: labelCTRL,
|
||||
// striizerIdCTRL: sterilizerIdCTRL,
|
||||
// deviceBlockSize: _deviceBlockSize,
|
||||
// descriptionCTRL: descriptionCTRL,
|
||||
// ),
|
||||
// SizedBox(
|
||||
// height: 100,
|
||||
// ),
|
||||
// ],
|
||||
// ),
|
||||
// ),
|
||||
// )
|
||||
// : ConnectionErrorBox();
|
||||
// },
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
// );
|
||||
// }
|
||||
// }
|
||||
|
||||
@@ -1,7 +1,14 @@
|
||||
// ignore_for_file: unused_local_variable
|
||||
|
||||
import 'dart:isolate';
|
||||
import 'dart:ui';
|
||||
|
||||
import 'package:cssd/config/colors.dart';
|
||||
import 'package:cssd/providers/items.dart';
|
||||
import 'package:cssd/widgets/ItemScreens/Filter/item_filter_object.dart';
|
||||
import 'package:cssd/widgets/ItemScreens/Result/item_data_box.dart';
|
||||
import 'package:flutter_downloader/flutter_downloader.dart';
|
||||
import 'package:permission_handler/permission_handler.dart';
|
||||
|
||||
import '../../config/routes.dart';
|
||||
import '../../providers/connectivity.dart';
|
||||
@@ -25,11 +32,30 @@ class _ItemResultScreenState extends State<ItemResultScreen> {
|
||||
bool _isInit = true;
|
||||
ScrollController? sc;
|
||||
TextEditingController searchCTRL = new TextEditingController();
|
||||
ReceivePort _port = ReceivePort();
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
sc = new ScrollController();
|
||||
super.initState();
|
||||
IsolateNameServer.registerPortWithName(_port.sendPort, 'downloader_send_port');
|
||||
_port.listen((dynamic data) {
|
||||
String id = data[0];
|
||||
DownloadTaskStatus status = data[1];
|
||||
int progress = data[2];
|
||||
if (status == DownloadTaskStatus.complete) {
|
||||
print('Downloaded');
|
||||
}
|
||||
setState((){ });
|
||||
});
|
||||
|
||||
FlutterDownloader.registerCallback(downloadCallback);
|
||||
}
|
||||
|
||||
@pragma('vm:entry-point')
|
||||
static void downloadCallback(String id, int status, int progress) {
|
||||
final SendPort? send = IsolateNameServer.lookupPortByName('downloader_send_port');
|
||||
send!.send([id, status, progress]);
|
||||
}
|
||||
|
||||
@override
|
||||
@@ -58,6 +84,12 @@ class _ItemResultScreenState extends State<ItemResultScreen> {
|
||||
super.didChangeDependencies();
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
IsolateNameServer.removePortNameMapping('downloader_send_port');
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final _media = MediaQuery.of(context);
|
||||
@@ -252,27 +284,30 @@ class ItemResultFloatingButton extends StatelessWidget {
|
||||
return Row(
|
||||
mainAxisAlignment: MainAxisAlignment.end,
|
||||
children: <Widget>[
|
||||
// InkWell(
|
||||
// customBorder: CircleBorder(),
|
||||
// onTap: () {
|
||||
// Provider.of<ItemProvider>(context, listen: false).exportItems();
|
||||
// },
|
||||
// child: Container(
|
||||
// padding: EdgeInsets.all(_deviceBlockSize),
|
||||
// decoration: BoxDecoration(
|
||||
// shape: BoxShape.circle,
|
||||
// color: Colors.black,
|
||||
// ),
|
||||
// child: Icon(
|
||||
// Icons.import_export,
|
||||
// size: 10 * _deviceBlockSize,
|
||||
// color: Colors.white,
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
// SizedBox(
|
||||
// width: 2 * _deviceBlockSize,
|
||||
// ),
|
||||
InkWell(
|
||||
customBorder: CircleBorder(),
|
||||
onTap: () async {
|
||||
var status = await Permission.storage.request();
|
||||
if (status.isGranted) {
|
||||
Provider.of<ItemProvider>(context, listen: false).exportItems();
|
||||
}
|
||||
},
|
||||
child: Container(
|
||||
padding: EdgeInsets.all(_deviceBlockSize),
|
||||
decoration: BoxDecoration(
|
||||
shape: BoxShape.circle,
|
||||
color: Colors.black,
|
||||
),
|
||||
child: Icon(
|
||||
Icons.import_export,
|
||||
size: 10 * _deviceBlockSize,
|
||||
color: Colors.white,
|
||||
),
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
width: 2 * _deviceBlockSize,
|
||||
),
|
||||
InkWell(
|
||||
customBorder: CircleBorder(),
|
||||
onTap: () {
|
||||
|
||||
@@ -1,317 +1,317 @@
|
||||
import 'package:cssd/models/item_model.dart';
|
||||
import 'package:cssd/providers/items.dart';
|
||||
import 'package:cssd/widgets/ItemScreens/Add/item_update_button.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 '../../widgets/Global/internet_error.dart';
|
||||
// import 'package:cssd/models/item_model.dart';
|
||||
// import 'package:cssd/providers/items.dart';
|
||||
// import 'package:cssd/widgets/ItemScreens/Add/item_update_button.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 '../../widgets/Global/internet_error.dart';
|
||||
|
||||
class ItemUpdateScreen extends StatefulWidget {
|
||||
@override
|
||||
_ItemUpdateScreenState createState() => _ItemUpdateScreenState();
|
||||
}
|
||||
// class ItemUpdateScreen extends StatefulWidget {
|
||||
// @override
|
||||
// _ItemUpdateScreenState createState() => _ItemUpdateScreenState();
|
||||
// }
|
||||
|
||||
class _ItemUpdateScreenState extends State<ItemUpdateScreen> {
|
||||
final _itemSizeFocusNode = FocusNode();
|
||||
final _itemSpecificFocusNode = FocusNode();
|
||||
final _itemUdiFocusNode = FocusNode();
|
||||
final _descriptionFocusNode = FocusNode();
|
||||
TextEditingController descriptionCTRL = new TextEditingController();
|
||||
TextEditingController udiCTRL = new TextEditingController();
|
||||
TextEditingController nameCTRL = new TextEditingController();
|
||||
TextEditingController specificCTRL = new TextEditingController();
|
||||
TextEditingController sizeCTRL = new TextEditingController();
|
||||
TextEditingController dateCTRL = new TextEditingController();
|
||||
// class _ItemUpdateScreenState extends State<ItemUpdateScreen> {
|
||||
// final _itemSizeFocusNode = FocusNode();
|
||||
// final _itemSpecificFocusNode = FocusNode();
|
||||
// final _itemUdiFocusNode = FocusNode();
|
||||
// final _descriptionFocusNode = FocusNode();
|
||||
// TextEditingController descriptionCTRL = new TextEditingController();
|
||||
// TextEditingController udiCTRL = new TextEditingController();
|
||||
// TextEditingController nameCTRL = new TextEditingController();
|
||||
// TextEditingController specificCTRL = new TextEditingController();
|
||||
// TextEditingController sizeCTRL = new TextEditingController();
|
||||
// TextEditingController dateCTRL = new TextEditingController();
|
||||
|
||||
final _form = GlobalKey<FormState>();
|
||||
// final _form = GlobalKey<FormState>();
|
||||
|
||||
bool isEmpty = false;
|
||||
bool isInit = true;
|
||||
ItemDetailObject? datas;
|
||||
// bool isEmpty = false;
|
||||
// bool isInit = true;
|
||||
// ItemDetailObject? datas;
|
||||
|
||||
@override
|
||||
void didChangeDependencies() async {
|
||||
if (isInit) {
|
||||
var _id = ModalRoute.of(context)!.settings.arguments;
|
||||
await Provider.of<ItemProvider>(context, listen: false)
|
||||
.showItemResult(_id.toString())
|
||||
.then(
|
||||
(result) {
|
||||
setState(
|
||||
() {
|
||||
datas = result;
|
||||
nameCTRL.text = datas!.name;
|
||||
udiCTRL.text = datas!.udi;
|
||||
descriptionCTRL.text = datas!.description;
|
||||
sizeCTRL.text = datas!.size;
|
||||
specificCTRL.text = datas!.specific;
|
||||
},
|
||||
);
|
||||
},
|
||||
);
|
||||
await Provider.of<ItemProvider>(context, listen: false)
|
||||
.getItemResults()
|
||||
.then(
|
||||
(result) {
|
||||
setState(
|
||||
() {
|
||||
isInit = false;
|
||||
},
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
super.didChangeDependencies();
|
||||
}
|
||||
// @override
|
||||
// void didChangeDependencies() async {
|
||||
// if (isInit) {
|
||||
// var _id = ModalRoute.of(context)!.settings.arguments;
|
||||
// await Provider.of<ItemProvider>(context, listen: false)
|
||||
// .showItemResult(_id.toString())
|
||||
// .then(
|
||||
// (result) {
|
||||
// setState(
|
||||
// () {
|
||||
// datas = result;
|
||||
// nameCTRL.text = datas!.name;
|
||||
// udiCTRL.text = datas!.udi;
|
||||
// descriptionCTRL.text = datas!.description;
|
||||
// sizeCTRL.text = datas!.size;
|
||||
// specificCTRL.text = datas!.specific;
|
||||
// },
|
||||
// );
|
||||
// },
|
||||
// );
|
||||
// await Provider.of<ItemProvider>(context, listen: false)
|
||||
// .getItemResults()
|
||||
// .then(
|
||||
// (result) {
|
||||
// setState(
|
||||
// () {
|
||||
// isInit = false;
|
||||
// },
|
||||
// );
|
||||
// },
|
||||
// );
|
||||
// }
|
||||
// super.didChangeDependencies();
|
||||
// }
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final _media = MediaQuery.of(context);
|
||||
final double _devicewidth = _media.size.width;
|
||||
final double _deviceBlockSize = _devicewidth / 100;
|
||||
return WillPopScope(
|
||||
onWillPop: () async {
|
||||
Navigator.pushReplacementNamed(
|
||||
context,
|
||||
Routes.itemResultScreen,
|
||||
);
|
||||
return true;
|
||||
},
|
||||
child: SafeArea(
|
||||
child: Scaffold(
|
||||
appBar: AppBar(
|
||||
titleSpacing: -10,
|
||||
backgroundColor: Colors.black,
|
||||
title: Text('Items', style: TextStyle(color: Colors.white,),),
|
||||
leading: IconButton(
|
||||
icon: Icon(
|
||||
Icons.keyboard_arrow_left,
|
||||
color: Colors.white,
|
||||
size: 35,
|
||||
),
|
||||
onPressed: () => Navigator.of(context)
|
||||
.pushReplacementNamed(Routes.itemResultScreen),
|
||||
),
|
||||
),
|
||||
body: Consumer<ConnectivityProvider>(
|
||||
builder: (ct, connection, _) {
|
||||
return connection.conStatus != 'offline'
|
||||
? isInit
|
||||
? Center(
|
||||
child: CircularProgressIndicator(color: Colors.black),
|
||||
)
|
||||
: Form(
|
||||
key: _form,
|
||||
child: Padding(
|
||||
padding: EdgeInsets.all(20),
|
||||
child: ListView(
|
||||
children: <Widget>[
|
||||
Text(
|
||||
'Update a Item',
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.w700,
|
||||
fontSize: 6 * _deviceBlockSize,
|
||||
letterSpacing: 3,
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
height: 20,
|
||||
),
|
||||
TextFormField(
|
||||
validator: (val) {
|
||||
if (val!.isEmpty) {
|
||||
return 'Name required!';
|
||||
}
|
||||
return null;
|
||||
},
|
||||
controller: nameCTRL,
|
||||
decoration: InputDecoration(
|
||||
icon: Icon(FontAwesomeIcons.alignLeft,
|
||||
size: 7 * _deviceBlockSize),
|
||||
isDense: true,
|
||||
labelText: 'Item Name',
|
||||
contentPadding: EdgeInsets.symmetric(
|
||||
vertical: 2, horizontal: 3),
|
||||
labelStyle: TextStyle(
|
||||
fontWeight: FontWeight.w100,
|
||||
fontSize: 4 * _deviceBlockSize,
|
||||
),
|
||||
),
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.w700,
|
||||
fontSize: 5 * _deviceBlockSize,
|
||||
),
|
||||
keyboardType: TextInputType.text,
|
||||
textInputAction: TextInputAction.next,
|
||||
onFieldSubmitted: (_) {
|
||||
FocusScope.of(context)
|
||||
.requestFocus(_itemSizeFocusNode);
|
||||
},
|
||||
),
|
||||
SizedBox(
|
||||
height: 20,
|
||||
),
|
||||
TextFormField(
|
||||
validator: (val) {
|
||||
if (val!.isEmpty) {
|
||||
return 'Size required!';
|
||||
}
|
||||
return null;
|
||||
},
|
||||
controller: sizeCTRL,
|
||||
decoration: InputDecoration(
|
||||
icon: Icon(
|
||||
FontAwesomeIcons.sortNumericDown,
|
||||
size: 7 * _deviceBlockSize,
|
||||
),
|
||||
labelStyle: TextStyle(
|
||||
fontWeight: FontWeight.w100,
|
||||
fontSize: 4 * _deviceBlockSize,
|
||||
),
|
||||
isDense: true,
|
||||
labelText: 'Size',
|
||||
contentPadding: EdgeInsets.symmetric(
|
||||
vertical: 2, horizontal: 3),
|
||||
),
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.w700,
|
||||
fontSize: 5 * _deviceBlockSize,
|
||||
),
|
||||
focusNode: _itemSizeFocusNode,
|
||||
keyboardType: TextInputType.number,
|
||||
textInputAction: TextInputAction.done,
|
||||
onFieldSubmitted: (_) {
|
||||
FocusScope.of(context)
|
||||
.requestFocus(_itemSpecificFocusNode);
|
||||
},
|
||||
),
|
||||
SizedBox(
|
||||
height: 20,
|
||||
),
|
||||
TextFormField(
|
||||
controller: specificCTRL,
|
||||
validator: (val) {
|
||||
if (val!.isEmpty) {
|
||||
return 'Specific required!';
|
||||
}
|
||||
return null;
|
||||
},
|
||||
decoration: InputDecoration(
|
||||
icon: Icon(
|
||||
FontAwesomeIcons.alignLeft,
|
||||
size: 7 * _deviceBlockSize,
|
||||
),
|
||||
labelStyle: TextStyle(
|
||||
fontWeight: FontWeight.w100,
|
||||
fontSize: 4 * _deviceBlockSize,
|
||||
),
|
||||
isDense: true,
|
||||
labelText: 'Specific',
|
||||
contentPadding: EdgeInsets.symmetric(
|
||||
vertical: 2, horizontal: 3),
|
||||
),
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.w700,
|
||||
fontSize: 5 * _deviceBlockSize,
|
||||
),
|
||||
keyboardType: TextInputType.visiblePassword,
|
||||
focusNode: _itemSpecificFocusNode,
|
||||
onFieldSubmitted: (_) {
|
||||
FocusScope.of(context)
|
||||
.requestFocus(_itemUdiFocusNode);
|
||||
},
|
||||
),
|
||||
SizedBox(
|
||||
height: 20,
|
||||
),
|
||||
TextFormField(
|
||||
controller: udiCTRL,
|
||||
validator: (val) {
|
||||
if (val!.isEmpty) {
|
||||
return 'UDI required!';
|
||||
}
|
||||
return null;
|
||||
},
|
||||
decoration: InputDecoration(
|
||||
icon: Icon(
|
||||
FontAwesomeIcons.alignLeft,
|
||||
size: 7 * _deviceBlockSize,
|
||||
),
|
||||
labelStyle: TextStyle(
|
||||
fontWeight: FontWeight.w100,
|
||||
fontSize: 4 * _deviceBlockSize,
|
||||
),
|
||||
isDense: true,
|
||||
labelText: 'UDI',
|
||||
contentPadding: EdgeInsets.symmetric(
|
||||
vertical: 2, horizontal: 3),
|
||||
),
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.w700,
|
||||
fontSize: 5 * _deviceBlockSize,
|
||||
),
|
||||
keyboardType: TextInputType.visiblePassword,
|
||||
focusNode: _itemUdiFocusNode,
|
||||
onFieldSubmitted: (_) {
|
||||
FocusScope.of(context)
|
||||
.requestFocus(_descriptionFocusNode);
|
||||
},
|
||||
),
|
||||
SizedBox(
|
||||
height: 20,
|
||||
),
|
||||
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: _descriptionFocusNode,
|
||||
minLines: 1,
|
||||
maxLines: 5,
|
||||
),
|
||||
SizedBox(
|
||||
height: 70,
|
||||
),
|
||||
ItemUpdateButton(
|
||||
form: _form,
|
||||
id: datas!.id,
|
||||
nameCTRL: nameCTRL,
|
||||
udiCTRL: udiCTRL,
|
||||
sizeCTRL: sizeCTRL,
|
||||
specificCTRL: specificCTRL,
|
||||
deviceBlockSize: _deviceBlockSize,
|
||||
descriptionCTRL: descriptionCTRL,
|
||||
),
|
||||
SizedBox(
|
||||
height: 100,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
)
|
||||
: ConnectionErrorBox();
|
||||
},
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
// @override
|
||||
// Widget build(BuildContext context) {
|
||||
// final _media = MediaQuery.of(context);
|
||||
// final double _devicewidth = _media.size.width;
|
||||
// final double _deviceBlockSize = _devicewidth / 100;
|
||||
// return WillPopScope(
|
||||
// onWillPop: () async {
|
||||
// Navigator.pushReplacementNamed(
|
||||
// context,
|
||||
// Routes.itemResultScreen,
|
||||
// );
|
||||
// return true;
|
||||
// },
|
||||
// child: SafeArea(
|
||||
// child: Scaffold(
|
||||
// appBar: AppBar(
|
||||
// titleSpacing: -10,
|
||||
// backgroundColor: Colors.black,
|
||||
// title: Text('Items', style: TextStyle(color: Colors.white,),),
|
||||
// leading: IconButton(
|
||||
// icon: Icon(
|
||||
// Icons.keyboard_arrow_left,
|
||||
// color: Colors.white,
|
||||
// size: 35,
|
||||
// ),
|
||||
// onPressed: () => Navigator.of(context)
|
||||
// .pushReplacementNamed(Routes.itemResultScreen),
|
||||
// ),
|
||||
// ),
|
||||
// body: Consumer<ConnectivityProvider>(
|
||||
// builder: (ct, connection, _) {
|
||||
// return connection.conStatus != 'offline'
|
||||
// ? isInit
|
||||
// ? Center(
|
||||
// child: CircularProgressIndicator(color: Colors.black),
|
||||
// )
|
||||
// : Form(
|
||||
// key: _form,
|
||||
// child: Padding(
|
||||
// padding: EdgeInsets.all(20),
|
||||
// child: ListView(
|
||||
// children: <Widget>[
|
||||
// Text(
|
||||
// 'Update a Item',
|
||||
// style: TextStyle(
|
||||
// fontWeight: FontWeight.w700,
|
||||
// fontSize: 6 * _deviceBlockSize,
|
||||
// letterSpacing: 3,
|
||||
// ),
|
||||
// ),
|
||||
// SizedBox(
|
||||
// height: 20,
|
||||
// ),
|
||||
// TextFormField(
|
||||
// validator: (val) {
|
||||
// if (val!.isEmpty) {
|
||||
// return 'Name required!';
|
||||
// }
|
||||
// return null;
|
||||
// },
|
||||
// controller: nameCTRL,
|
||||
// decoration: InputDecoration(
|
||||
// icon: Icon(FontAwesomeIcons.alignLeft,
|
||||
// size: 7 * _deviceBlockSize),
|
||||
// isDense: true,
|
||||
// labelText: 'Item Name',
|
||||
// contentPadding: EdgeInsets.symmetric(
|
||||
// vertical: 2, horizontal: 3),
|
||||
// labelStyle: TextStyle(
|
||||
// fontWeight: FontWeight.w100,
|
||||
// fontSize: 4 * _deviceBlockSize,
|
||||
// ),
|
||||
// ),
|
||||
// style: TextStyle(
|
||||
// fontWeight: FontWeight.w700,
|
||||
// fontSize: 5 * _deviceBlockSize,
|
||||
// ),
|
||||
// keyboardType: TextInputType.text,
|
||||
// textInputAction: TextInputAction.next,
|
||||
// onFieldSubmitted: (_) {
|
||||
// FocusScope.of(context)
|
||||
// .requestFocus(_itemSizeFocusNode);
|
||||
// },
|
||||
// ),
|
||||
// SizedBox(
|
||||
// height: 20,
|
||||
// ),
|
||||
// TextFormField(
|
||||
// validator: (val) {
|
||||
// if (val!.isEmpty) {
|
||||
// return 'Size required!';
|
||||
// }
|
||||
// return null;
|
||||
// },
|
||||
// controller: sizeCTRL,
|
||||
// decoration: InputDecoration(
|
||||
// icon: Icon(
|
||||
// FontAwesomeIcons.sortNumericDown,
|
||||
// size: 7 * _deviceBlockSize,
|
||||
// ),
|
||||
// labelStyle: TextStyle(
|
||||
// fontWeight: FontWeight.w100,
|
||||
// fontSize: 4 * _deviceBlockSize,
|
||||
// ),
|
||||
// isDense: true,
|
||||
// labelText: 'Size',
|
||||
// contentPadding: EdgeInsets.symmetric(
|
||||
// vertical: 2, horizontal: 3),
|
||||
// ),
|
||||
// style: TextStyle(
|
||||
// fontWeight: FontWeight.w700,
|
||||
// fontSize: 5 * _deviceBlockSize,
|
||||
// ),
|
||||
// focusNode: _itemSizeFocusNode,
|
||||
// keyboardType: TextInputType.number,
|
||||
// textInputAction: TextInputAction.done,
|
||||
// onFieldSubmitted: (_) {
|
||||
// FocusScope.of(context)
|
||||
// .requestFocus(_itemSpecificFocusNode);
|
||||
// },
|
||||
// ),
|
||||
// SizedBox(
|
||||
// height: 20,
|
||||
// ),
|
||||
// TextFormField(
|
||||
// controller: specificCTRL,
|
||||
// validator: (val) {
|
||||
// if (val!.isEmpty) {
|
||||
// return 'Specific required!';
|
||||
// }
|
||||
// return null;
|
||||
// },
|
||||
// decoration: InputDecoration(
|
||||
// icon: Icon(
|
||||
// FontAwesomeIcons.alignLeft,
|
||||
// size: 7 * _deviceBlockSize,
|
||||
// ),
|
||||
// labelStyle: TextStyle(
|
||||
// fontWeight: FontWeight.w100,
|
||||
// fontSize: 4 * _deviceBlockSize,
|
||||
// ),
|
||||
// isDense: true,
|
||||
// labelText: 'Specific',
|
||||
// contentPadding: EdgeInsets.symmetric(
|
||||
// vertical: 2, horizontal: 3),
|
||||
// ),
|
||||
// style: TextStyle(
|
||||
// fontWeight: FontWeight.w700,
|
||||
// fontSize: 5 * _deviceBlockSize,
|
||||
// ),
|
||||
// keyboardType: TextInputType.visiblePassword,
|
||||
// focusNode: _itemSpecificFocusNode,
|
||||
// onFieldSubmitted: (_) {
|
||||
// FocusScope.of(context)
|
||||
// .requestFocus(_itemUdiFocusNode);
|
||||
// },
|
||||
// ),
|
||||
// SizedBox(
|
||||
// height: 20,
|
||||
// ),
|
||||
// TextFormField(
|
||||
// controller: udiCTRL,
|
||||
// validator: (val) {
|
||||
// if (val!.isEmpty) {
|
||||
// return 'UDI required!';
|
||||
// }
|
||||
// return null;
|
||||
// },
|
||||
// decoration: InputDecoration(
|
||||
// icon: Icon(
|
||||
// FontAwesomeIcons.alignLeft,
|
||||
// size: 7 * _deviceBlockSize,
|
||||
// ),
|
||||
// labelStyle: TextStyle(
|
||||
// fontWeight: FontWeight.w100,
|
||||
// fontSize: 4 * _deviceBlockSize,
|
||||
// ),
|
||||
// isDense: true,
|
||||
// labelText: 'UDI',
|
||||
// contentPadding: EdgeInsets.symmetric(
|
||||
// vertical: 2, horizontal: 3),
|
||||
// ),
|
||||
// style: TextStyle(
|
||||
// fontWeight: FontWeight.w700,
|
||||
// fontSize: 5 * _deviceBlockSize,
|
||||
// ),
|
||||
// keyboardType: TextInputType.visiblePassword,
|
||||
// focusNode: _itemUdiFocusNode,
|
||||
// onFieldSubmitted: (_) {
|
||||
// FocusScope.of(context)
|
||||
// .requestFocus(_descriptionFocusNode);
|
||||
// },
|
||||
// ),
|
||||
// SizedBox(
|
||||
// height: 20,
|
||||
// ),
|
||||
// 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: _descriptionFocusNode,
|
||||
// minLines: 1,
|
||||
// maxLines: 5,
|
||||
// ),
|
||||
// SizedBox(
|
||||
// height: 70,
|
||||
// ),
|
||||
// ItemUpdateButton(
|
||||
// form: _form,
|
||||
// id: datas!.id,
|
||||
// nameCTRL: nameCTRL,
|
||||
// udiCTRL: udiCTRL,
|
||||
// sizeCTRL: sizeCTRL,
|
||||
// specificCTRL: specificCTRL,
|
||||
// deviceBlockSize: _deviceBlockSize,
|
||||
// descriptionCTRL: descriptionCTRL,
|
||||
// ),
|
||||
// SizedBox(
|
||||
// height: 100,
|
||||
// ),
|
||||
// ],
|
||||
// ),
|
||||
// ),
|
||||
// )
|
||||
// : ConnectionErrorBox();
|
||||
// },
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
// );
|
||||
// }
|
||||
// }
|
||||
|
||||
@@ -1,309 +1,309 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
||||
import 'package:intl/intl.dart' as DateEditor;
|
||||
import 'package:provider/provider.dart';
|
||||
// import 'package:flutter/material.dart';
|
||||
// import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
||||
// import 'package:intl/intl.dart' as DateEditor;
|
||||
// import 'package:provider/provider.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/Add/date_picker.dart';
|
||||
import '../../widgets/LabelScreens/Add/update_button.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/Add/date_picker.dart';
|
||||
// import '../../widgets/LabelScreens/Add/update_button.dart';
|
||||
|
||||
class LabelUpdateScreen extends StatefulWidget {
|
||||
// static const route = '/LabelUpdateScreen';
|
||||
// class LabelUpdateScreen extends StatefulWidget {
|
||||
// // static const route = '/LabelUpdateScreen';
|
||||
|
||||
@override
|
||||
_LabelUpdateScreenState createState() => _LabelUpdateScreenState();
|
||||
}
|
||||
// @override
|
||||
// _LabelUpdateScreenState createState() => _LabelUpdateScreenState();
|
||||
// }
|
||||
|
||||
class _LabelUpdateScreenState extends State<LabelUpdateScreen> {
|
||||
final _cycleNumberFocusNode = FocusNode();
|
||||
final _lotNumberFocusNode = FocusNode();
|
||||
TextEditingController lotNumberCTRL = new TextEditingController();
|
||||
TextEditingController cycleNumberCTRL = new TextEditingController();
|
||||
TextEditingController striizerIdCTRL = new TextEditingController();
|
||||
TextEditingController sDateCTRL = new TextEditingController();
|
||||
TextEditingController eDateCTRL = new TextEditingController();
|
||||
// TextEditingController packageCTRL = new TextEditingController();
|
||||
// class _LabelUpdateScreenState extends State<LabelUpdateScreen> {
|
||||
// final _cycleNumberFocusNode = FocusNode();
|
||||
// final _lotNumberFocusNode = FocusNode();
|
||||
// TextEditingController lotNumberCTRL = new TextEditingController();
|
||||
// TextEditingController cycleNumberCTRL = new TextEditingController();
|
||||
// TextEditingController striizerIdCTRL = new TextEditingController();
|
||||
// TextEditingController sDateCTRL = new TextEditingController();
|
||||
// TextEditingController eDateCTRL = new TextEditingController();
|
||||
// // TextEditingController packageCTRL = new TextEditingController();
|
||||
|
||||
DateTime? dateTimeS;
|
||||
// String sDateValue;
|
||||
// String eDateValue;
|
||||
// DateTime? dateTimeS;
|
||||
// // String sDateValue;
|
||||
// // String eDateValue;
|
||||
|
||||
final _form = GlobalKey<FormState>();
|
||||
// final _form = GlobalKey<FormState>();
|
||||
|
||||
// List<Map<String, String>> packageVals = [];
|
||||
// List<String> packageValue = [];
|
||||
bool isEmpty = false;
|
||||
bool isInit = true;
|
||||
LabelDetailsObject? datas;
|
||||
// // List<Map<String, String>> packageVals = [];
|
||||
// // List<String> packageValue = [];
|
||||
// bool isEmpty = false;
|
||||
// bool isInit = true;
|
||||
// LabelDetailsObject? datas;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
sDateCTRL.text = DateEditor.DateFormat('y-M-d').format(DateTime.now());
|
||||
eDateCTRL.text = DateEditor.DateFormat('y-M-d').format(DateTime.now());
|
||||
super.initState();
|
||||
}
|
||||
// @override
|
||||
// void initState() {
|
||||
// sDateCTRL.text = DateEditor.DateFormat('y-M-d').format(DateTime.now());
|
||||
// eDateCTRL.text = DateEditor.DateFormat('y-M-d').format(DateTime.now());
|
||||
// super.initState();
|
||||
// }
|
||||
|
||||
@override
|
||||
void didChangeDependencies() async {
|
||||
if (isInit) {
|
||||
var _id = ModalRoute.of(context)!.settings.arguments;
|
||||
await Provider.of<LabelsProvider>(context, listen: false)
|
||||
.showLabelResult(_id.toString())
|
||||
.then(
|
||||
(result) {
|
||||
setState(
|
||||
() {
|
||||
// if (result.id == 'null') {
|
||||
// isEmpty = true;
|
||||
// }
|
||||
datas = result;
|
||||
lotNumberCTRL.text = datas!.lotNumber;
|
||||
cycleNumberCTRL.text = datas!.cycleNumber;
|
||||
striizerIdCTRL.text = datas!.sterileId;
|
||||
sDateCTRL.text = datas!.sterileDate;
|
||||
eDateCTRL.text = datas!.expireDate;
|
||||
// packageValue.add(datas!.packageId);
|
||||
// packageValue.add(datas!.package);
|
||||
// packageCTRL.text = datas!.package;
|
||||
},
|
||||
);
|
||||
},
|
||||
);
|
||||
await Provider.of<LabelsProvider>(context, listen: false)
|
||||
.getPackageFilters()
|
||||
.then(
|
||||
(result) {
|
||||
setState(
|
||||
() {
|
||||
// packageVals = result.map((value) => {"name": value}).toList();
|
||||
isInit = false;
|
||||
},
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
super.didChangeDependencies();
|
||||
}
|
||||
// @override
|
||||
// void didChangeDependencies() async {
|
||||
// if (isInit) {
|
||||
// var _id = ModalRoute.of(context)!.settings.arguments;
|
||||
// await Provider.of<LabelsProvider>(context, listen: false)
|
||||
// .showLabelResult(_id.toString())
|
||||
// .then(
|
||||
// (result) {
|
||||
// setState(
|
||||
// () {
|
||||
// // if (result.id == 'null') {
|
||||
// // isEmpty = true;
|
||||
// // }
|
||||
// datas = result;
|
||||
// lotNumberCTRL.text = datas!.lotNumber;
|
||||
// cycleNumberCTRL.text = datas!.cycleNumber;
|
||||
// striizerIdCTRL.text = datas!.sterileId;
|
||||
// sDateCTRL.text = datas!.sterileDate;
|
||||
// eDateCTRL.text = datas!.expireDate;
|
||||
// // packageValue.add(datas!.packageId);
|
||||
// // packageValue.add(datas!.package);
|
||||
// // packageCTRL.text = datas!.package;
|
||||
// },
|
||||
// );
|
||||
// },
|
||||
// );
|
||||
// await Provider.of<LabelsProvider>(context, listen: false)
|
||||
// .getPackageFilters()
|
||||
// .then(
|
||||
// (result) {
|
||||
// setState(
|
||||
// () {
|
||||
// // packageVals = result.map((value) => {"name": value}).toList();
|
||||
// isInit = false;
|
||||
// },
|
||||
// );
|
||||
// },
|
||||
// );
|
||||
// }
|
||||
// super.didChangeDependencies();
|
||||
// }
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final _media = MediaQuery.of(context);
|
||||
final double _devicewidth = _media.size.width;
|
||||
final double _deviceBlockSize = _devicewidth / 100;
|
||||
return WillPopScope(
|
||||
onWillPop: () async {
|
||||
Navigator.pushReplacementNamed(
|
||||
context,
|
||||
Routes.labelResultScreen,
|
||||
);
|
||||
return true;
|
||||
},
|
||||
child: SafeArea(
|
||||
child: Scaffold(
|
||||
appBar: AppBar(
|
||||
titleSpacing: -10,
|
||||
backgroundColor: Colors.black,
|
||||
title: Text('Labels', style: TextStyle(color: Colors.white,),),
|
||||
leading: IconButton(
|
||||
icon: Icon(
|
||||
Icons.keyboard_arrow_left,
|
||||
color: Colors.white,
|
||||
size: 35,
|
||||
),
|
||||
onPressed: () => Navigator.of(context)
|
||||
.pushReplacementNamed(Routes.labelResultScreen),
|
||||
),
|
||||
),
|
||||
body: Consumer<ConnectivityProvider>(
|
||||
builder: (ct, connection, _) {
|
||||
return connection.conStatus != 'offline'
|
||||
? isInit
|
||||
? Center(
|
||||
child: CircularProgressIndicator(color: Colors.black),
|
||||
)
|
||||
: Form(
|
||||
key: _form,
|
||||
child: Padding(
|
||||
padding: EdgeInsets.all(20),
|
||||
child: ListView(
|
||||
children: <Widget>[
|
||||
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,
|
||||
),
|
||||
),
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.w700,
|
||||
fontSize: 5 * _deviceBlockSize,
|
||||
),
|
||||
keyboardType: TextInputType.visiblePassword,
|
||||
textInputAction: TextInputAction.next,
|
||||
onFieldSubmitted: (_) {
|
||||
FocusScope.of(context)
|
||||
.requestFocus(_cycleNumberFocusNode);
|
||||
},
|
||||
),
|
||||
SizedBox(
|
||||
height: 20,
|
||||
),
|
||||
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),
|
||||
),
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.w700,
|
||||
fontSize: 5 * _deviceBlockSize,
|
||||
),
|
||||
focusNode: _cycleNumberFocusNode,
|
||||
keyboardType: TextInputType.number,
|
||||
textInputAction: TextInputAction.done,
|
||||
onFieldSubmitted: (_) {
|
||||
FocusScope.of(context)
|
||||
.requestFocus(_lotNumberFocusNode);
|
||||
},
|
||||
),
|
||||
SizedBox(
|
||||
height: 20,
|
||||
),
|
||||
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,
|
||||
focusNode: _lotNumberFocusNode,
|
||||
),
|
||||
SizedBox(
|
||||
height: 20,
|
||||
),
|
||||
// LabelAddSelectorBox(
|
||||
// deviceBlockSize: _deviceBlockSize,
|
||||
// packageCTRL: packageCTRL,
|
||||
// packageVals: packageVals,
|
||||
// packageValue: packageValue,
|
||||
// ),
|
||||
// SizedBox(
|
||||
// height: 20,
|
||||
// ),
|
||||
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();
|
||||
},
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
// @override
|
||||
// Widget build(BuildContext context) {
|
||||
// final _media = MediaQuery.of(context);
|
||||
// final double _devicewidth = _media.size.width;
|
||||
// final double _deviceBlockSize = _devicewidth / 100;
|
||||
// return WillPopScope(
|
||||
// onWillPop: () async {
|
||||
// Navigator.pushReplacementNamed(
|
||||
// context,
|
||||
// Routes.labelResultScreen,
|
||||
// );
|
||||
// return true;
|
||||
// },
|
||||
// child: SafeArea(
|
||||
// child: Scaffold(
|
||||
// appBar: AppBar(
|
||||
// titleSpacing: -10,
|
||||
// backgroundColor: Colors.black,
|
||||
// title: Text('Labels', style: TextStyle(color: Colors.white,),),
|
||||
// leading: IconButton(
|
||||
// icon: Icon(
|
||||
// Icons.keyboard_arrow_left,
|
||||
// color: Colors.white,
|
||||
// size: 35,
|
||||
// ),
|
||||
// onPressed: () => Navigator.of(context)
|
||||
// .pushReplacementNamed(Routes.labelResultScreen),
|
||||
// ),
|
||||
// ),
|
||||
// body: Consumer<ConnectivityProvider>(
|
||||
// builder: (ct, connection, _) {
|
||||
// return connection.conStatus != 'offline'
|
||||
// ? isInit
|
||||
// ? Center(
|
||||
// child: CircularProgressIndicator(color: Colors.black),
|
||||
// )
|
||||
// : Form(
|
||||
// key: _form,
|
||||
// child: Padding(
|
||||
// padding: EdgeInsets.all(20),
|
||||
// child: ListView(
|
||||
// children: <Widget>[
|
||||
// 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,
|
||||
// ),
|
||||
// ),
|
||||
// style: TextStyle(
|
||||
// fontWeight: FontWeight.w700,
|
||||
// fontSize: 5 * _deviceBlockSize,
|
||||
// ),
|
||||
// keyboardType: TextInputType.visiblePassword,
|
||||
// textInputAction: TextInputAction.next,
|
||||
// onFieldSubmitted: (_) {
|
||||
// FocusScope.of(context)
|
||||
// .requestFocus(_cycleNumberFocusNode);
|
||||
// },
|
||||
// ),
|
||||
// SizedBox(
|
||||
// height: 20,
|
||||
// ),
|
||||
// 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),
|
||||
// ),
|
||||
// style: TextStyle(
|
||||
// fontWeight: FontWeight.w700,
|
||||
// fontSize: 5 * _deviceBlockSize,
|
||||
// ),
|
||||
// focusNode: _cycleNumberFocusNode,
|
||||
// keyboardType: TextInputType.number,
|
||||
// textInputAction: TextInputAction.done,
|
||||
// onFieldSubmitted: (_) {
|
||||
// FocusScope.of(context)
|
||||
// .requestFocus(_lotNumberFocusNode);
|
||||
// },
|
||||
// ),
|
||||
// SizedBox(
|
||||
// height: 20,
|
||||
// ),
|
||||
// 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,
|
||||
// focusNode: _lotNumberFocusNode,
|
||||
// ),
|
||||
// SizedBox(
|
||||
// height: 20,
|
||||
// ),
|
||||
// // LabelAddSelectorBox(
|
||||
// // deviceBlockSize: _deviceBlockSize,
|
||||
// // packageCTRL: packageCTRL,
|
||||
// // packageVals: packageVals,
|
||||
// // packageValue: packageValue,
|
||||
// // ),
|
||||
// // SizedBox(
|
||||
// // height: 20,
|
||||
// // ),
|
||||
// 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();
|
||||
// },
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
// );
|
||||
// }
|
||||
// }
|
||||
|
||||
@@ -37,10 +37,8 @@ class _MyItemsMineScreenState extends State<MyItemsMineScreen> {
|
||||
void didChangeDependencies() {
|
||||
if (_isInit) {
|
||||
var myItemResults = Provider.of<MyItemProvider>(context);
|
||||
final userData = Provider.of<Auth>(context, listen: false).user;
|
||||
myItemResults.setLoading();
|
||||
myItemResults.resetPageNumber();
|
||||
if (userData['roles']?.contains('User')) {
|
||||
myItemResults.getMyItems().then(
|
||||
(_) {
|
||||
myItemResults.resetLoading();
|
||||
@@ -58,23 +56,6 @@ class _MyItemsMineScreenState extends State<MyItemsMineScreen> {
|
||||
);
|
||||
},
|
||||
);
|
||||
} else {
|
||||
myItemResults.getHospitalItems().then((_) {
|
||||
myItemResults.resetLoading();
|
||||
sc!.addListener(
|
||||
() {
|
||||
if (sc!.position.pixels == sc!.position.maxScrollExtent &&
|
||||
searchCTRL.text == '') {
|
||||
var myItemResults = Provider.of<MyItemProvider>(
|
||||
context,
|
||||
listen: false,
|
||||
);
|
||||
myItemResults.getHospitalItems();
|
||||
}
|
||||
},
|
||||
);
|
||||
});
|
||||
}
|
||||
}
|
||||
_isInit = false;
|
||||
super.didChangeDependencies();
|
||||
@@ -177,13 +158,8 @@ class _MyItemsMineScreenState extends State<MyItemsMineScreen> {
|
||||
textInputType: TextInputType.visiblePassword,
|
||||
deviceBlockSize: _deviceBlockSize,
|
||||
onChanged: (value) {
|
||||
if (userData['roles']?.contains('User')) {
|
||||
Provider.of<MyItemProvider>(context, listen: false)
|
||||
.searchMyItems(value);
|
||||
} else {
|
||||
Provider.of<MyItemProvider>(context, listen: false)
|
||||
.searchHospitalItems(value);
|
||||
}
|
||||
Provider.of<MyItemProvider>(context, listen: false)
|
||||
.searchMyItems(value);
|
||||
},
|
||||
),
|
||||
SizedBox(
|
||||
@@ -201,11 +177,13 @@ class _MyItemsMineScreenState extends State<MyItemsMineScreen> {
|
||||
: ListView.builder(
|
||||
controller: sc,
|
||||
itemBuilder: (context, index) {
|
||||
if (userData['roles']?.contains('User')) {
|
||||
return MyItemsItemDataBox(
|
||||
deviceBlockSize: _deviceBlockSize,
|
||||
isAdmin: false,
|
||||
items: itemResults.myItems?[index],
|
||||
deviceBlockSize: _deviceBlockSize,
|
||||
isAdmin:
|
||||
userData['roles']?.contains('User')
|
||||
? false
|
||||
: true,
|
||||
items: itemResults.myItems?[index],
|
||||
push: () {
|
||||
Navigator.pushNamed(context,
|
||||
Routes.myItemsHistoryScreen,
|
||||
@@ -213,26 +191,8 @@ class _MyItemsMineScreenState extends State<MyItemsMineScreen> {
|
||||
itemResults.myItems?[index]);
|
||||
},
|
||||
);
|
||||
} else {
|
||||
return MyItemsItemDataBox(
|
||||
deviceBlockSize: _deviceBlockSize,
|
||||
isAdmin: true,
|
||||
items:
|
||||
itemResults.hospitalItems?[index],
|
||||
push: () {
|
||||
Navigator.pushNamed(
|
||||
context,
|
||||
Routes.myItemsHistoryScreen,
|
||||
arguments: itemResults
|
||||
.hospitalItems?[index],
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
},
|
||||
itemCount: userData['roles']?.contains('User')
|
||||
? itemResults.myItems?.length
|
||||
: itemResults.hospitalItems?.length,
|
||||
itemCount: itemResults.myItems?.length,
|
||||
shrinkWrap: true,
|
||||
);
|
||||
},
|
||||
|
||||
@@ -33,44 +33,24 @@ class _MyItemsRequestsScreenState extends State<MyItemsRequestsScreen> {
|
||||
void didChangeDependencies() {
|
||||
if (_isInit) {
|
||||
var itemResults = Provider.of<MyItemProvider>(context);
|
||||
final userData = Provider.of<Auth>(context, listen: false).user;
|
||||
itemResults.setLoading();
|
||||
itemResults.resetPageNumber();
|
||||
if (userData['roles']?.contains('User')) {
|
||||
itemResults.getMyItemRequests().then(
|
||||
(_) {
|
||||
itemResults.resetLoading();
|
||||
sc?.addListener(
|
||||
() {
|
||||
if (sc!.position.pixels == sc!.position.maxScrollExtent) {
|
||||
var itemResults = Provider.of<MyItemProvider>(
|
||||
context,
|
||||
listen: false,
|
||||
);
|
||||
itemResults.getMyItemRequests();
|
||||
}
|
||||
},
|
||||
);
|
||||
},
|
||||
);
|
||||
} else {
|
||||
itemResults.getHospitalItemRequests().then(
|
||||
(_) {
|
||||
itemResults.resetLoading();
|
||||
sc?.addListener(
|
||||
() {
|
||||
if (sc!.position.pixels == sc!.position.maxScrollExtent) {
|
||||
var itemResults = Provider.of<MyItemProvider>(
|
||||
context,
|
||||
listen: false,
|
||||
);
|
||||
itemResults.getHospitalItemRequests();
|
||||
}
|
||||
},
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
itemResults.getMyItemRequests().then(
|
||||
(_) {
|
||||
itemResults.resetLoading();
|
||||
sc?.addListener(
|
||||
() {
|
||||
if (sc!.position.pixels == sc!.position.maxScrollExtent) {
|
||||
var itemResults = Provider.of<MyItemProvider>(
|
||||
context,
|
||||
listen: false,
|
||||
);
|
||||
itemResults.getMyItemRequests();
|
||||
}
|
||||
},
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
_isInit = false;
|
||||
super.didChangeDependencies();
|
||||
@@ -116,29 +96,18 @@ class _MyItemsRequestsScreenState extends State<MyItemsRequestsScreen> {
|
||||
: ListView.builder(
|
||||
controller: sc,
|
||||
itemBuilder: (context, index) {
|
||||
if (userData['roles']?.contains('User')) {
|
||||
return RequestsDataBox(
|
||||
return RequestsDataBox(
|
||||
deviceBlockSize: _deviceBlockSize,
|
||||
isAdmin: false,
|
||||
isAdmin:
|
||||
userData['roles']?.contains('User')
|
||||
? false
|
||||
: true,
|
||||
item: itemResults
|
||||
.originalMyItemsRequests?[index],
|
||||
);
|
||||
} else {
|
||||
return RequestsDataBox(
|
||||
deviceBlockSize: _deviceBlockSize,
|
||||
isAdmin: true,
|
||||
item: itemResults
|
||||
.originalHospitalItemsRequests?[
|
||||
index],
|
||||
);
|
||||
}
|
||||
);
|
||||
},
|
||||
itemCount: userData['roles']?.contains('User')
|
||||
? itemResults
|
||||
.originalMyItemsRequests?.length
|
||||
: itemResults
|
||||
.originalHospitalItemsRequests
|
||||
?.length,
|
||||
itemCount: itemResults
|
||||
.originalMyItemsRequests?.length,
|
||||
shrinkWrap: true,
|
||||
);
|
||||
},
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
|
||||
// ignore_for_file: public_member_api_docs, sort_constructors_first
|
||||
import 'package:cssd/config/routes.dart';
|
||||
import 'package:cssd/providers/auth.dart';
|
||||
@@ -37,10 +38,8 @@ class _MyPackagesMineScreenState extends State<MyPackagesMineScreen> {
|
||||
void didChangeDependencies() {
|
||||
if (_isInit) {
|
||||
var myPackageResults = Provider.of<MyPackageProvider>(context);
|
||||
final userData = Provider.of<Auth>(context, listen: false).user;
|
||||
myPackageResults.setLoading();
|
||||
myPackageResults.resetPageNumber();
|
||||
if (userData['roles']?.contains('User')) {
|
||||
myPackageResults.getMyPackages().then(
|
||||
(_) {
|
||||
myPackageResults.resetLoading();
|
||||
@@ -58,23 +57,6 @@ class _MyPackagesMineScreenState extends State<MyPackagesMineScreen> {
|
||||
);
|
||||
},
|
||||
);
|
||||
} else {
|
||||
myPackageResults.getHospitalPackages().then((_) {
|
||||
myPackageResults.resetLoading();
|
||||
sc!.addListener(
|
||||
() {
|
||||
if (sc!.position.pixels == sc!.position.maxScrollExtent &&
|
||||
searchCTRL.text == '') {
|
||||
var myPackageResults = Provider.of<MyPackageProvider>(
|
||||
context,
|
||||
listen: false,
|
||||
);
|
||||
myPackageResults.getHospitalPackages();
|
||||
}
|
||||
},
|
||||
);
|
||||
});
|
||||
}
|
||||
}
|
||||
_isInit = false;
|
||||
super.didChangeDependencies();
|
||||
@@ -149,13 +131,8 @@ class _MyPackagesMineScreenState extends State<MyPackagesMineScreen> {
|
||||
text: 'package',
|
||||
deviceBlockSize: _deviceBlockSize,
|
||||
onChanged: (value) {
|
||||
if (userData['roles']?.contains('User')) {
|
||||
Provider.of<MyPackageProvider>(context, listen: false)
|
||||
.searchMyPackages(value);
|
||||
} else {
|
||||
Provider.of<MyPackageProvider>(context, listen: false)
|
||||
.searchHospitalPackages(value);
|
||||
}
|
||||
Provider.of<MyPackageProvider>(context, listen: false)
|
||||
.searchMyPackages(value);
|
||||
},
|
||||
),
|
||||
SizedBox(
|
||||
@@ -173,37 +150,23 @@ class _MyPackagesMineScreenState extends State<MyPackagesMineScreen> {
|
||||
: ListView.builder(
|
||||
controller: sc,
|
||||
itemBuilder: (context, index) {
|
||||
if (userData['roles']?.contains('User')) {
|
||||
return MyPackagesItemDataBox(
|
||||
deviceBlockSize: _deviceBlockSize,
|
||||
isAdmin: false,
|
||||
packages:
|
||||
packageResults.myPackages?[index],
|
||||
push: () {
|
||||
Navigator.pushNamed(context,
|
||||
Routes.myPackagesHistoryScreen,
|
||||
arguments: packageResults
|
||||
.myPackages?[index]);
|
||||
},
|
||||
);
|
||||
} else {
|
||||
return MyPackagesItemDataBox(
|
||||
deviceBlockSize: _deviceBlockSize,
|
||||
isAdmin: true,
|
||||
packages: packageResults
|
||||
.hospitalPackages?[index],
|
||||
push: () {
|
||||
Navigator.pushNamed(context,
|
||||
Routes.myPackagesHistoryScreen,
|
||||
arguments: packageResults
|
||||
.hospitalPackages?[index]);
|
||||
},
|
||||
);
|
||||
}
|
||||
return MyPackagesItemDataBox(
|
||||
deviceBlockSize: _deviceBlockSize,
|
||||
isAdmin:
|
||||
userData['roles']?.contains('User')
|
||||
? false
|
||||
: true,
|
||||
packages:
|
||||
packageResults.myPackages?[index],
|
||||
push: () {
|
||||
Navigator.pushNamed(context,
|
||||
Routes.myPackagesHistoryScreen,
|
||||
arguments: packageResults
|
||||
.myPackages?[index]);
|
||||
},
|
||||
);
|
||||
},
|
||||
itemCount: userData['roles']?.contains('User')
|
||||
? packageResults.myPackages?.length
|
||||
: packageResults.hospitalPackages?.length,
|
||||
itemCount: packageResults.myPackages?.length,
|
||||
shrinkWrap: true,
|
||||
);
|
||||
},
|
||||
|
||||
@@ -34,10 +34,8 @@ class _MyPackagesRequestsScreenState extends State<MyPackagesRequestsScreen> {
|
||||
void didChangeDependencies() {
|
||||
if (_isInit) {
|
||||
var packageResults = Provider.of<MyPackageProvider>(context);
|
||||
final userData = Provider.of<Auth>(context, listen: false).user;
|
||||
packageResults.setLoading();
|
||||
packageResults.resetPageNumber();
|
||||
if (userData['roles']?.contains('User')) {
|
||||
packageResults.getMyPackageRequests().then(
|
||||
(_) {
|
||||
packageResults.resetLoading();
|
||||
@@ -54,24 +52,6 @@ class _MyPackagesRequestsScreenState extends State<MyPackagesRequestsScreen> {
|
||||
);
|
||||
},
|
||||
);
|
||||
} else {
|
||||
packageResults.getHospitalPackageRequests().then(
|
||||
(_) {
|
||||
packageResults.resetLoading();
|
||||
sc?.addListener(
|
||||
() {
|
||||
if (sc!.position.pixels == sc!.position.maxScrollExtent) {
|
||||
var packageResults = Provider.of<MyPackageProvider>(
|
||||
context,
|
||||
listen: false,
|
||||
);
|
||||
packageResults.getHospitalPackageRequests();
|
||||
}
|
||||
},
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
_isInit = false;
|
||||
super.didChangeDependencies();
|
||||
@@ -117,29 +97,18 @@ class _MyPackagesRequestsScreenState extends State<MyPackagesRequestsScreen> {
|
||||
: ListView.builder(
|
||||
controller: sc,
|
||||
itemBuilder: (context, index) {
|
||||
if (userData['roles']?.contains('User')) {
|
||||
return PackageRequestsDataBox(
|
||||
deviceBlockSize: _deviceBlockSize,
|
||||
isAdmin: false,
|
||||
package: packageResults
|
||||
.originalMyPackagesRequests?[index],
|
||||
);
|
||||
} else {
|
||||
return PackageRequestsDataBox(
|
||||
deviceBlockSize: _deviceBlockSize,
|
||||
isAdmin: true,
|
||||
package: packageResults
|
||||
.originalHospitalPackagesRequests?[
|
||||
index],
|
||||
);
|
||||
}
|
||||
return PackageRequestsDataBox(
|
||||
deviceBlockSize: _deviceBlockSize,
|
||||
isAdmin:
|
||||
userData['roles']?.contains('User')
|
||||
? false
|
||||
: true,
|
||||
package: packageResults
|
||||
.originalMyPackagesRequests?[index],
|
||||
);
|
||||
},
|
||||
itemCount: userData['roles']?.contains('User')
|
||||
? packageResults
|
||||
.originalMyPackagesRequests?.length
|
||||
: packageResults
|
||||
.originalHospitalPackagesRequests
|
||||
?.length,
|
||||
itemCount: packageResults
|
||||
.originalMyPackagesRequests?.length,
|
||||
shrinkWrap: true,
|
||||
);
|
||||
},
|
||||
|
||||
@@ -1,7 +1,14 @@
|
||||
// ignore_for_file: unused_local_variable
|
||||
|
||||
import 'dart:isolate';
|
||||
import 'dart:ui';
|
||||
|
||||
import 'package:cssd/config/colors.dart';
|
||||
import 'package:cssd/providers/packages.dart';
|
||||
import 'package:cssd/widgets/PackageScreens/Filter/package_filter_object.dart';
|
||||
import 'package:cssd/widgets/PackageScreens/Result/package_data_box.dart';
|
||||
import 'package:flutter_downloader/flutter_downloader.dart';
|
||||
import 'package:permission_handler/permission_handler.dart';
|
||||
|
||||
import '../../config/routes.dart';
|
||||
import '../../providers/connectivity.dart';
|
||||
@@ -25,11 +32,30 @@ class _PackageResultScreenState extends State<PackageResultScreen> {
|
||||
bool _isInit = true;
|
||||
ScrollController? sc;
|
||||
TextEditingController searchCTRL = new TextEditingController();
|
||||
ReceivePort _port = ReceivePort();
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
sc = new ScrollController();
|
||||
super.initState();
|
||||
IsolateNameServer.registerPortWithName(_port.sendPort, 'downloader_send_port');
|
||||
_port.listen((dynamic data) {
|
||||
String id = data[0];
|
||||
DownloadTaskStatus status = data[1];
|
||||
int progress = data[2];
|
||||
if (status == DownloadTaskStatus.complete) {
|
||||
print('Downloaded');
|
||||
}
|
||||
setState((){ });
|
||||
});
|
||||
|
||||
FlutterDownloader.registerCallback(downloadCallback);
|
||||
}
|
||||
|
||||
@pragma('vm:entry-point')
|
||||
static void downloadCallback(String id, int status, int progress) {
|
||||
final SendPort? send = IsolateNameServer.lookupPortByName('downloader_send_port');
|
||||
send!.send([id, status, progress]);
|
||||
}
|
||||
|
||||
@override
|
||||
@@ -58,6 +84,12 @@ class _PackageResultScreenState extends State<PackageResultScreen> {
|
||||
super.didChangeDependencies();
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
IsolateNameServer.removePortNameMapping('downloader_send_port');
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final _media = MediaQuery.of(context);
|
||||
@@ -225,6 +257,30 @@ class PackageResultFloatingButton extends StatelessWidget {
|
||||
return Row(
|
||||
mainAxisAlignment: MainAxisAlignment.end,
|
||||
children: [
|
||||
InkWell(
|
||||
customBorder: CircleBorder(),
|
||||
onTap: () async {
|
||||
var status = await Permission.storage.request();
|
||||
if (status.isGranted) {
|
||||
Provider.of<PackageProvider>(context, listen: false).exportPackages();
|
||||
}
|
||||
},
|
||||
child: Container(
|
||||
padding: EdgeInsets.all(_deviceBlockSize),
|
||||
decoration: BoxDecoration(
|
||||
shape: BoxShape.circle,
|
||||
color: Colors.black,
|
||||
),
|
||||
child: Icon(
|
||||
Icons.import_export,
|
||||
size: 10 * _deviceBlockSize,
|
||||
color: Colors.white,
|
||||
),
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
width: 2 * _deviceBlockSize,
|
||||
),
|
||||
InkWell(
|
||||
customBorder: CircleBorder(),
|
||||
onTap: () {
|
||||
|
||||
@@ -1,241 +1,241 @@
|
||||
import 'package:cssd/models/package_model.dart';
|
||||
import 'package:cssd/providers/packages.dart';
|
||||
import 'package:cssd/widgets/PackageScreens/Add/package_update_button.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 '../../widgets/Global/internet_error.dart';
|
||||
// import 'package:cssd/models/package_model.dart';
|
||||
// import 'package:cssd/providers/packages.dart';
|
||||
// import 'package:cssd/widgets/PackageScreens/Add/package_update_button.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 '../../widgets/Global/internet_error.dart';
|
||||
|
||||
class PackageUpdateScreen extends StatefulWidget {
|
||||
@override
|
||||
_PackageUpdateScreenState createState() => _PackageUpdateScreenState();
|
||||
}
|
||||
// class PackageUpdateScreen extends StatefulWidget {
|
||||
// @override
|
||||
// _PackageUpdateScreenState createState() => _PackageUpdateScreenState();
|
||||
// }
|
||||
|
||||
class _PackageUpdateScreenState extends State<PackageUpdateScreen> {
|
||||
final _udiFocusNode = FocusNode();
|
||||
final _descriptionFocusNode = FocusNode();
|
||||
TextEditingController nameCTRL = new TextEditingController();
|
||||
// TextEditingController udiCTRL = new TextEditingController();
|
||||
TextEditingController descriptionCTRL = new TextEditingController();
|
||||
TextEditingController itemCTRL = new TextEditingController();
|
||||
// class _PackageUpdateScreenState extends State<PackageUpdateScreen> {
|
||||
// final _udiFocusNode = FocusNode();
|
||||
// final _descriptionFocusNode = FocusNode();
|
||||
// TextEditingController nameCTRL = new TextEditingController();
|
||||
// // TextEditingController udiCTRL = new TextEditingController();
|
||||
// TextEditingController descriptionCTRL = new TextEditingController();
|
||||
// TextEditingController itemCTRL = new TextEditingController();
|
||||
|
||||
final _form = GlobalKey<FormState>();
|
||||
// final _form = GlobalKey<FormState>();
|
||||
|
||||
bool isEmpty = false;
|
||||
bool isInit = true;
|
||||
PackageDetailObject? datas;
|
||||
// bool isEmpty = false;
|
||||
// bool isInit = true;
|
||||
// PackageDetailObject? datas;
|
||||
|
||||
@override
|
||||
void didChangeDependencies() async {
|
||||
if (isInit) {
|
||||
var _id = ModalRoute.of(context)!.settings.arguments;
|
||||
await Provider.of<PackageProvider>(context, listen: false)
|
||||
.showPackageResult(_id.toString())
|
||||
.then(
|
||||
(result) {
|
||||
setState(
|
||||
() {
|
||||
datas = result;
|
||||
nameCTRL.text = datas!.name;
|
||||
// udiCTRL.text = datas!.udi;
|
||||
descriptionCTRL.text = datas!.description;
|
||||
for (String item in datas!.items) {
|
||||
itemCTRL.text = item;
|
||||
}
|
||||
},
|
||||
);
|
||||
},
|
||||
);
|
||||
await Provider.of<PackageProvider>(context, listen: false)
|
||||
.getItemFilters()
|
||||
.then(
|
||||
(result) {
|
||||
setState(
|
||||
() {
|
||||
isInit = false;
|
||||
},
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
super.didChangeDependencies();
|
||||
}
|
||||
// @override
|
||||
// void didChangeDependencies() async {
|
||||
// if (isInit) {
|
||||
// var _id = ModalRoute.of(context)!.settings.arguments;
|
||||
// await Provider.of<PackageProvider>(context, listen: false)
|
||||
// .showPackageResult(_id.toString())
|
||||
// .then(
|
||||
// (result) {
|
||||
// setState(
|
||||
// () {
|
||||
// datas = result;
|
||||
// nameCTRL.text = datas!.name;
|
||||
// // udiCTRL.text = datas!.udi;
|
||||
// descriptionCTRL.text = datas!.description;
|
||||
// for (String item in datas!.items) {
|
||||
// itemCTRL.text = item;
|
||||
// }
|
||||
// },
|
||||
// );
|
||||
// },
|
||||
// );
|
||||
// await Provider.of<PackageProvider>(context, listen: false)
|
||||
// .getItemFilters()
|
||||
// .then(
|
||||
// (result) {
|
||||
// setState(
|
||||
// () {
|
||||
// isInit = false;
|
||||
// },
|
||||
// );
|
||||
// },
|
||||
// );
|
||||
// }
|
||||
// super.didChangeDependencies();
|
||||
// }
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final _media = MediaQuery.of(context);
|
||||
final double _devicewidth = _media.size.width;
|
||||
final double _deviceBlockSize = _devicewidth / 100;
|
||||
return WillPopScope(
|
||||
onWillPop: () async {
|
||||
Navigator.pushReplacementNamed(
|
||||
context,
|
||||
Routes.packageResultScreen,
|
||||
);
|
||||
return true;
|
||||
},
|
||||
child: SafeArea(
|
||||
child: Scaffold(
|
||||
appBar: AppBar(
|
||||
titleSpacing: -10,
|
||||
backgroundColor: Colors.black,
|
||||
title: Text('Packages', style: TextStyle(color: Colors.white,),),
|
||||
leading: IconButton(
|
||||
icon: Icon(
|
||||
Icons.keyboard_arrow_left,
|
||||
color: Colors.white,
|
||||
size: 35,
|
||||
),
|
||||
onPressed: () => Navigator.of(context)
|
||||
.pushReplacementNamed(Routes.packageResultScreen),
|
||||
),
|
||||
),
|
||||
body: Consumer<ConnectivityProvider>(
|
||||
builder: (ct, connection, _) {
|
||||
return connection.conStatus != 'offline'
|
||||
? isInit
|
||||
? Center(
|
||||
child: CircularProgressIndicator(color: Colors.black),
|
||||
)
|
||||
: Form(
|
||||
key: _form,
|
||||
child: Padding(
|
||||
padding: EdgeInsets.all(20),
|
||||
child: ListView(
|
||||
children: <Widget>[
|
||||
Text(
|
||||
'Update a Package',
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.w700,
|
||||
fontSize: 6 * _deviceBlockSize,
|
||||
letterSpacing: 3,
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
height: 20,
|
||||
),
|
||||
TextFormField(
|
||||
validator: (val) {
|
||||
if (val!.isEmpty) {
|
||||
return 'Name required!';
|
||||
}
|
||||
return null;
|
||||
},
|
||||
controller: nameCTRL,
|
||||
decoration: InputDecoration(
|
||||
icon: Icon(FontAwesomeIcons.alignLeft,
|
||||
size: 7 * _deviceBlockSize),
|
||||
isDense: true,
|
||||
labelText: 'Package Name',
|
||||
contentPadding: EdgeInsets.symmetric(
|
||||
vertical: 2, horizontal: 3),
|
||||
labelStyle: TextStyle(
|
||||
fontWeight: FontWeight.w100,
|
||||
fontSize: 4 * _deviceBlockSize,
|
||||
),
|
||||
),
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.w700,
|
||||
fontSize: 5 * _deviceBlockSize,
|
||||
),
|
||||
keyboardType: TextInputType.text,
|
||||
textInputAction: TextInputAction.next,
|
||||
onFieldSubmitted: (_) {
|
||||
FocusScope.of(context)
|
||||
.requestFocus(_udiFocusNode);
|
||||
},
|
||||
),
|
||||
SizedBox(
|
||||
height: 20,
|
||||
),
|
||||
// TextFormField(
|
||||
// validator: (val) {
|
||||
// if (val!.isEmpty) {
|
||||
// return 'UDI required!';
|
||||
// }
|
||||
// return null;
|
||||
// },
|
||||
// controller: udiCTRL,
|
||||
// decoration: InputDecoration(
|
||||
// icon: Icon(
|
||||
// FontAwesomeIcons.alignLeft,
|
||||
// size: 7 * _deviceBlockSize,
|
||||
// ),
|
||||
// labelStyle: TextStyle(
|
||||
// fontWeight: FontWeight.w100,
|
||||
// fontSize: 4 * _deviceBlockSize,
|
||||
// ),
|
||||
// isDense: true,
|
||||
// labelText: 'UDI',
|
||||
// contentPadding: EdgeInsets.symmetric(
|
||||
// vertical: 2, horizontal: 3),
|
||||
// ),
|
||||
// style: TextStyle(
|
||||
// fontWeight: FontWeight.w700,
|
||||
// fontSize: 5 * _deviceBlockSize,
|
||||
// ),
|
||||
// focusNode: _udiFocusNode,
|
||||
// keyboardType: TextInputType.text,
|
||||
// textInputAction: TextInputAction.done,
|
||||
// onFieldSubmitted: (_) {
|
||||
// FocusScope.of(context)
|
||||
// .requestFocus(_descriptionFocusNode);
|
||||
// },
|
||||
// ),
|
||||
// SizedBox(
|
||||
// height: 20,
|
||||
// ),
|
||||
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: _descriptionFocusNode,
|
||||
minLines: 1,
|
||||
maxLines: 5,
|
||||
),
|
||||
SizedBox(
|
||||
height: 70,
|
||||
),
|
||||
PackageUpdateButton(
|
||||
form: _form,
|
||||
id: datas!.id,
|
||||
nameCTRL: nameCTRL,
|
||||
// udiCTRL: udiCTRL,
|
||||
itemCTRL: itemCTRL,
|
||||
deviceBlockSize: _deviceBlockSize,
|
||||
descriptionCTRL: descriptionCTRL,
|
||||
),
|
||||
SizedBox(
|
||||
height: 100,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
)
|
||||
: ConnectionErrorBox();
|
||||
},
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
// @override
|
||||
// Widget build(BuildContext context) {
|
||||
// final _media = MediaQuery.of(context);
|
||||
// final double _devicewidth = _media.size.width;
|
||||
// final double _deviceBlockSize = _devicewidth / 100;
|
||||
// return WillPopScope(
|
||||
// onWillPop: () async {
|
||||
// Navigator.pushReplacementNamed(
|
||||
// context,
|
||||
// Routes.packageResultScreen,
|
||||
// );
|
||||
// return true;
|
||||
// },
|
||||
// child: SafeArea(
|
||||
// child: Scaffold(
|
||||
// appBar: AppBar(
|
||||
// titleSpacing: -10,
|
||||
// backgroundColor: Colors.black,
|
||||
// title: Text('Packages', style: TextStyle(color: Colors.white,),),
|
||||
// leading: IconButton(
|
||||
// icon: Icon(
|
||||
// Icons.keyboard_arrow_left,
|
||||
// color: Colors.white,
|
||||
// size: 35,
|
||||
// ),
|
||||
// onPressed: () => Navigator.of(context)
|
||||
// .pushReplacementNamed(Routes.packageResultScreen),
|
||||
// ),
|
||||
// ),
|
||||
// body: Consumer<ConnectivityProvider>(
|
||||
// builder: (ct, connection, _) {
|
||||
// return connection.conStatus != 'offline'
|
||||
// ? isInit
|
||||
// ? Center(
|
||||
// child: CircularProgressIndicator(color: Colors.black),
|
||||
// )
|
||||
// : Form(
|
||||
// key: _form,
|
||||
// child: Padding(
|
||||
// padding: EdgeInsets.all(20),
|
||||
// child: ListView(
|
||||
// children: <Widget>[
|
||||
// Text(
|
||||
// 'Update a Package',
|
||||
// style: TextStyle(
|
||||
// fontWeight: FontWeight.w700,
|
||||
// fontSize: 6 * _deviceBlockSize,
|
||||
// letterSpacing: 3,
|
||||
// ),
|
||||
// ),
|
||||
// SizedBox(
|
||||
// height: 20,
|
||||
// ),
|
||||
// TextFormField(
|
||||
// validator: (val) {
|
||||
// if (val!.isEmpty) {
|
||||
// return 'Name required!';
|
||||
// }
|
||||
// return null;
|
||||
// },
|
||||
// controller: nameCTRL,
|
||||
// decoration: InputDecoration(
|
||||
// icon: Icon(FontAwesomeIcons.alignLeft,
|
||||
// size: 7 * _deviceBlockSize),
|
||||
// isDense: true,
|
||||
// labelText: 'Package Name',
|
||||
// contentPadding: EdgeInsets.symmetric(
|
||||
// vertical: 2, horizontal: 3),
|
||||
// labelStyle: TextStyle(
|
||||
// fontWeight: FontWeight.w100,
|
||||
// fontSize: 4 * _deviceBlockSize,
|
||||
// ),
|
||||
// ),
|
||||
// style: TextStyle(
|
||||
// fontWeight: FontWeight.w700,
|
||||
// fontSize: 5 * _deviceBlockSize,
|
||||
// ),
|
||||
// keyboardType: TextInputType.text,
|
||||
// textInputAction: TextInputAction.next,
|
||||
// onFieldSubmitted: (_) {
|
||||
// FocusScope.of(context)
|
||||
// .requestFocus(_udiFocusNode);
|
||||
// },
|
||||
// ),
|
||||
// SizedBox(
|
||||
// height: 20,
|
||||
// ),
|
||||
// // TextFormField(
|
||||
// // validator: (val) {
|
||||
// // if (val!.isEmpty) {
|
||||
// // return 'UDI required!';
|
||||
// // }
|
||||
// // return null;
|
||||
// // },
|
||||
// // controller: udiCTRL,
|
||||
// // decoration: InputDecoration(
|
||||
// // icon: Icon(
|
||||
// // FontAwesomeIcons.alignLeft,
|
||||
// // size: 7 * _deviceBlockSize,
|
||||
// // ),
|
||||
// // labelStyle: TextStyle(
|
||||
// // fontWeight: FontWeight.w100,
|
||||
// // fontSize: 4 * _deviceBlockSize,
|
||||
// // ),
|
||||
// // isDense: true,
|
||||
// // labelText: 'UDI',
|
||||
// // contentPadding: EdgeInsets.symmetric(
|
||||
// // vertical: 2, horizontal: 3),
|
||||
// // ),
|
||||
// // style: TextStyle(
|
||||
// // fontWeight: FontWeight.w700,
|
||||
// // fontSize: 5 * _deviceBlockSize,
|
||||
// // ),
|
||||
// // focusNode: _udiFocusNode,
|
||||
// // keyboardType: TextInputType.text,
|
||||
// // textInputAction: TextInputAction.done,
|
||||
// // onFieldSubmitted: (_) {
|
||||
// // FocusScope.of(context)
|
||||
// // .requestFocus(_descriptionFocusNode);
|
||||
// // },
|
||||
// // ),
|
||||
// // SizedBox(
|
||||
// // height: 20,
|
||||
// // ),
|
||||
// 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: _descriptionFocusNode,
|
||||
// minLines: 1,
|
||||
// maxLines: 5,
|
||||
// ),
|
||||
// SizedBox(
|
||||
// height: 70,
|
||||
// ),
|
||||
// PackageUpdateButton(
|
||||
// form: _form,
|
||||
// id: datas!.id,
|
||||
// nameCTRL: nameCTRL,
|
||||
// // udiCTRL: udiCTRL,
|
||||
// itemCTRL: itemCTRL,
|
||||
// deviceBlockSize: _deviceBlockSize,
|
||||
// descriptionCTRL: descriptionCTRL,
|
||||
// ),
|
||||
// SizedBox(
|
||||
// height: 100,
|
||||
// ),
|
||||
// ],
|
||||
// ),
|
||||
// ),
|
||||
// )
|
||||
// : ConnectionErrorBox();
|
||||
// },
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
// );
|
||||
// }
|
||||
// }
|
||||
|
||||
Reference in New Issue
Block a user