diff --git a/images/appbgsuplier.png b/images/appbgsuplier.png new file mode 100644 index 0000000..0a54516 Binary files /dev/null and b/images/appbgsuplier.png differ diff --git a/images/connectionsblue.png b/images/connectionsblue.png new file mode 100644 index 0000000..b01c88e Binary files /dev/null and b/images/connectionsblue.png differ diff --git a/images/customercareblue.png b/images/customercareblue.png new file mode 100644 index 0000000..7fdc2d4 Binary files /dev/null and b/images/customercareblue.png differ diff --git a/images/editprofileblue.png b/images/editprofileblue.png new file mode 100644 index 0000000..76956ec Binary files /dev/null and b/images/editprofileblue.png differ diff --git a/images/ic_launcher.png b/images/ic_launcher.png new file mode 100644 index 0000000..dcf4065 Binary files /dev/null and b/images/ic_launcher.png differ diff --git a/images/img.png b/images/img.png new file mode 100644 index 0000000..803da46 Binary files /dev/null and b/images/img.png differ diff --git a/images/logoutblue.png b/images/logoutblue.png new file mode 100644 index 0000000..27bdaa7 Binary files /dev/null and b/images/logoutblue.png differ diff --git a/images/profile_pic.png b/images/profile_pic.png new file mode 100644 index 0000000..3fd3f73 Binary files /dev/null and b/images/profile_pic.png differ diff --git a/lib/dashboard.dart b/lib/dashboard.dart index 537fed2..4a6cadc 100644 --- a/lib/dashboard.dart +++ b/lib/dashboard.dart @@ -1,365 +1,441 @@ -import 'dart:convert'; -import 'dart:io'; import 'package:flutter/material.dart'; -import 'package:geolocator/geolocator.dart'; -import 'package:google_maps_flutter/google_maps_flutter.dart'; -import 'package:google_maps_flutter_android/google_maps_flutter_android.dart'; -import 'package:google_maps_flutter_platform_interface/google_maps_flutter_platform_interface.dart'; import 'package:flutter/services.dart'; -import 'package:url_launcher/url_launcher.dart'; -import 'package:watermanagement_deliveryboy/model/getdeliveryboy_model.dart'; -import 'package:watermanagement_deliveryboy/settings.dart'; +import 'package:flutter_svg/flutter_svg.dart'; +import 'package:image_picker/image_picker.dart'; +import 'package:watermanagement/delivrybookingdata.dart'; +import 'package:watermanagement/login.dart'; +import 'package:watermanagement/settings.dart'; +import 'dart:io'; + + + + class Dashboard extends StatefulWidget { - const Dashboard({Key? key}) : super(key: key); + const Dashboard({super.key}); @override State createState() => _DashboardState(); } -class _DashboardState extends State with TickerProviderStateMixin { - bool isSupplierDataLoading=false; - bool isSereverIssue = false; - bool isSereverIssueConnected = false; - bool isSereverIssuePending = false; +class _DashboardState extends State { + int _selectedIndex = 0; + + TextEditingController tankNameController = TextEditingController(); + TextEditingController blockNameController = TextEditingController(); + TextEditingController capacityController = TextEditingController(); - List connectedSuppliersList = []; - bool isLoading=false; - Future getConnectedSuppliersData() async { - isLoading = true; + static const TextStyle optionStyle = + TextStyle(fontSize: 30, fontWeight: FontWeight.bold); + + + final ImagePicker _picker = ImagePicker(); + + Future pickImageFromGallery() async { try { - var response = await AppSettings.getdeliveryboybookings(); + final image = await _picker.pickImage(source: ImageSource.gallery); + if (image == null) return; + final imageTemp = File(image.path); setState(() { - connectedSuppliersList = - ((jsonDecode(response)['data']) as List).map((dynamic model) { - return GetDeliveryboyDetailsModel.fromJson(model); - }).toList(); - isLoading = false; + AppSettings.updatedImage = imageTemp; }); + // uploadProfileApi(AppSettings.updatedImage); + AppSettings.saveProfile(image.path); - } catch (e) { + } on PlatformException catch (e) { + print('Failed to pick image: $e'); + } + } + + Future takeImageFromCamera() async { + try { + final image = await _picker.pickImage(source: ImageSource.camera); + if (image == null) return; + final imageTemp = File(image.path); setState(() { - isLoading = false; - isSereverIssueConnected = true; + AppSettings.updatedImage = imageTemp; }); + + //uploadProfileApi(AppSettings.updatedImage); + AppSettings.saveProfile(image.path); + + } on PlatformException catch (e) { + print('Failed to pick image: $e'); } } + Widget _dashBoard() { - @override - void initState() { - // TODO: implement initState - getConnectedSuppliersData(); - super.initState(); - } + return Container( + color: screenBackgroundColor, + child: Column( + children: [ + Container( + height: MediaQuery.of(context).size.height * .330, + width: double.infinity, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(0), + ), + //color: Colors.red, + child: FittedBox( + child:Image( + image: const AssetImage('images/appbgsuplier.png'), + + ), + fit: BoxFit.fill, + ) + ), + SizedBox( + height: 5 + ), + Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Expanded( + child: GestureDetector( + onTap: () { + Navigator.push( + context, + MaterialPageRoute(builder: (context) => DelivryBookingData()), + ); + }, + child: Container( + padding: EdgeInsets.all(05), + margin: EdgeInsets.only(left:15, top:10, right: 0, bottom:0), + //height: MediaQuery.of(context).size.height * .05, + //width: MediaQuery.of(context).size.width * .45, + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.circular(12), + ), + // Change button text when light changes state. - Widget connectedTankers(){ - if (connectedSuppliersList.length != 0) { - return ListView.builder( - padding: EdgeInsets.all(8), - itemCount: connectedSuppliersList.length, - itemBuilder: (BuildContext context, int index) { - return Card( - child: Padding( - padding: EdgeInsets.all(8), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - Container( - // width: MediaQuery.of(context).size.width * .75, child: Column( - mainAxisAlignment: - MainAxisAlignment.spaceBetween, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Row( - children: [ - Text('TankerName :', - style: labelTextStyle()), - SizedBox( - width: 5.0, - ), - Text( - connectedSuppliersList[index] - .tankerName - .toUpperCase(), - style: valuesTextStyle()), - ], - ), - Row( - children: [ - Text('Bookingid :', - style: labelTextStyle()), - SizedBox( - width: 5.0, - ), - Text( - connectedSuppliersList [index] - .bookingid - .toString(), - style: valuesTextStyle()), - ], - ), - Row( - children: [ - Text('SupplierId :', - style: labelTextStyle()), - SizedBox( - width: 5.0, - ), - Text(connectedSuppliersList[index].supplierId, - style: valuesTextStyle()), - ], + children: [ + Container( + padding: EdgeInsets.fromLTRB(35, 10,0,0), + child: new SvgPicture.asset("assets/images/tanklevels.svg") ), - Row( - children: [ - Text('DateOfOrder :', - style: labelTextStyle()), - SizedBox( - width: 5.0, - ), - Text(connectedSuppliersList[index].dateOfOrder, - style: valuesTextStyle()), - ], - ), - Row( - children: [ - Text('Typeofwater :', - style: labelTextStyle()), - SizedBox( - width: 5.0, - ), - Text(connectedSuppliersList[index].typeofwater, - style: valuesTextStyle()), - ], - ), - Row( - mainAxisAlignment: MainAxisAlignment.start, - crossAxisAlignment: - CrossAxisAlignment.start, - children: [ - Column( - children: [ - IconButton( - iconSize: 30, - icon: const Icon( - Icons.phone, - color: primaryColor, - ), - onPressed: () async { - final Uri _phoneUri = Uri( - scheme: "tel", - path: connectedSuppliersList[index] - .delivery_agent_mobile); - try { - await launch( - _phoneUri.toString()); - } catch (error) { - throw ("Cannot dial"); - } - }, - ), - Text( - 'Call now', - style: iconBelowTextStyle(), - ), - ], - ), - SizedBox( - width: 30, - ), - Column( - children: [ - IconButton( - iconSize: 30, - icon: const Icon( - Icons.start, - color: primaryColor, - ), - onPressed: () { - /* showTankerBookingDialog( - tankersList[index]);*/ - }, - ), - Text( - 'Start Trip', - style: iconBelowTextStyle(), - ), - ], - ), - SizedBox( - width: 30, - ), - Column( - children: [ - IconButton( - iconSize: 30, - icon: const Icon( - Icons.download, - color: primaryColor, - ), - onPressed: () { - - /* Navigator.push( - context, - new MaterialPageRoute( - builder: (__) => new BookedTanerDetails(myObject:tankersList[index].tanker_name)));*/ - - - }, - ), - Text( - 'Download Water', - style: iconBelowTextStyle(), - ), - ], - ), - - ], - ) + Text('Booking Data',style: dashboardTextStyle(),), ], ), ), - /* Expanded( - child:TextButton( - child: const Text( - 'Connect', - style: TextStyle(fontSize: 15, - decoration: TextDecoration.underline,color: primaryColor), - ), - onPressed: () { - }, - )),*/ - /* Expanded( - child: IconButton( + )), + + ], + ), + + //==============================list2 + + ], + ), + ); + } + + + + + showLogoutAlertDialog(context){ + return showDialog( + context: context, + barrierDismissible: false, + builder: (BuildContext context) { + return StatefulBuilder( + builder: (BuildContext context, StateSetter setState) { + return AlertDialog( + title: const Text('Do you really want to logout?'), + actions: [ + TextButton( + child: Text('No',style:textButtonStyle()), onPressed: () { - //showTankerUpdateDialog(tankersList[index]); + Navigator.of(context).pop(); }, - icon: Icon(Icons.edit), - color: primaryColor, ), - ), - SizedBox( - width: 5, - ), - Expanded( - child: IconButton( - onPressed: () async { - showDialog( - context: context, - builder: (BuildContext context) => - AlertDialog( - title: const Text( - 'Do you want to delete Tanker?', - style: TextStyle( - color: primaryColor, - fontSize: 20, - )), - actionsAlignment: - MainAxisAlignment.spaceBetween, - actions: [ - TextButton( - onPressed: () async { - bool deletePipelineStatus = - await AppSettings.deleteTanker( - tankersList[index] - .tanker_name); - - if (deletePipelineStatus) { - getTankers(); - AppSettings.longSuccessToast( - 'Tanker deleted successfully'); - Navigator.of(context).pop(true); - } else { - AppSettings.longFailedToast( - 'Tanker deletion failed'); - Navigator.of(context).pop(true); - } - }, - child: const Text('Yes', - style: TextStyle( - color: primaryColor, - fontSize: 20, - )), - ), - TextButton( - onPressed: () { - Navigator.of(context).pop(true); - }, - child: const Text('No', - style: TextStyle( - color: primaryColor, - fontSize: 20, - )), - ), - ], - ), - ); + TextButton( + child: Text('Yes',style:textButtonStyle()), + onPressed: () async{ + await AppSettings.clearSharedPreferences(); + await Navigator.pushAndRemoveUntil(context, MaterialPageRoute(builder: (context) => Login()),(Route route) => false,); + }, - icon: Icon(Icons.delete), - color: primaryColor, ), - )*/ - ], + ] + + ); + }); + } + ); + } + + + + @override + Widget build(BuildContext context) { + + return WillPopScope( + onWillPop: () async { + if(_selectedIndex==0){ + final shouldPop = await showDialog(context: context, builder: (context) { + return AlertDialog( + title: const Text('Do you want to exit app?', + style: TextStyle( + color: primaryColor, + fontSize: 20, + )), + actionsAlignment: MainAxisAlignment.spaceBetween, + actions: [ + TextButton( + onPressed: () { + SystemNavigator.pop(); + }, + child: const Text('Yes', + style: TextStyle( + color: primaryColor, + fontSize: 20, + )), ), - ), + TextButton( + onPressed: () { + Navigator.of(context).pop(false); + }, + child: const Text('No', + style: TextStyle( + color: primaryColor, + fontSize: 20, + )), + ), + ], ); + }, + ); + return shouldPop!; + } + else{ + setState(() { + _selectedIndex=0; }); - } - else { - return Center( - child: Padding( - padding: EdgeInsets.fromLTRB(0, 40, 0, 0), - child: isSereverIssueConnected - ? Column( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Image( - image: AssetImage('images/serverissue.png'), - // height: MediaQuery.of(context).size.height * .10, + return false; + } + + }, + child: Scaffold( + resizeToAvoidBottomInset: false, + appBar:AppSettings.appBar('Arminta Water Management'), + drawer: Drawer( + // Add a ListView to the drawer. This ensures the user can scroll + // through the options in the drawer if there isn't enough vertical + // space to fit everything. + //backgroundColor: screenBackgroundColor, + child: ListView( + // Important: Remove any padding from the ListView. + padding: EdgeInsets.zero, + children: [ + DrawerHeader( + decoration: const BoxDecoration( + color: primaryColor, + ), + child: Row( + children: [ + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + + + Expanded(child: GestureDetector( + child: Container( + width: MediaQuery.of(context).size.width * .20, + height: MediaQuery.of(context).size.height * .15, + decoration: BoxDecoration( + shape: BoxShape.circle, + image: DecorationImage( + image: (AppSettings.updatedImage != null) ? FileImage(AppSettings.updatedImage!) as ImageProvider : AssetImage("images/profile_pic.png"), // picked file + fit: BoxFit.cover)), + ), + onTap: () { + showModalBottomSheet( + context: context, + builder: (BuildContext context) { + return SizedBox( + height: 200, + child: Center( + child: Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + GestureDetector( + child: Icon( + Icons.camera_alt_outlined, + size: 100, + color: greyColor, + ), + onTap: () async { + await takeImageFromCamera(); + Navigator.pop(context); + }, + ), + SizedBox( + width: + MediaQuery.of(context).size.width * .20, + ), + GestureDetector( + child: Icon( + Icons.photo, + size: 100, + color: greyColor, + ), + onTap: () async { + await pickImageFromGallery(); + Navigator.pop(context); + }, + ), + ], + ), + ), + ); + }); + }, + ),), + + Text( + AppSettings.deliveryBoyname, + style: TextStyle(color: Colors.white, fontSize: 15), + ), + Text( + AppSettings.phoneNumber, + style: TextStyle(color: Colors.white, fontSize: 15), + ), + /* Text( + AppSettings.email, + style: TextStyle(color: Colors.white, fontSize: 15), + ),*/ + ], + ), + Container() + ], + )), + + ListTile( + title: Row( + children: const [ + + Image(image: const AssetImage('images/editprofileblue.png'),height: 25,width: 25,fit: BoxFit.fill), + const SizedBox( + width: 10, + ), + const SizedBox( + width: 10, + ), + Text('Edit Profile',style: TextStyle(color:primaryColor)), + ], ), - SizedBox( - height: 20, + onTap: () { + + /* Navigator.push( + context, + MaterialPageRoute(builder: (context) => UpdateProfile()), + );*/ + + }, + ), + Divider( + color: Colors.grey, + ), + // Add Tanks + ListTile( + title: Row( + children: const [ + Image(image: const AssetImage('images/connectionsblue.png'),height: 25,width: 25,fit: BoxFit.fill), + const SizedBox( + width: 10, + ), + Text('Booking Data',style: TextStyle(color:primaryColor)), + ], ), - Text( - 'There is an issue at server please try after some time',style:serverIssueTextStyle() ,), - ], - ) - : Column( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Image( - image: AssetImage('images/no_data.png'), - // height: MediaQuery.of(context).size.height * .10, + onTap: () { + Navigator.push( + context, + MaterialPageRoute(builder: (context) => DelivryBookingData()), + ); + }, + ), + Divider( + color: Colors.grey, + ), + ListTile( + title: Row( + children: const [ + Image(image: const AssetImage('images/customercareblue.png'),height: 25,width: 25,fit: BoxFit.fill), + const SizedBox( + width: 10, + ), + Text('Customer Support', style: TextStyle(color:primaryColor)), + ], ), - SizedBox( - height: 20, + onTap: () {}, + ), + Divider( + color: Colors.grey, + ), + ListTile( + title: Row( + children: const [ + Image(image: const AssetImage('images/logoutblue.png'),height: 25,width: 25,fit: BoxFit.fill), + const SizedBox( + width: 10, + ), + Text('Logout', style: TextStyle(color:primaryColor)), + ], ), - Text( - 'No Connected Tankers',style:serverIssueTextStyle() ,), - ], - ), - )); - } - } + onTap: () async{ + + + showLogoutAlertDialog(context); - @override - Widget build(BuildContext context) { - return SafeArea( - child: Scaffold( - appBar: AppSettings.appBar('Deliveryboy'), - body: isLoading?Center( - child: CircularProgressIndicator( - color: primaryColor, - strokeWidth: 5.0, - ), - ):connectedTankers(), - )); - } + }, + ), + ], + ), + ), + body: _dashBoard(), + /*body: IndexedStack( + index: _selectedIndex, + children: screens, + ),*/ + /* bottomNavigationBar: Container( + //height: MediaQuery.of(context).size.height, + child: BottomNavigationBar( + items: const [ + BottomNavigationBarItem( + icon: Icon( + Icons.home, + ), + label: 'Home', + ), + BottomNavigationBarItem( + icon: Icon(Icons.propane_tank), + label: 'Add Tanks', + ), + *//*BottomNavigationBarItem( + icon: Icon(Icons.private_connectivity_outlined), + label: 'CreateConnections', + ),*//* + BottomNavigationBarItem( + icon: Icon(Icons.list_alt), + label: 'Add Tanker', + ), + ], + currentIndex: _selectedIndex, + selectedItemColor: primaryColor, + unselectedItemColor: greyColor, + showUnselectedLabels: true, + onTap: _onItemTapped, + ), + ),*/ + ), + ); + } } diff --git a/lib/delivrybookingdata.dart b/lib/delivrybookingdata.dart new file mode 100644 index 0000000..62d06c6 --- /dev/null +++ b/lib/delivrybookingdata.dart @@ -0,0 +1,366 @@ +import 'dart:convert'; +import 'dart:io'; +import 'package:flutter/material.dart'; +import 'package:geolocator/geolocator.dart'; +import 'package:google_maps_flutter/google_maps_flutter.dart'; +import 'package:google_maps_flutter_android/google_maps_flutter_android.dart'; +import 'package:google_maps_flutter_platform_interface/google_maps_flutter_platform_interface.dart'; +import 'package:flutter/services.dart'; +import 'package:url_launcher/url_launcher.dart'; +import 'package:watermanagement/model/getdeliveryboy_model.dart'; +import 'package:watermanagement/settings.dart'; + + +class DelivryBookingData extends StatefulWidget { + const DelivryBookingData({Key? key}) : super(key: key); + + @override + State createState() => _DelivryBookingDataState(); +} + +class _DelivryBookingDataState extends State with TickerProviderStateMixin { + bool isSupplierDataLoading=false; + bool isSereverIssue = false; + bool isSereverIssueConnected = false; + bool isSereverIssuePending = false; + + List connectedSuppliersList = []; + bool isLoading=false; + + Future getConnectedSuppliersData() async { + isLoading = true; + try { + var response = await AppSettings.getdeliveryboybookings(); + setState(() { + connectedSuppliersList = + ((jsonDecode(response)['data']) as List).map((dynamic model) { + return GetDeliveryboyDetailsModel.fromJson(model); + }).toList(); + isLoading = false; + }); + + + } catch (e) { + setState(() { + isLoading = false; + isSereverIssueConnected = true; + }); + } + } + + + + @override + void initState() { + // TODO: implement initState + getConnectedSuppliersData(); + super.initState(); + } + + Widget connectedTankers(){ + if (connectedSuppliersList.length != 0) { + return ListView.builder( + padding: EdgeInsets.all(8), + itemCount: connectedSuppliersList.length, + itemBuilder: (BuildContext context, int index) { + return Card( + child: Padding( + padding: EdgeInsets.all(8), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Container( + // width: MediaQuery.of(context).size.width * .75, + child: Column( + mainAxisAlignment: + MainAxisAlignment.spaceBetween, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + children: [ + Text('TankerName :', + style: labelTextStyle()), + SizedBox( + width: 5.0, + ), + Text( + connectedSuppliersList[index] + .tankerName + .toUpperCase(), + style: valuesTextStyle()), + ], + ), + Row( + children: [ + Text('Bookingid :', + style: labelTextStyle()), + SizedBox( + width: 5.0, + ), + Text( + connectedSuppliersList [index] + .bookingid + .toString(), + style: valuesTextStyle()), + ], + ), + Row( + children: [ + Text('SupplierId :', + style: labelTextStyle()), + SizedBox( + width: 5.0, + ), + Text(connectedSuppliersList[index].supplierId, + style: valuesTextStyle()), + ], + ), + Row( + children: [ + Text('DateOfOrder :', + style: labelTextStyle()), + SizedBox( + width: 5.0, + ), + Text(connectedSuppliersList[index].dateOfOrder, + style: valuesTextStyle()), + ], + ), + Row( + children: [ + Text('Typeofwater :', + style: labelTextStyle()), + SizedBox( + width: 5.0, + ), + Text(connectedSuppliersList[index].typeofwater, + style: valuesTextStyle()), + ], + ), + Row( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + Column( + children: [ + IconButton( + iconSize: 30, + icon: const Icon( + Icons.phone, + color: primaryColor, + ), + onPressed: () async { + final Uri _phoneUri = Uri( + scheme: "tel", + path: connectedSuppliersList[index] + .delivery_agent_mobile); + try { + await launch( + _phoneUri.toString()); + } catch (error) { + throw ("Cannot dial"); + } + }, + ), + Text( + 'Call now', + style: iconBelowTextStyle(), + ), + ], + ), + SizedBox( + width: 30, + ), + Column( + children: [ + IconButton( + iconSize: 30, + icon: const Icon( + Icons.start, + color: primaryColor, + ), + onPressed: () { + /* showTankerBookingDialog( + tankersList[index]);*/ + }, + ), + Text( + 'Start Trip', + style: iconBelowTextStyle(), + ), + ], + ), + SizedBox( + width: 30, + ), + Column( + children: [ + IconButton( + iconSize: 30, + icon: const Icon( + Icons.download, + color: primaryColor, + ), + onPressed: () { + + /* Navigator.push( + context, + new MaterialPageRoute( + builder: (__) => new BookedTanerDetails(myObject:tankersList[index].tanker_name)));*/ + + + }, + ), + Text( + 'Download Water', + style: iconBelowTextStyle(), + ), + ], + ), + + ], + ) + + ], + ), + ), + /* Expanded( + child:TextButton( + child: const Text( + 'Connect', + style: TextStyle(fontSize: 15, + decoration: TextDecoration.underline,color: primaryColor), + ), + onPressed: () { + }, + )),*/ + /* Expanded( + child: IconButton( + onPressed: () { + //showTankerUpdateDialog(tankersList[index]); + }, + icon: Icon(Icons.edit), + color: primaryColor, + ), + ), + SizedBox( + width: 5, + ), + Expanded( + child: IconButton( + onPressed: () async { + showDialog( + context: context, + builder: (BuildContext context) => + AlertDialog( + title: const Text( + 'Do you want to delete Tanker?', + style: TextStyle( + color: primaryColor, + fontSize: 20, + )), + actionsAlignment: + MainAxisAlignment.spaceBetween, + actions: [ + TextButton( + onPressed: () async { + bool deletePipelineStatus = + await AppSettings.deleteTanker( + tankersList[index] + .tanker_name); + + if (deletePipelineStatus) { + getTankers(); + AppSettings.longSuccessToast( + 'Tanker deleted successfully'); + Navigator.of(context).pop(true); + } else { + AppSettings.longFailedToast( + 'Tanker deletion failed'); + Navigator.of(context).pop(true); + } + }, + child: const Text('Yes', + style: TextStyle( + color: primaryColor, + fontSize: 20, + )), + ), + TextButton( + onPressed: () { + Navigator.of(context).pop(true); + }, + child: const Text('No', + style: TextStyle( + color: primaryColor, + fontSize: 20, + )), + ), + ], + ), + ); + }, + icon: Icon(Icons.delete), + color: primaryColor, + ), + )*/ + ], + ), + ), + ); + }); + } + else { + return Center( + child: Padding( + padding: EdgeInsets.fromLTRB(0, 40, 0, 0), + child: isSereverIssueConnected + ? Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Image( + image: AssetImage('images/serverissue.png'), + // height: MediaQuery.of(context).size.height * .10, + ), + SizedBox( + height: 20, + ), + Text( + 'There is an issue at server please try after some time',style:serverIssueTextStyle() ,), + ], + ) + : Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Image( + image: AssetImage('images/no_data.png'), + // height: MediaQuery.of(context).size.height * .10, + ), + SizedBox( + height: 20, + ), + Text( + 'No Connected Tankers',style:serverIssueTextStyle() ,), + ], + ), + )); + } + } + + @override + Widget build(BuildContext context) { + return SafeArea( + child: Scaffold( + appBar: AppSettings.appBar('Deliveryboy'), + body: isLoading?Center( + child: CircularProgressIndicator( + color: primaryColor, + strokeWidth: 5.0, + ), + ):connectedTankers(), + )); + } + +} diff --git a/lib/login.dart b/lib/login.dart index 26ac363..3111706 100644 --- a/lib/login.dart +++ b/lib/login.dart @@ -1,8 +1,9 @@ import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; import 'package:path/path.dart' as Path; -import 'package:watermanagement_deliveryboy/otpscreen.dart'; -import 'package:watermanagement_deliveryboy/settings.dart'; +import 'package:watermanagement/otpscreen.dart'; +import 'package:watermanagement/settings.dart'; + class Login extends StatefulWidget { const Login({super.key}); diff --git a/lib/main.dart b/lib/main.dart index a50a87a..f7acf80 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -1,7 +1,8 @@ import 'package:flutter/material.dart'; import 'package:sizer/sizer.dart'; import 'package:flutter/services.dart'; -import 'package:watermanagement_deliveryboy/splash_screen.dart'; +import 'package:watermanagement/splash_screen.dart'; + void main () async { // Set default home. diff --git a/lib/model/getdeliveryboy_model.dart b/lib/model/getdeliveryboy_model.dart index 7fa1686..886001e 100644 --- a/lib/model/getdeliveryboy_model.dart +++ b/lib/model/getdeliveryboy_model.dart @@ -8,6 +8,15 @@ class GetDeliveryboyDetailsModel { String dateOfOrder=''; String typeofwater=''; String delivery_agent_mobile=''; + String capacity=''; + String address=''; + String price=''; + String customerId=''; + + + + + @@ -24,6 +33,11 @@ class GetDeliveryboyDetailsModel { rtvm.dateOfOrder = json['dateOfOrder'] ??''; rtvm.typeofwater = json['typeofwater'] ??''; rtvm.delivery_agent_mobile = json['delivery_agent_mobile'] ??''; + rtvm.capacity = json['capacity'] ??''; + rtvm.address = json['address'] ??''; + rtvm.price = json['price'] ??''; + rtvm.customerId = json['customerId'] ??''; + diff --git a/lib/otpscreen.dart b/lib/otpscreen.dart index 585c5b7..0fb6e2d 100644 --- a/lib/otpscreen.dart +++ b/lib/otpscreen.dart @@ -1,6 +1,7 @@ import 'package:flutter/material.dart'; -import 'package:watermanagement_deliveryboy/dashboard.dart'; -import 'package:watermanagement_deliveryboy/settings.dart'; +import 'package:watermanagement/dashboard.dart'; +import 'package:watermanagement/settings.dart'; + class OtpScreen extends StatefulWidget { var phoneNumber; diff --git a/lib/preloader.dart b/lib/preloader.dart index 50fa9c8..edaf1b1 100644 --- a/lib/preloader.dart +++ b/lib/preloader.dart @@ -1,5 +1,6 @@ import 'package:flutter/material.dart'; -import 'package:watermanagement_deliveryboy/settings.dart'; +import 'package:watermanagement/settings.dart'; + class Dialogs { diff --git a/lib/settings.dart b/lib/settings.dart index bb63c59..d99b834 100644 --- a/lib/settings.dart +++ b/lib/settings.dart @@ -11,7 +11,8 @@ import 'package:intl/intl.dart'; import 'package:flutter_styled_toast/flutter_styled_toast.dart'; import 'dart:async'; import 'package:geolocator/geolocator.dart'; -import 'package:watermanagement_deliveryboy/preloader.dart'; +import 'package:watermanagement/preloader.dart'; + const Color primaryColor = Color(0XFF0D4E84); const Color greyColor = Color(0XFF8F8E8E); @@ -88,7 +89,7 @@ class AppSettings { static String customerId = ''; static String customerIdsign = ''; static String profileImage = ''; - static List storedPreferenceValidKeys = ['username', 'access_token']; + static List storedPreferenceValidKeys = ['deliveryBoyname', 'access_token']; static String preloadText = 'Please wait'; static String latitude = ''; static String longitude = ''; diff --git a/lib/splash_screen.dart b/lib/splash_screen.dart index 3d61d99..ccfa2d8 100644 --- a/lib/splash_screen.dart +++ b/lib/splash_screen.dart @@ -1,8 +1,10 @@ import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; -import 'package:watermanagement_deliveryboy/dashboard.dart'; -import 'package:watermanagement_deliveryboy/login.dart'; -import 'package:watermanagement_deliveryboy/settings.dart'; +import 'package:watermanagement/dashboard.dart'; +import 'package:watermanagement/delivrybookingdata.dart'; +import 'package:watermanagement/login.dart'; +import 'package:watermanagement/settings.dart'; + void main() async{ SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]); diff --git a/pubspec.yaml b/pubspec.yaml index e7d21dc..9211a9e 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,4 +1,6 @@ -name: watermanagement_deliveryboy +name: watermanagement +description: A new Flutter project. + publish_to: 'none' # Remove this line if you wish to publish to pub.dev version: 1.0.0+1 @@ -64,3 +66,6 @@ flutter: uses-material-design: true assets: - images/ + - json/ + - assets/images/ + diff --git a/test/widget_test.dart b/test/widget_test.dart index 63b9c19..c16513a 100644 --- a/test/widget_test.dart +++ b/test/widget_test.dart @@ -7,7 +7,8 @@ import 'package:flutter/material.dart'; import 'package:flutter_test/flutter_test.dart'; -import 'package:watermanagement_deliveryboy/splash_screen.dart'; +import 'package:watermanagement/splash_screen.dart'; + void main() { testWidgets('Counter increments smoke test', (WidgetTester tester) async {