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