mirror of
https://git.meshkee.com/applications/cssd.git
synced 2026-10-13 01:58:56 +03:30
Comment some useless code of item detail
This commit is contained in:
@@ -1,105 +1,105 @@
|
||||
import 'package:cssd/models/item_model.dart';
|
||||
import 'package:cssd/providers/items.dart';
|
||||
import 'package:cssd/widgets/ItemScreens/Details/item_detail_box.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
import '../../config/routes.dart';
|
||||
import '../../providers/connectivity.dart';
|
||||
import '../../widgets/Global/internet_error.dart';
|
||||
|
||||
class ItemDetailScreen extends StatefulWidget {
|
||||
final String? testResultId;
|
||||
|
||||
ItemDetailScreen({
|
||||
this.testResultId,
|
||||
});
|
||||
|
||||
@override
|
||||
_ItemDetailScreenState createState() => _ItemDetailScreenState();
|
||||
}
|
||||
|
||||
class _ItemDetailScreenState extends State<ItemDetailScreen> {
|
||||
bool isInit = true;
|
||||
bool isEmpty = false;
|
||||
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(
|
||||
() {
|
||||
if (result.id == 'null') {
|
||||
isEmpty = true;
|
||||
}
|
||||
datas = 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 PopScope(
|
||||
canPop: false,
|
||||
onPopInvoked: (didPop) {
|
||||
if (didPop) return;
|
||||
Navigator.of(context).pop();
|
||||
},
|
||||
child: SafeArea(
|
||||
child: Scaffold(
|
||||
appBar: AppBar(
|
||||
titleSpacing: -10,
|
||||
title: Text(
|
||||
'Items',
|
||||
style: TextStyle(
|
||||
color: Colors.white,
|
||||
),
|
||||
),
|
||||
backgroundColor: Colors.black,
|
||||
leading: IconButton(
|
||||
icon: Icon(
|
||||
Icons.keyboard_arrow_left,
|
||||
color: Colors.white,
|
||||
size: 35,
|
||||
),
|
||||
onPressed: () => Navigator.of(context).pop(),
|
||||
),
|
||||
),
|
||||
body: Consumer<ConnectivityProvider>(
|
||||
builder: (ct, connection, _) {
|
||||
return connection.conStatus != 'offline'
|
||||
? isInit
|
||||
? Center(
|
||||
child: CircularProgressIndicator(
|
||||
color: Colors.black,
|
||||
),
|
||||
)
|
||||
: isEmpty
|
||||
? Center(
|
||||
child: Text('This Item does\'nt exists!'),
|
||||
)
|
||||
: ItemDetailsDataBox(
|
||||
datas: datas!,
|
||||
deviceBlockSize: _deviceBlockSize,
|
||||
)
|
||||
: ConnectionErrorBox();
|
||||
},
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
// import 'package:cssd/models/item_model.dart';
|
||||
// import 'package:cssd/providers/items.dart';
|
||||
// import 'package:cssd/widgets/ItemScreens/Details/item_detail_box.dart';
|
||||
// import 'package:flutter/material.dart';
|
||||
// import 'package:provider/provider.dart';
|
||||
//
|
||||
// import '../../config/routes.dart';
|
||||
// import '../../providers/connectivity.dart';
|
||||
// import '../../widgets/Global/internet_error.dart';
|
||||
//
|
||||
// class ItemDetailScreen extends StatefulWidget {
|
||||
// final String? testResultId;
|
||||
//
|
||||
// ItemDetailScreen({
|
||||
// this.testResultId,
|
||||
// });
|
||||
//
|
||||
// @override
|
||||
// _ItemDetailScreenState createState() => _ItemDetailScreenState();
|
||||
// }
|
||||
//
|
||||
// class _ItemDetailScreenState extends State<ItemDetailScreen> {
|
||||
// bool isInit = true;
|
||||
// bool isEmpty = false;
|
||||
// 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(
|
||||
// () {
|
||||
// if (result.id == 'null') {
|
||||
// isEmpty = true;
|
||||
// }
|
||||
// datas = 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 PopScope(
|
||||
// canPop: false,
|
||||
// onPopInvoked: (didPop) {
|
||||
// if (didPop) return;
|
||||
// Navigator.of(context).pop();
|
||||
// },
|
||||
// child: SafeArea(
|
||||
// child: Scaffold(
|
||||
// appBar: AppBar(
|
||||
// titleSpacing: -10,
|
||||
// title: Text(
|
||||
// 'Items',
|
||||
// style: TextStyle(
|
||||
// color: Colors.white,
|
||||
// ),
|
||||
// ),
|
||||
// backgroundColor: Colors.black,
|
||||
// leading: IconButton(
|
||||
// icon: Icon(
|
||||
// Icons.keyboard_arrow_left,
|
||||
// color: Colors.white,
|
||||
// size: 35,
|
||||
// ),
|
||||
// onPressed: () => Navigator.of(context).pop(),
|
||||
// ),
|
||||
// ),
|
||||
// body: Consumer<ConnectivityProvider>(
|
||||
// builder: (ct, connection, _) {
|
||||
// return connection.conStatus != 'offline'
|
||||
// ? isInit
|
||||
// ? Center(
|
||||
// child: CircularProgressIndicator(
|
||||
// color: Colors.black,
|
||||
// ),
|
||||
// )
|
||||
// : isEmpty
|
||||
// ? Center(
|
||||
// child: Text('This Item does\'nt exists!'),
|
||||
// )
|
||||
// : ItemDetailsDataBox(
|
||||
// datas: datas!,
|
||||
// deviceBlockSize: _deviceBlockSize,
|
||||
// )
|
||||
// : ConnectionErrorBox();
|
||||
// },
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
// );
|
||||
// }
|
||||
// }
|
||||
|
||||
@@ -8,18 +8,18 @@ import 'package:provider/provider.dart';
|
||||
import '../../providers/connectivity.dart';
|
||||
import '../../widgets/Global/internet_error.dart';
|
||||
|
||||
class MyItemsDetailScreen extends StatefulWidget {
|
||||
class ItemDetailScreen extends StatefulWidget {
|
||||
final String? testResultId;
|
||||
|
||||
MyItemsDetailScreen({
|
||||
ItemDetailScreen({
|
||||
this.testResultId,
|
||||
});
|
||||
|
||||
@override
|
||||
_MyItemsDetailScreenState createState() => _MyItemsDetailScreenState();
|
||||
_ItemDetailScreenState createState() => _ItemDetailScreenState();
|
||||
}
|
||||
|
||||
class _MyItemsDetailScreenState extends State<MyItemsDetailScreen> {
|
||||
class _ItemDetailScreenState extends State<ItemDetailScreen> {
|
||||
bool isInit = true;
|
||||
bool isEmpty = false;
|
||||
ItemDetailObject? datas;
|
||||
@@ -85,7 +85,7 @@ class _MyItemsDetailScreenState extends State<MyItemsDetailScreen> {
|
||||
? Center(
|
||||
child: Text('This Item does\'nt exists!'),
|
||||
)
|
||||
: MyItemsDetailsDataBox(
|
||||
: ItemDetailsDataBox(
|
||||
datas: datas!,
|
||||
deviceBlockSize: _deviceBlockSize,
|
||||
push: () {
|
||||
|
||||
Reference in New Issue
Block a user