Files
cssd/lib/pages/PackagePages/package_update_screen.dart
2023-12-09 17:52:53 +03:30

242 lines
11 KiB
Dart
Executable File

// 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 _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>();
// 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
// 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();
// },
// ),
// ),
// ),
// );
// }
// }