diff --git a/lib/screens/book_operator.dart b/lib/screens/book_operator.dart index 092d15e..1d64b9b 100644 --- a/lib/screens/book_operator.dart +++ b/lib/screens/book_operator.dart @@ -17,6 +17,7 @@ class _BookOperatorScreenScreenState extends State { return Scaffold( backgroundColor: Color(0xFFFF4B3A), body: SlidingUpPanel( + defaultPanelState: PanelState.OPEN, maxHeight: 375, minHeight: 150, backdropEnabled: true, @@ -42,7 +43,7 @@ class _BookOperatorScreenScreenState extends State { 'rohan': 'good operator', 'aviral': 'bad operator', 'rishabh': 'average operator gg', - 'hskg': 'nice op', + 'hskg': 'nice op', 'rohagn': 'good operator', 'aviralg': 'bad operator', 'rishagbh': 'average operator gg' diff --git a/lib/screens/modeSelectionPage.dart b/lib/screens/modeSelectionPage.dart index ee9da14..23205ce 100644 --- a/lib/screens/modeSelectionPage.dart +++ b/lib/screens/modeSelectionPage.dart @@ -3,6 +3,7 @@ import 'package:flutter/material.dart'; import 'package:mera_aadhar/screens/verification.dart'; import 'package:url_launcher/url_launcher.dart'; + class ModeSelectPage extends StatefulWidget { const ModeSelectPage({Key? key}) : super(key: key); diff --git a/lib/screens/operator_selection.dart b/lib/screens/operator_selection.dart index 2ec8bd6..ca06eb6 100644 --- a/lib/screens/operator_selection.dart +++ b/lib/screens/operator_selection.dart @@ -50,7 +50,7 @@ class _OperatorSelectionScreenState extends State { String _locationText = "Loading data..."; Map idToOperator = {}; Symbol? lastClicked; - + PanelController panelController = PanelController(); final _chars = '123456789'; Random _rnd = Random(); @@ -195,6 +195,10 @@ class _OperatorSelectionScreenState extends State { Operator opclick = idToOperator[symbolIdToOperatorId[symbol.id]]!; Provider.of(context, listen: false).setOperator(opclick); + panelController.open(); + setState(() { + + }); print( "Clicked op id ${symbolIdToOperatorId[symbol.id]} with name ${opclick.name}"); @@ -221,6 +225,7 @@ class _OperatorSelectionScreenState extends State { bookin.userdata = new Userdata(phoneNo: phno, locationText: _locationText); bookin.confirmOtp = generatePin(4); bookin.timestamp = DateTime.now().millisecondsSinceEpoch; + print(bookin.toJson()); BookingDB bdb = new BookingDB(); @@ -238,212 +243,215 @@ class _OperatorSelectionScreenState extends State { print(pinLocation); return Scaffold( backgroundColor: Color(0xFFFF4B3A), - body: SlidingUpPanel( - maxHeight: 370, - minHeight: 150, - backdropEnabled: true, - color: Colors.transparent, - panel: Container( - height: 50, - decoration: const BoxDecoration( - color: Colors.white, - borderRadius: BorderRadius.only( - topLeft: Radius.circular(30), topRight: Radius.circular(30)), - ), - child: Consumer(builder: (context, provider, child) { - return (!provider.isOpSelected) - ? Column( - children: [ - const Icon( - Icons.arrow_drop_up_outlined, - size: 40, - ), - ListTile( - leading: const Icon( - Icons.house, - color: Colors.black, - size: 36, + body: Consumer(builder: (context, provider, child) { + return SlidingUpPanel( + controller: panelController, + defaultPanelState: + (provider.isOpSelected) ? PanelState.OPEN : PanelState.CLOSED, + maxHeight: 370, + minHeight: 150, + backdropEnabled: true, + color: Colors.transparent, + panel: Container( + height: 50, + decoration: const BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.only( + topLeft: Radius.circular(30), + topRight: Radius.circular(30)), + ), + child: (!provider.isOpSelected) + ? Column( + children: [ + const Icon( + Icons.arrow_drop_up_outlined, + size: 40, ), - title: Text( - _locationText, - style: GoogleFonts.poppins( - textStyle: TextStyle( - fontWeight: FontWeight.bold, fontSize: 17), + ListTile( + leading: const Icon( + Icons.house, + color: Colors.black, + size: 36, ), - ), - subtitle: Text( - 'Mobile Number: ${Provider.of(context, listen: false).booking.userdata!.phoneNo}', - style: GoogleFonts.poppins( - fontWeight: FontWeight.w500, - color: Color(0xFFB2B2B2), - fontSize: 16), - ), - trailing: IconButton( - icon: new Icon(Icons.edit), - highlightColor: Colors.pink, - onPressed: () { - openMapmyIndiaPlacePickerWidget(); - }, - ), - ), - const SizedBox( - height: 30, - ), - Container( - height: 70, - width: 315, - decoration: BoxDecoration( - color: Color(0xFFF8774A), - borderRadius: BorderRadius.circular(30)), - child: Center( - child: Text( - 'Select an operator for yourself', + title: Text( + _locationText, style: GoogleFonts.poppins( - textStyle: const TextStyle( - fontWeight: FontWeight.w500, - fontSize: 15, - color: Colors.white)), + textStyle: TextStyle( + fontWeight: FontWeight.bold, fontSize: 17), + ), + ), + subtitle: Text( + 'Mobile Number: ${Provider.of(context, listen: false).booking.userdata!.phoneNo}', + style: GoogleFonts.poppins( + fontWeight: FontWeight.w500, + color: Color(0xFFB2B2B2), + fontSize: 16), + ), + trailing: IconButton( + icon: new Icon(Icons.edit), + highlightColor: Colors.pink, + onPressed: () { + openMapmyIndiaPlacePickerWidget(); + }, ), ), - ), - ], - ) - : Column( - children: [ - const Icon( - Icons.arrow_drop_up_outlined, - size: 40, - ), - OperatorBookCard( - name: provider.focusOperator.name!, - rating: provider.focusOperator.ratings!, - reviews: Map.fromIterable( - provider.focusOperator.reviews!, - key: (v) => v[0], - value: (v) => v), - image: - "operator/${provider.focusOperator.operatorId.toString()}.jpg", - ), - const SizedBox( - height: 10, - ), - TextButton( - style: buttonStyle, - onPressed: () { - bookOperatorButton(context); - }, - child: Container( - height: 50, + const SizedBox( + height: 30, + ), + Container( + height: 70, width: 315, decoration: BoxDecoration( - // color: Color(0xFFF8774A), + color: Color(0xFFF8774A), borderRadius: BorderRadius.circular(30)), - child: const Center( + child: Center( child: Text( - 'Book operator', - style: buttonTextStyle, + 'Select an operator for yourself', + style: GoogleFonts.poppins( + textStyle: const TextStyle( + fontWeight: FontWeight.w500, + fontSize: 15, + color: Colors.white)), ), ), ), - ) - ], - ); - }), - ), - body: Column( - children: [ - const SizedBox( - height: 30, - ), - Center( - child: CircleAvatar( - backgroundColor: Color(0xFFF4F4F4), - radius: 40, - child: Image.asset( - 'assets/aadharlogo.png', - width: 35, - height: 35, - ), + ], + ) + : Column( + children: [ + const Icon( + Icons.arrow_drop_up_outlined, + size: 40, + ), + OperatorBookCard( + name: provider.focusOperator.name!, + rating: provider.focusOperator.ratings!, + reviews: Map.fromIterable( + provider.focusOperator.reviews!, + key: (v) => v[0], + value: (v) => v), + image: + "operator/${provider.focusOperator.operatorId.toString()}.jpg", + ), + const SizedBox( + height: 10, + ), + TextButton( + style: buttonStyle, + onPressed: () { + bookOperatorButton(context); + }, + child: Container( + height: 50, + width: 315, + decoration: BoxDecoration( + // color: Color(0xFFF8774A), + borderRadius: BorderRadius.circular(30)), + child: const Center( + child: Text( + 'Book operator', + style: buttonTextStyle, + ), + ), + ), + ) + ], + )), + body: Column( + children: [ + const SizedBox( + height: 30, ), - ), - const SizedBox( - height: 10, - ), - Stack( - children: [ - Expanded( - child: ClipRRect( - borderRadius: BorderRadius.only( - topRight: Radius.circular(30), - topLeft: Radius.circular(30)), - child: Container( - width: MediaQuery.of(context).size.width, - height: 600, - child: MapmyIndiaMap( - initialCameraPosition: CameraPosition( - target: pinLocation, - zoom: 14.0, - ), - onMapCreated: (map) async { - _mapController = map; - _mapController.onSymbolTapped.add((Symbol symbol) { - symbolCallback(context, symbol); - // setState(() {}); - }); - }, - onStyleLoadedCallback: () { - addImageFromAsset( - "icon", "assets/operator_pin_icon.png"); - addImageFromAsset( - "iconhigh", "assets/icon_op_yellow.png"); - openMapmyIndiaPlacePickerWidget(); - }, - ), + Center( + child: CircleAvatar( + backgroundColor: Color(0xFFF4F4F4), + radius: 40, + child: Image.asset( + 'assets/aadharlogo.png', + width: 35, + height: 35, ), - )), - GestureDetector( - onTap: () { - openMapmyIndiaPlacePickerWidget(); - }, - child: Padding( - padding: EdgeInsets.all(25), + ), + ), + const SizedBox( + height: 10, + ), + Stack( + children: [ + Expanded( + child: ClipRRect( + borderRadius: BorderRadius.only( + topRight: Radius.circular(30), + topLeft: Radius.circular(30)), child: Container( - height: 35, - decoration: BoxDecoration( - color: Colors.white, - borderRadius: BorderRadius.circular(20), - border: Border.all(color: Colors.black), + width: MediaQuery.of(context).size.width, + height: 600, + child: MapmyIndiaMap( + initialCameraPosition: CameraPosition( + target: pinLocation, + zoom: 14.0, + ), + onMapCreated: (map) async { + _mapController = map; + _mapController.onSymbolTapped.add((Symbol symbol) { + symbolCallback(context, symbol); + // setState(() {}); + }); + }, + onStyleLoadedCallback: () { + addImageFromAsset( + "icon", "assets/operator_pin_icon.png"); + addImageFromAsset( + "iconhigh", "assets/icon_op_yellow.png"); + openMapmyIndiaPlacePickerWidget(); + }, ), - child: Padding( - padding: EdgeInsets.all(5), - child: SizedBox( - width: 140, - child: Row( - children: [ - const Icon( - Icons.arrow_back_ios, - color: Colors.black, - ), - Text( - 'Edit Location', - textAlign: TextAlign.center, - style: GoogleFonts.poppins( - textStyle: const TextStyle( - fontSize: 14, - fontWeight: FontWeight.w500)), - ), - ], + ), + )), + GestureDetector( + onTap: () { + openMapmyIndiaPlacePickerWidget(); + }, + child: Padding( + padding: EdgeInsets.all(25), + child: Container( + height: 35, + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.circular(20), + border: Border.all(color: Colors.black), + ), + child: Padding( + padding: EdgeInsets.all(5), + child: SizedBox( + width: 140, + child: Row( + children: [ + const Icon( + Icons.arrow_back_ios, + color: Colors.black, + ), + Text( + 'Edit Location', + textAlign: TextAlign.center, + style: GoogleFonts.poppins( + textStyle: const TextStyle( + fontSize: 14, + fontWeight: FontWeight.w500)), + ), + ], + ), ), ), ), ), ), - ), - ], - ), - ], - ), - ), + ], + ), + ], + ), + ); + }), ); } } diff --git a/lib/screens/serviceSelectionPage.dart b/lib/screens/serviceSelectionPage.dart index 4a2407f..1bdee8d 100644 --- a/lib/screens/serviceSelectionPage.dart +++ b/lib/screens/serviceSelectionPage.dart @@ -3,6 +3,7 @@ import 'package:google_fonts/google_fonts.dart'; import 'package:flutter/material.dart'; import 'package:mera_aadhar/provider/booking.dart'; import 'package:mera_aadhar/screens/documentCheckPage.dart'; +import 'package:mera_aadhar/services/auth/otp_signin.dart'; import 'package:mera_aadhar/services/snackbar.dart'; import 'package:provider/provider.dart'; @@ -84,14 +85,19 @@ print(Provider.of(context, listen: false) const SizedBox( height: 30, ), - Center( - child: CircleAvatar( - backgroundColor: Colors.white, - radius: 40, - child: Image.asset( - 'assets/aadharlogo.png', - width: 35, - height: 35, + GestureDetector( + onTap: () { + Provider.of(context, listen: false).logout(context); + }, + child: Center( + child: CircleAvatar( + backgroundColor: Colors.white, + radius: 40, + child: Image.asset( + 'assets/aadharlogo.png', + width: 35, + height: 35, + ), ), ), ), diff --git a/lib/widgets/operator_book_card.dart b/lib/widgets/operator_book_card.dart index f1ff901..b77e65a 100644 --- a/lib/widgets/operator_book_card.dart +++ b/lib/widgets/operator_book_card.dart @@ -31,10 +31,13 @@ class OperatorBookCard extends StatelessWidget { builder: (context, snapshot) { if (snapshot.hasError) { return Center( - child: Text( - 'Something went wrong', - style: kPoppinBlack, - )); + child: Image.asset( + 'assets/operator.png', + width: 130, + height: 160, + fit: BoxFit.fill, + ), + ); } if (snapshot.hasData && !snapshot.data!.isNotEmpty) {