mirror of
https://git.meshkee.com/applications/cssd.git
synced 2026-10-11 11:18:56 +03:30
Back button of pages navigate to home
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
import '../../config/routes.dart';
|
||||
import '../../models/cycles_models.dart';
|
||||
import '../../providers/connectivity.dart';
|
||||
import '../../providers/cycles.dart';
|
||||
@@ -21,6 +22,7 @@ class _CycleDetailScreenState extends State<CycleDetailScreen> {
|
||||
bool isInit = true;
|
||||
bool isEmpty = false;
|
||||
CycleDetailObject? datas;
|
||||
|
||||
@override
|
||||
void didChangeDependencies() async {
|
||||
if (isInit) {
|
||||
@@ -50,39 +52,51 @@ class _CycleDetailScreenState extends State<CycleDetailScreen> {
|
||||
// final double _pixelRatio = (_media.size.height / _media.size.width * 7 / 5);
|
||||
final double _devicewidth = _media.size.width;
|
||||
final double _deviceBlockSize = _devicewidth / 100;
|
||||
return SafeArea(
|
||||
child: Scaffold(
|
||||
appBar: AppBar(
|
||||
titleSpacing: -10,
|
||||
title: Text('Cycles', style: TextStyle(color: Colors.white,),),
|
||||
backgroundColor: Colors.black,
|
||||
leading: IconButton(
|
||||
icon: Icon(
|
||||
Icons.keyboard_arrow_left,
|
||||
color: Colors.white,
|
||||
size: 35,
|
||||
return PopScope(
|
||||
canPop: false,
|
||||
onPopInvoked: (didPop) {
|
||||
if (didPop) return;
|
||||
Navigator.of(context).pushNamed(Routes.homePage);
|
||||
},
|
||||
child: SafeArea(
|
||||
child: Scaffold(
|
||||
appBar: AppBar(
|
||||
titleSpacing: -10,
|
||||
title: Text(
|
||||
'Cycles',
|
||||
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(),
|
||||
),
|
||||
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 Cycle doesnt exists!'),
|
||||
)
|
||||
: CycleDetailsDataBox(
|
||||
datas: datas!,
|
||||
deviceBlockSize: _deviceBlockSize,
|
||||
)
|
||||
: ConnectionErrorBox();
|
||||
}),
|
||||
),
|
||||
body: Consumer<ConnectivityProvider>(builder: (ct, connection, _) {
|
||||
return connection.conStatus != 'offline'
|
||||
? isInit
|
||||
? Center(
|
||||
child: CircularProgressIndicator(
|
||||
color: Colors.black,
|
||||
),
|
||||
)
|
||||
: isEmpty
|
||||
? Center(
|
||||
child: Text('This Cycle doesnt exists!'),
|
||||
)
|
||||
: CycleDetailsDataBox(
|
||||
datas: datas!,
|
||||
deviceBlockSize: _deviceBlockSize,
|
||||
)
|
||||
: ConnectionErrorBox();
|
||||
}),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ 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';
|
||||
|
||||
@@ -22,6 +23,7 @@ class _ItemDetailScreenState extends State<ItemDetailScreen> {
|
||||
bool isInit = true;
|
||||
bool isEmpty = false;
|
||||
ItemDetailObject? datas;
|
||||
|
||||
@override
|
||||
void didChangeDependencies() async {
|
||||
if (isInit) {
|
||||
@@ -50,40 +52,52 @@ class _ItemDetailScreenState extends State<ItemDetailScreen> {
|
||||
final _media = MediaQuery.of(context);
|
||||
final double _devicewidth = _media.size.width;
|
||||
final double _deviceBlockSize = _devicewidth / 100;
|
||||
return 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,
|
||||
return PopScope(
|
||||
canPop: false,
|
||||
onPopInvoked: (didPop) {
|
||||
if (didPop) return;
|
||||
Navigator.of(context).pushNamed(Routes.homePage);
|
||||
},
|
||||
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(),
|
||||
),
|
||||
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();
|
||||
},
|
||||
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();
|
||||
},
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import '../../config/routes.dart';
|
||||
import '../../models/label_models.dart';
|
||||
import '../../providers/connectivity.dart';
|
||||
import '../../providers/labels.dart';
|
||||
@@ -20,6 +21,7 @@ class _LabelDetailScreenState extends State<LabelDetailScreen> {
|
||||
bool isEmpty = false;
|
||||
bool isInit = true;
|
||||
LabelDetailsObject? datas;
|
||||
|
||||
@override
|
||||
void didChangeDependencies() async {
|
||||
if (isInit) {
|
||||
@@ -50,39 +52,51 @@ class _LabelDetailScreenState extends State<LabelDetailScreen> {
|
||||
// final double _pixelRatio = (_media.size.height / _media.size.width * 7 / 5);
|
||||
final double _devicewidth = _media.size.width;
|
||||
final double _deviceBlockSize = _devicewidth / 100;
|
||||
return SafeArea(
|
||||
child: Scaffold(
|
||||
appBar: AppBar(
|
||||
titleSpacing: -10,
|
||||
title: Text('Labels', style: TextStyle(color: Colors.white,),),
|
||||
backgroundColor: Colors.black,
|
||||
leading: IconButton(
|
||||
icon: Icon(
|
||||
Icons.keyboard_arrow_left,
|
||||
color: Colors.white,
|
||||
size: 35,
|
||||
return PopScope(
|
||||
canPop: false,
|
||||
onPopInvoked: (didPop) {
|
||||
if (didPop) return;
|
||||
Navigator.of(context).pushNamed(Routes.homePage);
|
||||
},
|
||||
child: SafeArea(
|
||||
child: Scaffold(
|
||||
appBar: AppBar(
|
||||
titleSpacing: -10,
|
||||
title: Text(
|
||||
'Labels',
|
||||
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(),
|
||||
),
|
||||
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 Label dos\'nt exists!'),
|
||||
)
|
||||
: LabelDetailsDataBox(
|
||||
datas: datas!,
|
||||
deviceBlockSize: _deviceBlockSize,
|
||||
)
|
||||
: ConnectionErrorBox();
|
||||
}),
|
||||
),
|
||||
body: Consumer<ConnectivityProvider>(builder: (ct, connection, _) {
|
||||
return connection.conStatus != 'offline'
|
||||
? isInit
|
||||
? Center(
|
||||
child: CircularProgressIndicator(
|
||||
color: Colors.black,
|
||||
),
|
||||
)
|
||||
: isEmpty
|
||||
? Center(
|
||||
child: Text('This Label dos\'nt exists!'),
|
||||
)
|
||||
: LabelDetailsDataBox(
|
||||
datas: datas!,
|
||||
deviceBlockSize: _deviceBlockSize,
|
||||
)
|
||||
: ConnectionErrorBox();
|
||||
}),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -23,6 +23,7 @@ class _MyItemsDetailScreenState extends State<MyItemsDetailScreen> {
|
||||
bool isInit = true;
|
||||
bool isEmpty = false;
|
||||
ItemDetailObject? datas;
|
||||
|
||||
@override
|
||||
void didChangeDependencies() async {
|
||||
if (isInit) {
|
||||
@@ -51,45 +52,57 @@ class _MyItemsDetailScreenState extends State<MyItemsDetailScreen> {
|
||||
final _media = MediaQuery.of(context);
|
||||
final double _devicewidth = _media.size.width;
|
||||
final double _deviceBlockSize = _devicewidth / 100;
|
||||
return SafeArea(
|
||||
child: Scaffold(
|
||||
appBar: AppBar(
|
||||
titleSpacing: -10,
|
||||
title: Text('My Items', style: TextStyle(color: Colors.white,),),
|
||||
backgroundColor: Colors.black,
|
||||
leading: IconButton(
|
||||
icon: Icon(
|
||||
Icons.keyboard_arrow_left,
|
||||
color: Colors.white,
|
||||
size: 35,
|
||||
return PopScope(
|
||||
canPop: false,
|
||||
onPopInvoked: (didPop) {
|
||||
if (didPop) return;
|
||||
Navigator.of(context).pushNamed(Routes.homePage);
|
||||
},
|
||||
child: SafeArea(
|
||||
child: Scaffold(
|
||||
appBar: AppBar(
|
||||
titleSpacing: -10,
|
||||
title: Text(
|
||||
'My 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(),
|
||||
),
|
||||
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!'),
|
||||
)
|
||||
: MyItemsDetailsDataBox(
|
||||
datas: datas!,
|
||||
deviceBlockSize: _deviceBlockSize,
|
||||
push: () {
|
||||
Navigator.pushNamed(
|
||||
context, Routes.itemsTransferScreen,
|
||||
arguments: datas);
|
||||
},
|
||||
)
|
||||
: ConnectionErrorBox();
|
||||
},
|
||||
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!'),
|
||||
)
|
||||
: MyItemsDetailsDataBox(
|
||||
datas: datas!,
|
||||
deviceBlockSize: _deviceBlockSize,
|
||||
push: () {
|
||||
Navigator.pushNamed(
|
||||
context, Routes.itemsTransferScreen,
|
||||
arguments: datas);
|
||||
},
|
||||
)
|
||||
: ConnectionErrorBox();
|
||||
},
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
@@ -14,7 +14,6 @@ import 'package:flutter/material.dart';
|
||||
import 'package:fluttertoast/fluttertoast.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
|
||||
class ItemsTransferScreen extends StatefulWidget {
|
||||
final bool? isAdmin;
|
||||
final ItemDetailObject? items;
|
||||
@@ -80,240 +79,250 @@ class _ItemsTransferScreenState extends State<ItemsTransferScreen> {
|
||||
final _media = MediaQuery.of(context);
|
||||
final double _deviceWidth = _media.size.width;
|
||||
final double _deviceBlockSize = _deviceWidth / 100;
|
||||
return SafeArea(
|
||||
child: GestureDetector(
|
||||
onTap: () {
|
||||
FocusManager.instance.primaryFocus?.unfocus();
|
||||
},
|
||||
child: Scaffold(
|
||||
appBar: AppBar(
|
||||
titleSpacing: -10,
|
||||
title: Text(
|
||||
'Item Details',
|
||||
style: TextStyle(
|
||||
color: Colors.white,
|
||||
return PopScope(
|
||||
canPop: false,
|
||||
onPopInvoked: (didPop) {
|
||||
if (didPop) return;
|
||||
Navigator.of(context).pushNamed(Routes.homePage);
|
||||
},
|
||||
child: SafeArea(
|
||||
child: GestureDetector(
|
||||
onTap: () {
|
||||
FocusManager.instance.primaryFocus?.unfocus();
|
||||
},
|
||||
child: Scaffold(
|
||||
appBar: AppBar(
|
||||
titleSpacing: -10,
|
||||
title: Text(
|
||||
'Item Details',
|
||||
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(),
|
||||
),
|
||||
),
|
||||
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'
|
||||
? Padding(
|
||||
padding: EdgeInsets.only(
|
||||
top: 20,
|
||||
right: 20,
|
||||
bottom: 40,
|
||||
left: 20,
|
||||
),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
ResultBanner(
|
||||
deviceBlockSize: _deviceBlockSize,
|
||||
text: 'Transfer to',
|
||||
hasFilterObject: false,
|
||||
push: Routes.myItemsFilterScreen,
|
||||
),
|
||||
SizedBox(
|
||||
height: 20.0,
|
||||
),
|
||||
ResultSearchBox(
|
||||
searchCTRL: searchCTRL,
|
||||
text: 'user',
|
||||
text2: 'name or ID',
|
||||
deviceBlockSize: _deviceBlockSize,
|
||||
textInputType: TextInputType.visiblePassword,
|
||||
onChanged: (value) {
|
||||
Provider.of<UsersProvider>(context, listen: false)
|
||||
.searchUsers(value);
|
||||
},
|
||||
),
|
||||
SizedBox(
|
||||
height: 20,
|
||||
),
|
||||
Expanded(
|
||||
child: Consumer<UsersProvider>(
|
||||
builder: (context, userResults, _) {
|
||||
return userResults.isLoading
|
||||
? Center(
|
||||
child: CircularProgressIndicator(
|
||||
color: Colors.black,
|
||||
),
|
||||
)
|
||||
: userResults.usersBox?.length != null
|
||||
? ListView.builder(
|
||||
controller: sc,
|
||||
itemBuilder: (context, index) {
|
||||
return TransferDataBox(
|
||||
deviceBlockSize:
|
||||
_deviceBlockSize,
|
||||
user: userResults
|
||||
.usersBox?[index],
|
||||
clickColor: kDarkBlue,
|
||||
isClicked: userResults
|
||||
.selectedUserIndex ==
|
||||
index,
|
||||
onTap: (userId) {
|
||||
Provider.of<UsersProvider>(
|
||||
context,
|
||||
listen: false,
|
||||
).selectUser(index);
|
||||
print(userId);
|
||||
Provider.of<UsersProvider>(
|
||||
context,
|
||||
listen: false)
|
||||
.saveUserId = userId;
|
||||
Provider.of<UsersProvider>(
|
||||
context,
|
||||
listen: false)
|
||||
.selectedUserForItems =
|
||||
userResults
|
||||
.usersBox?[index];
|
||||
},
|
||||
);
|
||||
},
|
||||
itemCount:
|
||||
userResults.usersBox?.length,
|
||||
shrinkWrap: true,
|
||||
)
|
||||
: Container(
|
||||
child: Center(
|
||||
child: Text(
|
||||
"There is no user to show."),
|
||||
),
|
||||
);
|
||||
body: Consumer<ConnectivityProvider>(
|
||||
builder: (ct, connection, _) {
|
||||
return connection.conStatus != 'offline'
|
||||
? Padding(
|
||||
padding: EdgeInsets.only(
|
||||
top: 20,
|
||||
right: 20,
|
||||
bottom: 40,
|
||||
left: 20,
|
||||
),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
ResultBanner(
|
||||
deviceBlockSize: _deviceBlockSize,
|
||||
text: 'Transfer to',
|
||||
hasFilterObject: false,
|
||||
push: Routes.myItemsFilterScreen,
|
||||
),
|
||||
SizedBox(
|
||||
height: 20.0,
|
||||
),
|
||||
ResultSearchBox(
|
||||
searchCTRL: searchCTRL,
|
||||
text: 'user',
|
||||
text2: 'name or ID',
|
||||
deviceBlockSize: _deviceBlockSize,
|
||||
textInputType: TextInputType.visiblePassword,
|
||||
onChanged: (value) {
|
||||
Provider.of<UsersProvider>(context,
|
||||
listen: false)
|
||||
.searchUsers(value);
|
||||
},
|
||||
),
|
||||
),
|
||||
TransferDestroyButton(
|
||||
deviceBlockSize: _deviceBlockSize,
|
||||
firstColor: kDarkBlue,
|
||||
secondColor: kDarkBlueSub,
|
||||
onTap: () {
|
||||
showDialog(
|
||||
context: context,
|
||||
builder: (context) {
|
||||
return AlertDialog(
|
||||
title: Text(
|
||||
'Are you sure to transfer this Item?',
|
||||
style: TextStyle(
|
||||
fontSize: 4 * _deviceBlockSize,
|
||||
),
|
||||
),
|
||||
content: SizedBox(
|
||||
width: _deviceBlockSize,
|
||||
height: 320,
|
||||
child: Column(
|
||||
children: [
|
||||
Text(
|
||||
'By approving, your item will be transferred the specified user. It can be undone unless the user reject the transfer.',
|
||||
style: TextStyle(
|
||||
fontSize: 3 * _deviceBlockSize,
|
||||
),
|
||||
SizedBox(
|
||||
height: 20,
|
||||
),
|
||||
Expanded(
|
||||
child: Consumer<UsersProvider>(
|
||||
builder: (context, userResults, _) {
|
||||
return userResults.isLoading
|
||||
? Center(
|
||||
child: CircularProgressIndicator(
|
||||
color: Colors.black,
|
||||
),
|
||||
SizedBox(
|
||||
height: 10.0,
|
||||
),
|
||||
ItemCard(_deviceBlockSize, itemData!),
|
||||
SizedBox(
|
||||
height: 5.0,
|
||||
),
|
||||
Row(
|
||||
children: [
|
||||
Spacer(),
|
||||
Text('To'),
|
||||
SizedBox(
|
||||
width: 5.0,
|
||||
),
|
||||
TransferDataBox(
|
||||
deviceBlockSize:
|
||||
_deviceBlockSize,
|
||||
user:
|
||||
)
|
||||
: userResults.usersBox?.length != null
|
||||
? ListView.builder(
|
||||
controller: sc,
|
||||
itemBuilder: (context, index) {
|
||||
return TransferDataBox(
|
||||
deviceBlockSize:
|
||||
_deviceBlockSize,
|
||||
user: userResults
|
||||
.usersBox?[index],
|
||||
clickColor: kDarkBlue,
|
||||
isClicked: userResults
|
||||
.selectedUserIndex ==
|
||||
index,
|
||||
onTap: (userId) {
|
||||
Provider.of<UsersProvider>(
|
||||
context,
|
||||
listen: false,
|
||||
).selectUser(index);
|
||||
print(userId);
|
||||
Provider.of<UsersProvider>(
|
||||
context)
|
||||
.selectedUserForItems,
|
||||
)
|
||||
],
|
||||
),
|
||||
SizedBox(
|
||||
height: 20.0,
|
||||
),
|
||||
Consumer<MyItemProvider>(
|
||||
builder:
|
||||
(context, myItemProvider, _) {
|
||||
return TransferDestroyButton(
|
||||
deviceBlockSize:
|
||||
_deviceBlockSize,
|
||||
firstColor: kDarkBlue,
|
||||
secondColor: kDarkBlueSub,
|
||||
onTap: () async {
|
||||
myItemProvider
|
||||
.setLoadingButton();
|
||||
await Provider.of<
|
||||
MyItemProvider>(
|
||||
context,
|
||||
listen: false,
|
||||
).transferItems(
|
||||
itemData!.id,
|
||||
await Provider.of<
|
||||
UsersProvider>(
|
||||
context,
|
||||
listen: false)
|
||||
.saveUserId!,
|
||||
);
|
||||
Navigator.of(context).pop();
|
||||
Navigator.of(context).pop();
|
||||
Navigator.of(context).pop();
|
||||
myItemProvider
|
||||
.resetLoadingButton();
|
||||
Fluttertoast.showToast(
|
||||
msg:
|
||||
"The item is transferred.",
|
||||
toastLength:
|
||||
Toast.LENGTH_SHORT,
|
||||
gravity:
|
||||
ToastGravity.BOTTOM,
|
||||
);
|
||||
},
|
||||
text: 'Transfer',
|
||||
isLoadingButton: myItemProvider
|
||||
.isloadingButton,
|
||||
);
|
||||
},
|
||||
),
|
||||
SizedBox(
|
||||
height: 5.0,
|
||||
),
|
||||
CancelTransferButton(
|
||||
deviceBlockSize: _deviceBlockSize,
|
||||
color: kPink,
|
||||
onTap: () {
|
||||
Navigator.pop(context);
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
.saveUserId = userId;
|
||||
Provider.of<UsersProvider>(
|
||||
context,
|
||||
listen: false)
|
||||
.selectedUserForItems =
|
||||
userResults
|
||||
.usersBox?[index];
|
||||
},
|
||||
);
|
||||
},
|
||||
itemCount:
|
||||
userResults.usersBox?.length,
|
||||
shrinkWrap: true,
|
||||
)
|
||||
: Container(
|
||||
child: Center(
|
||||
child: Text(
|
||||
"There is no user to show."),
|
||||
),
|
||||
);
|
||||
},
|
||||
);
|
||||
},
|
||||
text: 'Transfer',
|
||||
),
|
||||
],
|
||||
),
|
||||
)
|
||||
: ConnectionErrorBox();
|
||||
},
|
||||
),
|
||||
),
|
||||
TransferDestroyButton(
|
||||
deviceBlockSize: _deviceBlockSize,
|
||||
firstColor: kDarkBlue,
|
||||
secondColor: kDarkBlueSub,
|
||||
onTap: () {
|
||||
showDialog(
|
||||
context: context,
|
||||
builder: (context) {
|
||||
return AlertDialog(
|
||||
title: Text(
|
||||
'Are you sure to transfer this Item?',
|
||||
style: TextStyle(
|
||||
fontSize: 4 * _deviceBlockSize,
|
||||
),
|
||||
),
|
||||
content: SizedBox(
|
||||
width: _deviceBlockSize,
|
||||
height: 320,
|
||||
child: Column(
|
||||
children: [
|
||||
Text(
|
||||
'By approving, your item will be transferred the specified user. It can be undone unless the user reject the transfer.',
|
||||
style: TextStyle(
|
||||
fontSize: 3 * _deviceBlockSize,
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
height: 10.0,
|
||||
),
|
||||
ItemCard(
|
||||
_deviceBlockSize, itemData!),
|
||||
SizedBox(
|
||||
height: 5.0,
|
||||
),
|
||||
Row(
|
||||
children: [
|
||||
Spacer(),
|
||||
Text('To'),
|
||||
SizedBox(
|
||||
width: 5.0,
|
||||
),
|
||||
TransferDataBox(
|
||||
deviceBlockSize:
|
||||
_deviceBlockSize,
|
||||
user: Provider.of<
|
||||
UsersProvider>(
|
||||
context)
|
||||
.selectedUserForItems,
|
||||
)
|
||||
],
|
||||
),
|
||||
SizedBox(
|
||||
height: 20.0,
|
||||
),
|
||||
Consumer<MyItemProvider>(
|
||||
builder:
|
||||
(context, myItemProvider, _) {
|
||||
return TransferDestroyButton(
|
||||
deviceBlockSize:
|
||||
_deviceBlockSize,
|
||||
firstColor: kDarkBlue,
|
||||
secondColor: kDarkBlueSub,
|
||||
onTap: () async {
|
||||
myItemProvider
|
||||
.setLoadingButton();
|
||||
await Provider.of<
|
||||
MyItemProvider>(
|
||||
context,
|
||||
listen: false,
|
||||
).transferItems(
|
||||
itemData!.id,
|
||||
await Provider.of<
|
||||
UsersProvider>(
|
||||
context,
|
||||
listen: false)
|
||||
.saveUserId!,
|
||||
);
|
||||
Navigator.of(context).pop();
|
||||
Navigator.of(context).pop();
|
||||
Navigator.of(context).pop();
|
||||
myItemProvider
|
||||
.resetLoadingButton();
|
||||
Fluttertoast.showToast(
|
||||
msg:
|
||||
"The item is transferred.",
|
||||
toastLength:
|
||||
Toast.LENGTH_SHORT,
|
||||
gravity:
|
||||
ToastGravity.BOTTOM,
|
||||
);
|
||||
},
|
||||
text: 'Transfer',
|
||||
isLoadingButton:
|
||||
myItemProvider
|
||||
.isloadingButton,
|
||||
);
|
||||
},
|
||||
),
|
||||
SizedBox(
|
||||
height: 5.0,
|
||||
),
|
||||
CancelTransferButton(
|
||||
deviceBlockSize: _deviceBlockSize,
|
||||
color: kPink,
|
||||
onTap: () {
|
||||
Navigator.pop(context);
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
);
|
||||
},
|
||||
text: 'Transfer',
|
||||
),
|
||||
],
|
||||
),
|
||||
)
|
||||
: ConnectionErrorBox();
|
||||
},
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
@@ -23,6 +23,7 @@ class _MyPackagesDetailScreenState extends State<MyPackagesDetailScreen> {
|
||||
bool isInit = true;
|
||||
bool isEmpty = false;
|
||||
PackageDetailObject? datas;
|
||||
|
||||
@override
|
||||
void didChangeDependencies() async {
|
||||
if (isInit) {
|
||||
@@ -51,45 +52,57 @@ class _MyPackagesDetailScreenState extends State<MyPackagesDetailScreen> {
|
||||
final _media = MediaQuery.of(context);
|
||||
final double _deviceWidth = _media.size.width;
|
||||
final double _deviceBlockSize = _deviceWidth / 100;
|
||||
return SafeArea(
|
||||
child: Scaffold(
|
||||
appBar: AppBar(
|
||||
titleSpacing: -10,
|
||||
title: Text('My Packages', style: TextStyle(color: Colors.white,),),
|
||||
backgroundColor: Colors.black,
|
||||
leading: IconButton(
|
||||
icon: Icon(
|
||||
Icons.keyboard_arrow_left,
|
||||
color: Colors.white,
|
||||
size: 35,
|
||||
return PopScope(
|
||||
canPop: false,
|
||||
onPopInvoked: (didPop) {
|
||||
if (didPop) return;
|
||||
Navigator.of(context).pushNamed(Routes.homePage);
|
||||
},
|
||||
child: SafeArea(
|
||||
child: Scaffold(
|
||||
appBar: AppBar(
|
||||
titleSpacing: -10,
|
||||
title: Text(
|
||||
'My Packages',
|
||||
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(),
|
||||
),
|
||||
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 Package does\'nt exists!'),
|
||||
)
|
||||
: MyPackageDetailsDataBox(
|
||||
datas: datas!,
|
||||
deviceBlockSize: _deviceBlockSize,
|
||||
push: () {
|
||||
Navigator.pushNamed(
|
||||
context, Routes.packagesTransferScreen,
|
||||
arguments: datas);
|
||||
},
|
||||
)
|
||||
: ConnectionErrorBox();
|
||||
},
|
||||
body: Consumer<ConnectivityProvider>(
|
||||
builder: (ct, connection, _) {
|
||||
return connection.conStatus != 'offline'
|
||||
? isInit
|
||||
? Center(
|
||||
child: CircularProgressIndicator(
|
||||
color: Colors.black,
|
||||
),
|
||||
)
|
||||
: isEmpty
|
||||
? Center(
|
||||
child: Text('This Package does\'nt exists!'),
|
||||
)
|
||||
: MyPackageDetailsDataBox(
|
||||
datas: datas!,
|
||||
deviceBlockSize: _deviceBlockSize,
|
||||
push: () {
|
||||
Navigator.pushNamed(
|
||||
context, Routes.packagesTransferScreen,
|
||||
arguments: datas);
|
||||
},
|
||||
)
|
||||
: ConnectionErrorBox();
|
||||
},
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
@@ -16,6 +16,7 @@ import 'package:provider/provider.dart';
|
||||
class PackageTransferScreen extends StatefulWidget {
|
||||
final bool? isAdmin;
|
||||
final PackageDetailObject? packages;
|
||||
|
||||
const PackageTransferScreen({
|
||||
super.key,
|
||||
this.isAdmin,
|
||||
@@ -73,203 +74,220 @@ class _PackageTransferScreenState extends State<PackageTransferScreen> {
|
||||
final _media = MediaQuery.of(context);
|
||||
final double _deviceWidth = _media.size.width;
|
||||
final double _deviceBlockSize = _deviceWidth / 100;
|
||||
return SafeArea(
|
||||
child: GestureDetector(
|
||||
onTap: () {
|
||||
FocusManager.instance.primaryFocus?.unfocus();
|
||||
},
|
||||
child: Scaffold(
|
||||
appBar: AppBar(
|
||||
titleSpacing: -10,
|
||||
title: Text('Package Details', style: TextStyle(color: Colors.white,),),
|
||||
backgroundColor: Colors.black,
|
||||
leading: IconButton(
|
||||
icon: Icon(
|
||||
Icons.keyboard_arrow_left,
|
||||
color: Colors.white,
|
||||
size: 35,
|
||||
return PopScope(
|
||||
canPop: false,
|
||||
onPopInvoked: (didPop) {
|
||||
if (didPop) return;
|
||||
Navigator.of(context).pushNamed(Routes.homePage);
|
||||
},
|
||||
child: SafeArea(
|
||||
child: GestureDetector(
|
||||
onTap: () {
|
||||
FocusManager.instance.primaryFocus?.unfocus();
|
||||
},
|
||||
child: Scaffold(
|
||||
appBar: AppBar(
|
||||
titleSpacing: -10,
|
||||
title: Text(
|
||||
'Package Details',
|
||||
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(),
|
||||
),
|
||||
onPressed: () => Navigator.of(context).pop(),
|
||||
),
|
||||
),
|
||||
body: Consumer<ConnectivityProvider>(
|
||||
builder: (ct, connection, _) {
|
||||
return connection.conStatus != 'offline'
|
||||
? Padding(
|
||||
padding: EdgeInsets.only(
|
||||
top: 20,
|
||||
right: 20,
|
||||
bottom: 40,
|
||||
left: 20,
|
||||
),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
ResultBanner(
|
||||
deviceBlockSize: _deviceBlockSize,
|
||||
text: 'Transfer to',
|
||||
hasFilterObject: false,
|
||||
push: Routes.myItemsFilterScreen,
|
||||
),
|
||||
SizedBox(
|
||||
height: 20.0,
|
||||
),
|
||||
ResultSearchBox(
|
||||
searchCTRL: searchCTRL,
|
||||
text: 'user',
|
||||
text2: 'name or ID',
|
||||
deviceBlockSize: _deviceBlockSize,
|
||||
textInputType: TextInputType.visiblePassword,
|
||||
onChanged: (value) {
|
||||
Provider.of<UsersProvider>(context, listen: false)
|
||||
.searchUsers(value);
|
||||
},
|
||||
),
|
||||
SizedBox(
|
||||
height: 20,
|
||||
),
|
||||
Expanded(
|
||||
child: Consumer<UsersProvider>(
|
||||
builder: (context, userResults, _) {
|
||||
return userResults.isLoading
|
||||
? Center(
|
||||
child: CircularProgressIndicator(
|
||||
color: Colors.black,
|
||||
),
|
||||
)
|
||||
: ListView.builder(
|
||||
controller: sc,
|
||||
itemBuilder: (context, index) {
|
||||
return TransferDataBox(
|
||||
deviceBlockSize: _deviceBlockSize,
|
||||
user: userResults.usersBox?[index],
|
||||
clickColor: kDarkPurple,
|
||||
isClicked:
|
||||
userResults.selectedUserIndex ==
|
||||
index,
|
||||
onTap: (userId) {
|
||||
Provider.of<UsersProvider>(
|
||||
context,
|
||||
listen: false,
|
||||
).selectUser(index);
|
||||
print(userId);
|
||||
Provider.of<UsersProvider>(
|
||||
context,
|
||||
listen: false)
|
||||
.saveUserId = userId;
|
||||
Provider.of<UsersProvider>(
|
||||
context,
|
||||
listen: false)
|
||||
.selectedUserForPackages =
|
||||
userResults.usersBox?[index];
|
||||
},
|
||||
);
|
||||
},
|
||||
itemCount: userResults.usersBox?.length,
|
||||
shrinkWrap: true,
|
||||
);
|
||||
body: Consumer<ConnectivityProvider>(
|
||||
builder: (ct, connection, _) {
|
||||
return connection.conStatus != 'offline'
|
||||
? Padding(
|
||||
padding: EdgeInsets.only(
|
||||
top: 20,
|
||||
right: 20,
|
||||
bottom: 40,
|
||||
left: 20,
|
||||
),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
ResultBanner(
|
||||
deviceBlockSize: _deviceBlockSize,
|
||||
text: 'Transfer to',
|
||||
hasFilterObject: false,
|
||||
push: Routes.myItemsFilterScreen,
|
||||
),
|
||||
SizedBox(
|
||||
height: 20.0,
|
||||
),
|
||||
ResultSearchBox(
|
||||
searchCTRL: searchCTRL,
|
||||
text: 'user',
|
||||
text2: 'name or ID',
|
||||
deviceBlockSize: _deviceBlockSize,
|
||||
textInputType: TextInputType.visiblePassword,
|
||||
onChanged: (value) {
|
||||
Provider.of<UsersProvider>(context,
|
||||
listen: false)
|
||||
.searchUsers(value);
|
||||
},
|
||||
),
|
||||
),
|
||||
TransferDestroyButton(
|
||||
deviceBlockSize: _deviceBlockSize,
|
||||
firstColor: kDarkPurple,
|
||||
secondColor: kDarkPurpleSub,
|
||||
onTap: () {
|
||||
showDialog(
|
||||
context: context,
|
||||
builder: (context) {
|
||||
return AlertDialog(
|
||||
title: Text(
|
||||
'Are you sure to transfer this Package?',
|
||||
style: TextStyle(
|
||||
fontSize: 4 * _deviceBlockSize,
|
||||
),
|
||||
),
|
||||
content: SizedBox(
|
||||
width: _deviceBlockSize,
|
||||
height: 300,
|
||||
child: Column(
|
||||
children: [
|
||||
Text(
|
||||
'By approving, all items in your package will be transferred the specified user. it can be undone unless the user reject the transfer.',
|
||||
style: TextStyle(
|
||||
fontSize: 3 * _deviceBlockSize,
|
||||
),
|
||||
SizedBox(
|
||||
height: 20,
|
||||
),
|
||||
Expanded(
|
||||
child: Consumer<UsersProvider>(
|
||||
builder: (context, userResults, _) {
|
||||
return userResults.isLoading
|
||||
? Center(
|
||||
child: CircularProgressIndicator(
|
||||
color: Colors.black,
|
||||
),
|
||||
SizedBox(
|
||||
height: 10.0,
|
||||
),
|
||||
PackageCard(
|
||||
_deviceBlockSize, packageData!),
|
||||
SizedBox(
|
||||
height: 5.0,
|
||||
),
|
||||
Row(
|
||||
children: [
|
||||
Spacer(),
|
||||
Text('To'),
|
||||
SizedBox(
|
||||
width: 5.0,
|
||||
),
|
||||
TransferDataBox(
|
||||
deviceBlockSize:
|
||||
_deviceBlockSize,
|
||||
user: Provider.of<
|
||||
UsersProvider>(context)
|
||||
.selectedUserForPackages,
|
||||
)
|
||||
],
|
||||
),
|
||||
SizedBox(
|
||||
height: 20.0,
|
||||
),
|
||||
TransferDestroyButton(
|
||||
deviceBlockSize: _deviceBlockSize,
|
||||
firstColor: kDarkPurple,
|
||||
secondColor: kDarkPurpleSub,
|
||||
onTap: () {
|
||||
Provider.of<MyPackageProvider>(
|
||||
context,
|
||||
listen: false,
|
||||
).transferPackage(
|
||||
packageData!.id,
|
||||
)
|
||||
: ListView.builder(
|
||||
controller: sc,
|
||||
itemBuilder: (context, index) {
|
||||
return TransferDataBox(
|
||||
deviceBlockSize: _deviceBlockSize,
|
||||
user:
|
||||
userResults.usersBox?[index],
|
||||
clickColor: kDarkPurple,
|
||||
isClicked: userResults
|
||||
.selectedUserIndex ==
|
||||
index,
|
||||
onTap: (userId) {
|
||||
Provider.of<UsersProvider>(
|
||||
context,
|
||||
listen: false,
|
||||
).selectUser(index);
|
||||
print(userId);
|
||||
Provider.of<UsersProvider>(
|
||||
context,
|
||||
listen: false)
|
||||
.saveUserId!,
|
||||
);
|
||||
Navigator.of(context).pop();
|
||||
Navigator.of(context)
|
||||
.popAndPushNamed(Routes
|
||||
.myPackagesResultScreen);
|
||||
},
|
||||
text: 'Transfer',
|
||||
),
|
||||
SizedBox(
|
||||
height: 5.0,
|
||||
),
|
||||
CancelTransferButton(
|
||||
deviceBlockSize: _deviceBlockSize,
|
||||
color: kPink,
|
||||
onTap: () {
|
||||
Navigator.pop(context);
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
.saveUserId = userId;
|
||||
Provider.of<UsersProvider>(
|
||||
context,
|
||||
listen: false)
|
||||
.selectedUserForPackages =
|
||||
userResults
|
||||
.usersBox?[index];
|
||||
},
|
||||
);
|
||||
},
|
||||
itemCount:
|
||||
userResults.usersBox?.length,
|
||||
shrinkWrap: true,
|
||||
);
|
||||
},
|
||||
);
|
||||
},
|
||||
text: 'Transfer',
|
||||
),
|
||||
],
|
||||
),
|
||||
)
|
||||
: ConnectionErrorBox();
|
||||
},
|
||||
),
|
||||
),
|
||||
TransferDestroyButton(
|
||||
deviceBlockSize: _deviceBlockSize,
|
||||
firstColor: kDarkPurple,
|
||||
secondColor: kDarkPurpleSub,
|
||||
onTap: () {
|
||||
showDialog(
|
||||
context: context,
|
||||
builder: (context) {
|
||||
return AlertDialog(
|
||||
title: Text(
|
||||
'Are you sure to transfer this Package?',
|
||||
style: TextStyle(
|
||||
fontSize: 4 * _deviceBlockSize,
|
||||
),
|
||||
),
|
||||
content: SizedBox(
|
||||
width: _deviceBlockSize,
|
||||
height: 300,
|
||||
child: Column(
|
||||
children: [
|
||||
Text(
|
||||
'By approving, all items in your package will be transferred the specified user. it can be undone unless the user reject the transfer.',
|
||||
style: TextStyle(
|
||||
fontSize: 3 * _deviceBlockSize,
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
height: 10.0,
|
||||
),
|
||||
PackageCard(
|
||||
_deviceBlockSize, packageData!),
|
||||
SizedBox(
|
||||
height: 5.0,
|
||||
),
|
||||
Row(
|
||||
children: [
|
||||
Spacer(),
|
||||
Text('To'),
|
||||
SizedBox(
|
||||
width: 5.0,
|
||||
),
|
||||
TransferDataBox(
|
||||
deviceBlockSize:
|
||||
_deviceBlockSize,
|
||||
user: Provider.of<
|
||||
UsersProvider>(
|
||||
context)
|
||||
.selectedUserForPackages,
|
||||
)
|
||||
],
|
||||
),
|
||||
SizedBox(
|
||||
height: 20.0,
|
||||
),
|
||||
TransferDestroyButton(
|
||||
deviceBlockSize: _deviceBlockSize,
|
||||
firstColor: kDarkPurple,
|
||||
secondColor: kDarkPurpleSub,
|
||||
onTap: () {
|
||||
Provider.of<MyPackageProvider>(
|
||||
context,
|
||||
listen: false,
|
||||
).transferPackage(
|
||||
packageData!.id,
|
||||
Provider.of<UsersProvider>(
|
||||
context,
|
||||
listen: false)
|
||||
.saveUserId!,
|
||||
);
|
||||
Navigator.of(context).pop();
|
||||
Navigator.of(context)
|
||||
.popAndPushNamed(Routes
|
||||
.myPackagesResultScreen);
|
||||
},
|
||||
text: 'Transfer',
|
||||
),
|
||||
SizedBox(
|
||||
height: 5.0,
|
||||
),
|
||||
CancelTransferButton(
|
||||
deviceBlockSize: _deviceBlockSize,
|
||||
color: kPink,
|
||||
onTap: () {
|
||||
Navigator.pop(context);
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
);
|
||||
},
|
||||
text: 'Transfer',
|
||||
),
|
||||
],
|
||||
),
|
||||
)
|
||||
: ConnectionErrorBox();
|
||||
},
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
@@ -47,56 +47,63 @@ class _PackageDetailScreenState extends State<PackageDetailScreen> {
|
||||
final _media = MediaQuery.of(context);
|
||||
final double _devicewidth = _media.size.width;
|
||||
final double _deviceBlockSize = _devicewidth / 100;
|
||||
return SafeArea(
|
||||
child: Scaffold(
|
||||
appBar: AppBar(
|
||||
titleSpacing: -10,
|
||||
title: Text(
|
||||
'Packages',
|
||||
style: TextStyle(
|
||||
color: Colors.white,
|
||||
return PopScope(
|
||||
canPop: false,
|
||||
onPopInvoked: (didPop) {
|
||||
if (didPop) return;
|
||||
Navigator.of(context).pushNamed(Routes.homePage);
|
||||
},
|
||||
child: SafeArea(
|
||||
child: Scaffold(
|
||||
appBar: AppBar(
|
||||
titleSpacing: -10,
|
||||
title: Text(
|
||||
'Packages',
|
||||
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(),
|
||||
),
|
||||
),
|
||||
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 Package does\'nt exists!'),
|
||||
)
|
||||
: PackageDetailsDataBox(
|
||||
datas: datas!,
|
||||
deviceBlockSize: _deviceBlockSize,
|
||||
goToAddLabelPage: () {
|
||||
Navigator.pushNamed(
|
||||
context,
|
||||
Routes.labelAddScreen,
|
||||
arguments: {
|
||||
"id": datas!.id,
|
||||
"name": datas!.name
|
||||
},
|
||||
);
|
||||
},
|
||||
)
|
||||
: ConnectionErrorBox();
|
||||
},
|
||||
),
|
||||
),
|
||||
body: Consumer<ConnectivityProvider>(
|
||||
builder: (ct, connection, _) {
|
||||
return connection.conStatus != 'offline'
|
||||
? isInit
|
||||
? Center(
|
||||
child: CircularProgressIndicator(
|
||||
color: Colors.black,
|
||||
),
|
||||
)
|
||||
: isEmpty
|
||||
? Center(
|
||||
child: Text('This Package does\'nt exists!'),
|
||||
)
|
||||
: PackageDetailsDataBox(
|
||||
datas: datas!,
|
||||
deviceBlockSize: _deviceBlockSize,
|
||||
goToAddLabelPage: () {
|
||||
Navigator.pushNamed(
|
||||
context,
|
||||
Routes.labelAddScreen,
|
||||
arguments: {
|
||||
"id": datas!.id,
|
||||
"name": datas!.name
|
||||
},
|
||||
);
|
||||
},
|
||||
)
|
||||
: ConnectionErrorBox();
|
||||
},
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import '../../config/routes.dart';
|
||||
import '../../providers/connectivity.dart';
|
||||
import '../../providers/test_results.dart';
|
||||
import '../../widgets/Global/internet_error.dart';
|
||||
@@ -18,6 +19,7 @@ class TestDetailsScreen extends StatefulWidget {
|
||||
class _TestDetailsScreenState extends State<TestDetailsScreen> {
|
||||
bool isInit = true;
|
||||
Map<String, Object>? datas;
|
||||
|
||||
@override
|
||||
void didChangeDependencies() async {
|
||||
if (isInit) {
|
||||
@@ -42,36 +44,48 @@ class _TestDetailsScreenState extends State<TestDetailsScreen> {
|
||||
final double _devicewidth = _media.size.width;
|
||||
final double _deviceBlockSize = _devicewidth / 100;
|
||||
// print(datas);
|
||||
return SafeArea(
|
||||
child: Scaffold(
|
||||
appBar: AppBar(
|
||||
titleSpacing: -10,
|
||||
title: Text('Test Results', style: TextStyle(color: Colors.white,),),
|
||||
backgroundColor: Colors.black,
|
||||
leading: IconButton(
|
||||
icon: Icon(
|
||||
Icons.keyboard_arrow_left,
|
||||
color: Colors.white,
|
||||
size: 35,
|
||||
return PopScope(
|
||||
canPop: false,
|
||||
onPopInvoked: (didPop) {
|
||||
if (didPop) return;
|
||||
Navigator.of(context).pushNamed(Routes.homePage);
|
||||
},
|
||||
child: SafeArea(
|
||||
child: Scaffold(
|
||||
appBar: AppBar(
|
||||
titleSpacing: -10,
|
||||
title: Text(
|
||||
'Test Results',
|
||||
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(),
|
||||
),
|
||||
onPressed: () => Navigator.of(context).pop(),
|
||||
),
|
||||
),
|
||||
body: Consumer<ConnectivityProvider>(
|
||||
builder: (ct, connection, _) {
|
||||
return connection.conStatus != 'offline'
|
||||
? isInit
|
||||
? Center(
|
||||
child: CircularProgressIndicator(
|
||||
color: Colors.black,
|
||||
),
|
||||
)
|
||||
: DatasBox(
|
||||
datas: datas!,
|
||||
deviceBlockSize: _deviceBlockSize,
|
||||
)
|
||||
: ConnectionErrorBox();
|
||||
},
|
||||
body: Consumer<ConnectivityProvider>(
|
||||
builder: (ct, connection, _) {
|
||||
return connection.conStatus != 'offline'
|
||||
? isInit
|
||||
? Center(
|
||||
child: CircularProgressIndicator(
|
||||
color: Colors.black,
|
||||
),
|
||||
)
|
||||
: DatasBox(
|
||||
datas: datas!,
|
||||
deviceBlockSize: _deviceBlockSize,
|
||||
)
|
||||
: ConnectionErrorBox();
|
||||
},
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user