diff --git a/lib/Utils/Common/CommonAppBar.dart b/lib/Utils/Common/CommonAppBar.dart new file mode 100644 index 0000000..a5b6d8f --- /dev/null +++ b/lib/Utils/Common/CommonAppBar.dart @@ -0,0 +1,112 @@ +// ignore_for_file: non_constant_identifier_names, file_names, prefer_const_constructors + +import 'package:flutter/material.dart'; +import 'package:flutter_screenutil/flutter_screenutil.dart'; +import 'package:get/get.dart'; +import 'package:traderscircuit/Utils/text.dart'; + +class CommonAppbar extends StatelessWidget implements PreferredSizeWidget { + @override + Size get preferredSize => Size.fromHeight(height!); + const CommonAppbar( + {Key? key, + required this.titleTxt, + this.suffixIcon, + this.showLeading = true, + this.customBack, + this.backPageName = '', + this.customActionWidget, + this.onCustomActionPressed, + this.height = 105}) + : super(key: key); + + final String titleTxt; + final String? suffixIcon; + final bool? showLeading; + final bool? customBack; + final String? backPageName; + final Widget? customActionWidget; + final VoidCallback? onCustomActionPressed; + final double? height; + @override + Widget build(BuildContext context) { + return PreferredSize( + preferredSize: Size.fromHeight(height ?? 130), + child: AppBar( + scrolledUnderElevation: 0.0, + backgroundColor: Colors.black, + elevation: 0, + leadingWidth: 56.w, + leading: Padding( + padding: EdgeInsets.only(left: 16.w, top: 20.h), + child: GestureDetector( + onTap: () { + customBack ?? false ? Get.toNamed(backPageName!) : Get.back(); + }, + child: Padding( + padding: EdgeInsets.only(left: 8.w), + child: Icon( + Icons.arrow_back_ios, + color: Colors.white, + size: 25.r, + ), + ), + ), + ), + flexibleSpace: FlexibleSpaceBar( + centerTitle: false, + titlePadding: EdgeInsets.all(0), + title: Padding( + padding: EdgeInsets.only(left: 16.w, right: 16), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.end, + children: [ + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Text( + titleTxt, + style: TextStyle( + color: Colors.white, + fontSize: 24.sp, + fontWeight: FontWeight.w500, + fontFamily: 'hiragino'), + maxLines: 2, + softWrap: true, + ), + ], + ), + + // newTextfield( + // FontWeight.w400, 0) + ], + ), + ), + ), + actions: [ + // if (calendarWidget == true) + // InkWell( + // onTap: onCustomActionPressed, + // child: Padding( + // padding: EdgeInsets.only(right: 14.w), + // child: Icon( + // Icons.calendar_month_outlined, + // color: Color(0xFF3192D8), + // size: 28, + // ), + // ), + // ), + if (customActionWidget != null) + InkWell( + onTap: onCustomActionPressed, + child: Padding( + padding: EdgeInsets.only(right: 14.w), + child: customActionWidget, + ), + ), + ], + ), + ); + } +} diff --git a/lib/Utils/Common/CommonBottomNavigation.dart b/lib/Utils/Common/CommonBottomNavigation.dart index 041298d..c3b43dc 100644 --- a/lib/Utils/Common/CommonBottomNavigation.dart +++ b/lib/Utils/Common/CommonBottomNavigation.dart @@ -146,7 +146,7 @@ GlassmorphicContainer bottomnavigationbar(MainController _mainController) { ), BottomNavigationBarItem( icon: Image.asset( - 'assets/images/png/sidemenu/inactiveprotfolio.png', + 'assets/images/png/sidemenu/inactiveshorttrade.png', height: 26.h, width: 26.w, ), @@ -168,6 +168,48 @@ GlassmorphicContainer bottomnavigationbar(MainController _mainController) { ], ), ), + Positioned( + left: 0, + right: 0, + top: 0, + bottom: 0, + child: Center( + child: Image.asset( + 'assets/images/png/sidemenu/activetrade.png', + height: 30.h, + width: 30.w, + ), + )) + ], + ), + + // SvgPicture.asset('assets/image/svg/active_shortTrade.svg'), + label: 'Past Performance', + ), + BottomNavigationBarItem( + icon: Image.asset( + 'assets/images/png/sidemenu/inactiveprotfolio.png', + height: 26.h, + width: 26.w, + ), + activeIcon: Stack( + children: [ + if (_mainController.selectedIndex.value == 3) + Container( + height: 40.h, + width: 40.w, + decoration: BoxDecoration( + shape: BoxShape.circle, + boxShadow: [ + BoxShadow( + color: Colors.grey.withOpacity(0.4), + spreadRadius: 15, + blurRadius: 10, + offset: Offset(0, 10), + ), + ], + ), + ), Positioned( left: 0, right: 0, diff --git a/lib/Utils/Common/MainController.dart b/lib/Utils/Common/MainController.dart index 1e0f997..a0ab397 100644 --- a/lib/Utils/Common/MainController.dart +++ b/lib/Utils/Common/MainController.dart @@ -1,5 +1,6 @@ import 'package:get/get.dart'; import 'package:traderscircuit/view/MainScreen/HomeScreen.dart'; +import 'package:traderscircuit/view/MainScreen/PastPerformance.dart'; import 'package:traderscircuit/view/MainScreen/Portfolio/Holdings.dart'; import 'package:traderscircuit/view/MainScreen/Portfolio/PortfolioEmpty.dart'; import 'package:traderscircuit/view/MainScreen/ShortTrade.dart'; @@ -10,6 +11,7 @@ class MainController extends GetxController { var currentTab = [ const HomeScreen(), const ShortTrade(), + const PastPerformance(), const Portfolio(), ].obs; diff --git a/lib/Utils/api_urls.dart b/lib/Utils/api_urls.dart index cd3c1c6..92efd6a 100644 --- a/lib/Utils/api_urls.dart +++ b/lib/Utils/api_urls.dart @@ -4,7 +4,7 @@ class ApiUrls { static const String pieBase = "https://app.piadvisors.in/"; //Base URL - static const base = "http://192.168.50.112/Trader_circuit/api/"; + static const base = "https://tradercircuit.betadelivery.com/api/"; //send otp static String sendOtp = "${base}sendOTP"; diff --git a/lib/view/MainScreen/HomeScreen.dart b/lib/view/MainScreen/HomeScreen.dart index aa3effe..604e44a 100644 --- a/lib/view/MainScreen/HomeScreen.dart +++ b/lib/view/MainScreen/HomeScreen.dart @@ -1,5 +1,6 @@ // import 'package:flutter/material.dart'; import 'package:flutter/material.dart'; +import 'package:flutter/services.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:flutter_svg/svg.dart'; import 'package:get/get.dart'; @@ -27,172 +28,217 @@ class _HomeScreenState extends State { GlobalKey _scaffoldKey1 = GlobalKey(); @override Widget build(BuildContext context) { - return Scaffold( - drawerEnableOpenDragGesture: false, - key: _scaffoldKey1, - backgroundColor: Colors.black, - drawer: Container(child: SideMenu()), - extendBody: true, - appBar: AppBar( - scrolledUnderElevation: 0.0, + return WillPopScope( + onWillPop: () async { + _onBackButtonPressed(context); + return true; // Return true to allow the pop action + }, + child: Scaffold( + drawerEnableOpenDragGesture: false, + key: _scaffoldKey1, backgroundColor: Colors.black, - elevation: 0, - automaticallyImplyLeading: false, - titleSpacing: 0, - leading: InkWell( - onTap: () { - _scaffoldKey1.currentState?.openDrawer(); - }, - child: Center( - child: Image.asset( - 'assets/images/png/menu.png', - height: 15.h, - width: 20.w, + drawer: Container(child: SideMenu()), + extendBody: true, + appBar: AppBar( + scrolledUnderElevation: 0.0, + backgroundColor: Colors.black, + elevation: 0, + automaticallyImplyLeading: false, + titleSpacing: 0, + leading: InkWell( + onTap: () { + _scaffoldKey1.currentState?.openDrawer(); + }, + child: Center( + child: Image.asset( + 'assets/images/png/menu.png', + height: 15.h, + width: 20.w, + ), ), ), + actions: [ + InkWell( + onTap: () { + Get.toNamed(RouteName.notification); + }, + child: Padding( + padding: EdgeInsets.only(right: 14.w), + child: SvgPicture.asset('assets/images/svg/Group 1897.svg')), + ), + ], ), - actions: [ - InkWell( - onTap: () { - Get.toNamed(RouteName.notification); - }, - child: Padding( - padding: EdgeInsets.only(right: 14.w), - child: SvgPicture.asset('assets/images/svg/Group 1897.svg')), - ), - ], - ), - body: Stack( - children: [ - CommonBlurLeft(), - CommonBlurRight(), - Stack(children: [ - Padding( - padding: EdgeInsets.symmetric(horizontal: 16, vertical: 16), - child: ListView( - physics: BouncingScrollPhysics(), - children: [ - sizedBoxHeight(20.h), - Text( - "Welcome Afrid", - style: TextStyle( - color: Colors.white, - fontSize: 24.sp, - fontFamily: 'hiragino', - fontWeight: FontWeight.w500), - ), - sizedBoxHeight(25.h), - SingleChildScrollView( - scrollDirection: Axis.horizontal, - child: Row( + body: Stack( + children: [ + CommonBlurLeft(), + CommonBlurRight(), + Stack(children: [ + Padding( + padding: EdgeInsets.symmetric(horizontal: 16, vertical: 16), + child: ListView( + physics: BouncingScrollPhysics(), + children: [ + sizedBoxHeight(20.h), + Text( + "Welcome Afrid", + style: TextStyle( + color: Colors.white, + fontSize: 24.sp, + fontFamily: 'hiragino', + fontWeight: FontWeight.w500), + ), + sizedBoxHeight(25.h), + SingleChildScrollView( + scrollDirection: Axis.horizontal, + child: Row( + children: [ + commoncontainer( + width: 180.w, + text: 'NIFTY', + amount: '22,286.95', + rate: '+304.15 (+1.38%)'), + sizedBoxWidth(10.w), + commoncontainer( + width: 220.w, + text: 'BANKNIFTY', + amount: '22,286.95', + rate: '+896.10 (+1.94%)'), + ], + ), + ), + sizedBoxHeight(30.h), + Container( + width: double.infinity, + height: 1.h, + color: Color(0xFF3A3A3A), + ), + sizedBoxHeight(30.h), + text22W500('View our products'), + sizedBoxHeight(30.h), + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ - commoncontainer( - width: 180.w, - text: 'NIFTY', - amount: '22,286.95', - rate: '+304.15 (+1.38%)'), - sizedBoxWidth(10.w), - commoncontainer( - width: 220.w, - text: 'BANKNIFTY', - amount: '22,286.95', - rate: '+896.10 (+1.94%)'), + ProductWidget( + text: 'Options', subtext: 'Recommendation'), + ProductWidget( + text: 'Multibagger', subtext: 'Recommendation') ], ), - ), - sizedBoxHeight(30.h), - Container( - width: double.infinity, - height: 1.h, - color: Color(0xFF3A3A3A), - ), - sizedBoxHeight(30.h), - text22W500('View our products'), - sizedBoxHeight(30.h), - Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - ProductWidget(text: 'Options', subtext: 'Recommendation'), - ProductWidget( - text: 'Multibagger', subtext: 'Recommendation') - ], - ), - sizedBoxHeight(15.h), - Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - ProductWidget( - text: 'Swing Trade', subtext: 'Recommendation'), - ProductWidget( - text: 'OP + MB + ST', subtext: 'Recommendation'), - ], - ), - sizedBoxHeight(25.h), - Row( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - SvgPicture.asset('assets/images/svg/Vector (2).svg'), - sizedBoxWidth(10.w), - text18W500('UNLOCK NOW!'), - ], - ), - sizedBoxHeight(25.h), - Container( - width: double.infinity, - height: 1.h, - color: Color(0xFF3A3A3A), - ), - sizedBoxHeight(25.h), - Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - crossAxisAlignment: CrossAxisAlignment.end, - children: [ - text22W600('Explore The Unseen'), - GestureDetector( - onTap: () { - Get.toNamed(RouteName.exploreUnseen); - }, - child: Container( - height: 35.h, - width: 105.w, - decoration: BoxDecoration( - color: Color(0xFF3A3A3A).withOpacity(0.6), - borderRadius: BorderRadius.circular(5.r), - border: Border.all( - color: Color(0xFF3A3A3A), - )), - child: Center(child: text16W500('View More')), - ), - ), - ], - ), - sizedBoxHeight(35.h), - DefaultTabController( - length: 2, - child: Column( + sizedBoxHeight(15.h), + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ - MyTabBar(), - SizedBox( - height: 700.h, - child: TabBarView( - children: [ - ActiveCallsTab(), - ExitedCallsTab(), - ], + ProductWidget( + text: 'Swing Trade', subtext: 'Recommendation'), + ProductWidget( + text: 'OP + MB + ST', subtext: 'Recommendation'), + ], + ), + sizedBoxHeight(25.h), + Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + SvgPicture.asset('assets/images/svg/Vector (2).svg'), + sizedBoxWidth(10.w), + text18W500('UNLOCK NOW!'), + ], + ), + sizedBoxHeight(25.h), + Container( + width: double.infinity, + height: 1.h, + color: Color(0xFF3A3A3A), + ), + sizedBoxHeight(25.h), + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + crossAxisAlignment: CrossAxisAlignment.end, + children: [ + text22W600('Explore The Unseen'), + GestureDetector( + onTap: () { + Get.toNamed(RouteName.exploreUnseen); + }, + child: Container( + height: 35.h, + width: 105.w, + decoration: BoxDecoration( + color: Color(0xFF3A3A3A).withOpacity(0.6), + borderRadius: BorderRadius.circular(5.r), + border: Border.all( + color: Color(0xFF3A3A3A), + )), + child: Center(child: text16W500('View More')), ), ), ], ), - ), - ], - ), - ) - ]) - ], + sizedBoxHeight(35.h), + DefaultTabController( + length: 2, + child: Column( + children: [ + MyTabBar(), + SizedBox( + height: 700.h, + child: TabBarView( + children: [ + ActiveCallsTab(), + ExitedCallsTab(), + ], + ), + ), + ], + ), + ), + ], + ), + ) + ]) + ], + ), + bottomNavigationBar: bottomnavigationbar(mainController), ), - bottomNavigationBar: bottomnavigationbar(mainController), ); } + + Future _onBackButtonPressed(BuildContext context) async { + bool? exitApp = await showDialog( + context: context, + builder: (context) { + return AlertDialog( + backgroundColor: const Color(0xFFFFF3E4), + title: const Text('Exit App'), + content: const Text('Do you really want to close the app?'), + actions: [ + TextButton( + onPressed: () { + Navigator.of(context).pop(false); + }, + child: const Text( + 'No', + style: TextStyle( + color: Color(0xff1B243D), + ), + ), + ), + TextButton( + onPressed: () { + SystemNavigator.pop(); + Navigator.pop(context); + }, + child: const Text( + 'Yes', + style: TextStyle( + color: Color(0xff1B243D), + ), + ), + ) + ], + ); + }); + return exitApp ?? false; + } } Widget ActiveCallsTab() { diff --git a/lib/view/MainScreen/MainScreen.dart b/lib/view/MainScreen/MainScreen.dart index e4c470f..85322f0 100644 --- a/lib/view/MainScreen/MainScreen.dart +++ b/lib/view/MainScreen/MainScreen.dart @@ -1,4 +1,5 @@ import 'package:flutter/material.dart'; +import 'package:flutter/services.dart'; import 'package:get/get.dart'; import 'package:traderscircuit/Utils/Common/MainController.dart'; @@ -14,4 +15,5 @@ class MainScreen extends StatelessWidget { ); }); } + } diff --git a/lib/view/MainScreen/PastPerformance.dart b/lib/view/MainScreen/PastPerformance.dart new file mode 100644 index 0000000..cee2d51 --- /dev/null +++ b/lib/view/MainScreen/PastPerformance.dart @@ -0,0 +1,220 @@ +import 'dart:async'; +import 'dart:convert'; + +import 'package:async/async.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter/services.dart'; +import 'package:flutter_screenutil/flutter_screenutil.dart'; +import 'package:get/get.dart'; +import 'package:lottie/lottie.dart'; +import 'package:scgateway_flutter_plugin/scgateway_flutter_plugin.dart'; +import 'package:traderscircuit/Utils/Common/CommonBottomNavigation.dart'; +import 'package:traderscircuit/Utils/Common/commonBotton.dart'; +import 'package:traderscircuit/Utils/text.dart'; +import 'package:traderscircuit/view/MainScreen/MainScreen.dart'; +import 'package:traderscircuit/view/MainScreen/Portfolio/Holdings.dart'; +import 'package:traderscircuit/view/Sidemenu/Sidemenu.dart'; +import 'package:traderscircuit/view/onBoarding/splashScreen1.dart'; + +import '../../../model/SmallCaseModel/broker_account_model.dart'; +import '../../../view_model/SmallCaseApi/smallcase_api_methods.dart'; + +class PastPerformance extends StatefulWidget { + const PastPerformance({super.key}); + + @override + State createState() => _PastPerformanceState(); +} + +class _PastPerformanceState extends State { + GlobalKey _scaffoldKey1 = GlobalKey(); + List containerTexts = ["Swing Trade", "Multibagger", "Options"]; + final selectedIndex = 0.obs; + + FutureGroup fetchUserIdAndBrokerAccounts = FutureGroup(); + List myBrokerAccounts = []; + @override + void initState() { + // fetchUserIdAndBrokerAccounts.add(getUserId()); // TODO Need to add userid here + fetchUserIdAndBrokerAccounts.add(fetchBrokerAccounts()); + fetchUserIdAndBrokerAccounts.close(); + + super.initState(); + } + + @override + Widget build(BuildContext context) { + return WillPopScope( + onWillPop: () async { + _onBackButtonPressed(context); + return true; // Return true to allow the pop action + }, + child: Scaffold( + key: _scaffoldKey1, + backgroundColor: Colors.black, + drawerEnableOpenDragGesture: false, + drawer: Container(child: const SideMenu()), + extendBody: true, + appBar: AppBar( + scrolledUnderElevation: 0.0, + backgroundColor: Colors.black, + elevation: 0, + automaticallyImplyLeading: false, + titleSpacing: 0, + leading: InkWell( + onTap: () { + _scaffoldKey1.currentState?.openDrawer(); + }, + child: Center( + child: Image.asset( + 'assets/images/png/menu.png', + height: 15.h, + width: 20.w, + ), + ), + ), + ), + body: Stack( + children: [ + const CommonBlurLeft(), + const CommonBlurRight(), + Stack( + children: [ + Padding( + padding: + const EdgeInsets.symmetric(horizontal: 16, vertical: 16), + child: Column( + children: [ + Row( + children: [ + text25W600("Past Performances"), + ], + ), + SizedBox( + height: 10.h, + ), + Row( + children: [ + Text( + 'How we proved possibles!', + textAlign: TextAlign.center, + style: TextStyle( + fontFamily: 'hiragino', + color: Colors.white, + fontSize: 16.sp, + fontWeight: FontWeight.w400, + ), + ), + ], + ), + CommonBtn( + text: "Add", + onTap: () { + // replaceAddAccountBtnWithLoader(); + // Timer.periodic(Duration(seconds: 8), (timer) { + // // replaceLoaderWithAddAccountBtn(); + // timer.cancel(); + // }); + fetchAuthToken().then((fetchedAuthToken) { + debugPrint("fetchedAuthToken $fetchedAuthToken"); + fetchBrokerConnectTxnId( + authToken: fetchedAuthToken) + .then( + (txnId) => ScgatewayFlutterPlugin.initGateway( + fetchedAuthToken) + .then( + (value) => ScgatewayFlutterPlugin + .triggerGatewayTransaction( + txnId, + ).then( + (loginRes) { + if (loginRes != null) { + var data = jsonDecode(loginRes)['data']; + if (data != null) { + String authToken = jsonDecode( + data)['smallcaseAuthToken']; + String brokerName = + jsonDecode(data)['broker']; + String txnId = + jsonDecode(data)['transactionId']; + // getUserId().then((userId) { + postBrokerAccount( + userId: "12", + brokerName: brokerName, + authToken: authToken, + txnId: txnId) + .then((isPosted) { + // replaceLoaderWithAddAccountBtn(); + // Navigator.pushReplacement( + // context, + // MaterialPageRoute( + // builder: (context) => + // Broker())); + ScaffoldMessenger.of(context) + .clearSnackBars(); + ScaffoldMessenger.of(context) + .showSnackBar(SnackBar( + content: Text( + 'New broker account is added'))); + }); + // }); + // replaceLoaderWithAddAccountBtn(); + } + } + }, + ), + ), + ); + }); + }), + const Spacer(), + ], + ), + ), + ], + ) + ], + ), + bottomNavigationBar: bottomnavigationbar(mainController), + ), + ); + } + + Future _onBackButtonPressed(BuildContext context) async { + bool? exitApp = await showDialog( + context: context, + builder: (context) { + return AlertDialog( + backgroundColor: const Color(0xFFFFF3E4), + title: const Text('Exit App'), + content: const Text('Do you really want to close the app?'), + actions: [ + TextButton( + onPressed: () { + Navigator.of(context).pop(false); + }, + child: const Text( + 'No', + style: TextStyle( + color: Color(0xff1B243D), + ), + ), + ), + TextButton( + onPressed: () { + SystemNavigator.pop(); + Navigator.pop(context); + }, + child: const Text( + 'Yes', + style: TextStyle( + color: Color(0xff1B243D), + ), + ), + ) + ], + ); + }); + return exitApp ?? false; + } +} diff --git a/lib/view/MainScreen/Portfolio/Holdings.dart b/lib/view/MainScreen/Portfolio/Holdings.dart index df90de4..c30aff5 100644 --- a/lib/view/MainScreen/Portfolio/Holdings.dart +++ b/lib/view/MainScreen/Portfolio/Holdings.dart @@ -1,4 +1,5 @@ import 'package:flutter/material.dart'; +import 'package:flutter/services.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:flutter_svg/svg.dart'; import 'package:get/get.dart'; @@ -31,160 +32,204 @@ class _HoldingsState extends State { final selectedIndex = 0.obs; @override Widget build(BuildContext context) { - return Scaffold( - key: _scaffoldKey1, - backgroundColor: Colors.black, - drawerEnableOpenDragGesture: false, - drawer: Container(child: SideMenu()), - extendBody: true, - appBar: AppBar( - scrolledUnderElevation: 0.0, + return WillPopScope( + onWillPop: () async { + _onBackButtonPressed(context); + return true; // Return true to allow the pop action + }, + child: Scaffold( + key: _scaffoldKey1, backgroundColor: Colors.black, - elevation: 0, - automaticallyImplyLeading: false, - titleSpacing: 0, - leading: InkWell( - onTap: () { - _scaffoldKey1.currentState?.openDrawer(); - }, - child: Center( - child: Image.asset( - 'assets/images/png/menu.png', - height: 15.h, - width: 20.w, + drawerEnableOpenDragGesture: false, + drawer: Container(child: SideMenu()), + extendBody: true, + appBar: AppBar( + scrolledUnderElevation: 0.0, + backgroundColor: Colors.black, + elevation: 0, + automaticallyImplyLeading: false, + titleSpacing: 0, + leading: InkWell( + onTap: () { + _scaffoldKey1.currentState?.openDrawer(); + }, + child: Center( + child: Image.asset( + 'assets/images/png/menu.png', + height: 15.h, + width: 20.w, + ), ), ), ), - ), - body: Stack( - children: [ - CommonBlurLeft(), - CommonBlurRight(), - Stack( - children: [ - Padding( - padding: EdgeInsets.symmetric(horizontal: 16, vertical: 16), - child: ListView( - physics: NeverScrollableScrollPhysics(), - children: [ - text25W600("My Portfolio"), - SizedBox( - height: 10, - ), - DefaultTabController( - length: 5, - // initialIndex: selectedIndex.value, - child: Column( - children: [ - PortfolioTabBar(), - SizedBox( - height: 30.h, - ), - SizedBox( - height: 570.h, - child: TabBarView( - children: [ - DefaultTabController( - length: 2, - // initialIndex: selectedIndex.value, - child: Column( - children: [ - HoldingsTabBar(), - Expanded( - child: TabBarView( - children: [ - Holdings(), - PortfolioReview(), - ], - ), - ), - ], - ), - ), - DefaultTabController( - length: 2, - // initialIndex: selectedIndex.value, - child: Column( - children: [ - HoldingsTabBar(), - Expanded( - child: TabBarView( - children: [ - Holdings(), - PortfolioReview(), - ], - ), - ), - ], - ), - ), - DefaultTabController( - length: 2, - // initialIndex: selectedIndex.value, - child: Column( - children: [ - HoldingsTabBar(), - Expanded( - child: TabBarView( - children: [ - Holdings(), - PortfolioReview(), - ], - ), - ), - ], - ), - ), - DefaultTabController( - length: 2, - // initialIndex: selectedIndex.value, - child: Column( - children: [ - HoldingsTabBar(), - Expanded( - child: TabBarView( - children: [ - Holdings(), - PortfolioReview(), - ], - ), - ), - ], - ), - ), - DefaultTabController( - length: 2, - // initialIndex: selectedIndex.value, - child: Column( - children: [ - HoldingsTabBar(), - Expanded( - child: TabBarView( - children: [ - Holdings(), - PortfolioReview(), - ], - ), - ), - ], - ), - ), - ], - ), - ), - ], + body: Stack( + children: [ + CommonBlurLeft(), + CommonBlurRight(), + Stack( + children: [ + Padding( + padding: EdgeInsets.symmetric(horizontal: 16, vertical: 16), + child: ListView( + physics: NeverScrollableScrollPhysics(), + children: [ + text25W600("My Portfolio"), + SizedBox( + height: 10, ), - ), - sizedBoxHeight(40.h), - ], + DefaultTabController( + length: 5, + // initialIndex: selectedIndex.value, + child: Column( + children: [ + PortfolioTabBar(), + SizedBox( + height: 30.h, + ), + SizedBox( + height: 570.h, + child: TabBarView( + children: [ + DefaultTabController( + length: 2, + // initialIndex: selectedIndex.value, + child: Column( + children: [ + HoldingsTabBar(), + Expanded( + child: TabBarView( + children: [ + Holdings(), + PortfolioReview(), + ], + ), + ), + ], + ), + ), + DefaultTabController( + length: 2, + // initialIndex: selectedIndex.value, + child: Column( + children: [ + HoldingsTabBar(), + Expanded( + child: TabBarView( + children: [ + Holdings(), + PortfolioReview(), + ], + ), + ), + ], + ), + ), + DefaultTabController( + length: 2, + // initialIndex: selectedIndex.value, + child: Column( + children: [ + HoldingsTabBar(), + Expanded( + child: TabBarView( + children: [ + Holdings(), + PortfolioReview(), + ], + ), + ), + ], + ), + ), + DefaultTabController( + length: 2, + // initialIndex: selectedIndex.value, + child: Column( + children: [ + HoldingsTabBar(), + Expanded( + child: TabBarView( + children: [ + Holdings(), + PortfolioReview(), + ], + ), + ), + ], + ), + ), + DefaultTabController( + length: 2, + // initialIndex: selectedIndex.value, + child: Column( + children: [ + HoldingsTabBar(), + Expanded( + child: TabBarView( + children: [ + Holdings(), + PortfolioReview(), + ], + ), + ), + ], + ), + ), + ], + ), + ), + ], + ), + ), + sizedBoxHeight(40.h), + ], + ), + ), + ], + ), + ], + ), + bottomNavigationBar: bottomnavigationbar(mainController), + ), + ); + } + + Future _onBackButtonPressed(BuildContext context) async { + bool? exitApp = await showDialog( + context: context, + builder: (context) { + return AlertDialog( + backgroundColor: const Color(0xFFFFF3E4), + title: const Text('Exit App'), + content: const Text('Do you really want to close the app?'), + actions: [ + TextButton( + onPressed: () { + Navigator.of(context).pop(false); + }, + child: const Text( + 'No', + style: TextStyle( + color: Color(0xff1B243D), + ), ), ), + TextButton( + onPressed: () { + SystemNavigator.pop(); + Navigator.pop(context); + }, + child: const Text( + 'Yes', + style: TextStyle( + color: Color(0xff1B243D), + ), + ), + ) ], - ), - ], - ), - bottomNavigationBar: bottomnavigationbar(mainController), - ); + ); + }); + return exitApp ?? false; } Widget Holdings() { diff --git a/lib/view/MainScreen/Portfolio/PortfolioEmpty.dart b/lib/view/MainScreen/Portfolio/PortfolioEmpty.dart index cff2cdd..de30a5f 100644 --- a/lib/view/MainScreen/Portfolio/PortfolioEmpty.dart +++ b/lib/view/MainScreen/Portfolio/PortfolioEmpty.dart @@ -3,6 +3,7 @@ import 'dart:convert'; import 'package:async/async.dart'; import 'package:flutter/material.dart'; +import 'package:flutter/services.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:get/get.dart'; import 'package:lottie/lottie.dart'; @@ -256,135 +257,180 @@ class _PortfolioState extends State { @override Widget build(BuildContext context) { - return Scaffold( - key: _scaffoldKey1, - backgroundColor: Colors.black, - drawerEnableOpenDragGesture: false, - drawer: Container(child: const SideMenu()), - extendBody: true, - appBar: AppBar( - scrolledUnderElevation: 0.0, + return WillPopScope( + onWillPop: () async { + _onBackButtonPressed(context); + return true; // Return true to allow the pop action + }, + child: Scaffold( + key: _scaffoldKey1, backgroundColor: Colors.black, - elevation: 0, - automaticallyImplyLeading: false, - titleSpacing: 0, - leading: InkWell( - onTap: () { - _scaffoldKey1.currentState?.openDrawer(); - }, - child: Center( - child: Image.asset( - 'assets/images/png/menu.png', - height: 15.h, - width: 20.w, + drawerEnableOpenDragGesture: false, + drawer: Container(child: const SideMenu()), + extendBody: true, + appBar: AppBar( + scrolledUnderElevation: 0.0, + backgroundColor: Colors.black, + elevation: 0, + automaticallyImplyLeading: false, + titleSpacing: 0, + leading: InkWell( + onTap: () { + _scaffoldKey1.currentState?.openDrawer(); + }, + child: Center( + child: Image.asset( + 'assets/images/png/menu.png', + height: 15.h, + width: 20.w, + ), ), ), ), - ), - body: Stack( - children: [ - const CommonBlurLeft(), - const CommonBlurRight(), - Stack( - children: [ - Padding( - padding: - const EdgeInsets.symmetric(horizontal: 16, vertical: 16), - child: Column( - children: [ - Row( - children: [ - text25W600("My Portfolio"), - ], - ), - SizedBox( - height: 30.h, - ), - Text( - 'Please click the "Add" button below to add a portfolio.', - textAlign: TextAlign.center, - style: TextStyle( - fontFamily: 'hiragino', - color: Colors.white, - fontSize: 16.sp, - fontWeight: FontWeight.w400, + body: Stack( + children: [ + const CommonBlurLeft(), + const CommonBlurRight(), + Stack( + children: [ + Padding( + padding: + const EdgeInsets.symmetric(horizontal: 16, vertical: 16), + child: Column( + children: [ + Row( + children: [ + text25W600("My Portfolio"), + ], ), - ), - const Spacer(), - LottieBuilder.asset( - "assets/images/empty.json", - width: 200.w, - height: 200.h, - ), - const Spacer(), - CommonBtn( - text: "Add", - onTap: () { - // replaceAddAccountBtnWithLoader(); - // Timer.periodic(Duration(seconds: 8), (timer) { - // // replaceLoaderWithAddAccountBtn(); - // timer.cancel(); - // }); - fetchAuthToken().then((fetchedAuthToken) { - debugPrint("fetchedAuthToken $fetchedAuthToken"); - fetchBrokerConnectTxnId(authToken: fetchedAuthToken) - .then( - (txnId) => ScgatewayFlutterPlugin.initGateway( - fetchedAuthToken) + SizedBox( + height: 30.h, + ), + Text( + 'Please click the "Add" button below to add a portfolio.', + textAlign: TextAlign.center, + style: TextStyle( + fontFamily: 'hiragino', + color: Colors.white, + fontSize: 16.sp, + fontWeight: FontWeight.w400, + ), + ), + const Spacer(), + LottieBuilder.asset( + "assets/images/empty.json", + width: 200.w, + height: 200.h, + ), + const Spacer(), + CommonBtn( + text: "Add", + onTap: () { + // replaceAddAccountBtnWithLoader(); + // Timer.periodic(Duration(seconds: 8), (timer) { + // // replaceLoaderWithAddAccountBtn(); + // timer.cancel(); + // }); + fetchAuthToken().then((fetchedAuthToken) { + debugPrint("fetchedAuthToken $fetchedAuthToken"); + fetchBrokerConnectTxnId( + authToken: fetchedAuthToken) .then( - (value) => ScgatewayFlutterPlugin - .triggerGatewayTransaction( - txnId, - ).then( - (loginRes) { - if (loginRes != null) { - var data = jsonDecode(loginRes)['data']; - if (data != null) { - String authToken = jsonDecode( - data)['smallcaseAuthToken']; - String brokerName = - jsonDecode(data)['broker']; - String txnId = - jsonDecode(data)['transactionId']; - // getUserId().then((userId) { - postBrokerAccount( - userId: "12", - brokerName: brokerName, - authToken: authToken, - txnId: txnId) - .then((isPosted) { - // replaceLoaderWithAddAccountBtn(); - // Navigator.pushReplacement( - // context, - // MaterialPageRoute( - // builder: (context) => - // Broker())); - ScaffoldMessenger.of(context) - .clearSnackBars(); - ScaffoldMessenger.of(context) - .showSnackBar(SnackBar( - content: Text( - 'New broker account is added'))); - }); - // }); - // replaceLoaderWithAddAccountBtn(); + (txnId) => ScgatewayFlutterPlugin.initGateway( + fetchedAuthToken) + .then( + (value) => ScgatewayFlutterPlugin + .triggerGatewayTransaction( + txnId, + ).then( + (loginRes) { + if (loginRes != null) { + var data = jsonDecode(loginRes)['data']; + if (data != null) { + String authToken = jsonDecode( + data)['smallcaseAuthToken']; + String brokerName = + jsonDecode(data)['broker']; + String txnId = + jsonDecode(data)['transactionId']; + // getUserId().then((userId) { + postBrokerAccount( + userId: "12", + brokerName: brokerName, + authToken: authToken, + txnId: txnId) + .then((isPosted) { + // replaceLoaderWithAddAccountBtn(); + // Navigator.pushReplacement( + // context, + // MaterialPageRoute( + // builder: (context) => + // Broker())); + ScaffoldMessenger.of(context) + .clearSnackBars(); + ScaffoldMessenger.of(context) + .showSnackBar(SnackBar( + content: Text( + 'New broker account is added'))); + }); + // }); + // replaceLoaderWithAddAccountBtn(); + } } - } - }, + }, + ), ), - ), - ); - }); - }), - const Spacer(), - ], + ); + }); + }), + const Spacer(), + ], + ), ), - ), - ], - ) - ], + ], + ) + ], + ), + bottomNavigationBar: bottomnavigationbar(mainController), ), - bottomNavigationBar: bottomnavigationbar(mainController), ); } + + Future _onBackButtonPressed(BuildContext context) async { + bool? exitApp = await showDialog( + context: context, + builder: (context) { + return AlertDialog( + backgroundColor: const Color(0xFFFFF3E4), + title: const Text('Exit App'), + content: const Text('Do you really want to close the app?'), + actions: [ + TextButton( + onPressed: () { + Navigator.of(context).pop(false); + }, + child: const Text( + 'No', + style: TextStyle( + color: Color(0xff1B243D), + ), + ), + ), + TextButton( + onPressed: () { + SystemNavigator.pop(); + Navigator.pop(context); + }, + child: const Text( + 'Yes', + style: TextStyle( + color: Color(0xff1B243D), + ), + ), + ) + ], + ); + }); + return exitApp ?? false; + } } diff --git a/lib/view/MainScreen/ShortTrade.dart b/lib/view/MainScreen/ShortTrade.dart index d9adedd..2728be9 100644 --- a/lib/view/MainScreen/ShortTrade.dart +++ b/lib/view/MainScreen/ShortTrade.dart @@ -1,4 +1,5 @@ import 'package:flutter/material.dart'; +import 'package:flutter/services.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:flutter_svg/svg.dart'; import 'package:get/get.dart'; @@ -29,113 +30,157 @@ class _ShortTradeState extends State { final selectedIndex = 0.obs; @override Widget build(BuildContext context) { - return Scaffold( - key: _scaffoldKey1, - backgroundColor: Colors.black, drawerEnableOpenDragGesture: false, - drawer: Container(child: SideMenu()), - extendBody: true, - appBar: AppBar( - scrolledUnderElevation: 0.0, - backgroundColor: Colors.black, - elevation: 0, - automaticallyImplyLeading: false, - titleSpacing: 0, - leading: InkWell( - onTap: () { - _scaffoldKey1.currentState?.openDrawer(); - }, - child: Center( - child: Image.asset( - 'assets/images/png/menu.png', - height: 15.h, - width: 20.w, + return WillPopScope( + onWillPop: () async { + _onBackButtonPressed(context); + return true; // Return true to allow the pop action + }, + child: Scaffold( + key: _scaffoldKey1, + backgroundColor: Colors.black, drawerEnableOpenDragGesture: false, + drawer: Container(child: SideMenu()), + extendBody: true, + appBar: AppBar( + scrolledUnderElevation: 0.0, + backgroundColor: Colors.black, + elevation: 0, + automaticallyImplyLeading: false, + titleSpacing: 0, + leading: InkWell( + onTap: () { + _scaffoldKey1.currentState?.openDrawer(); + }, + child: Center( + child: Image.asset( + 'assets/images/png/menu.png', + height: 15.h, + width: 20.w, + ), ), ), + // title: text22W600('Short'), ), - // title: text22W600('Short'), - ), - // CommonAppbar( - // titleTxt: '', - // // preferredSize: Size.fromHeight(60.h), - // showLeading: false, - // customleading: InkWell( - // onTap: () { - // _scaffoldKey1.currentState?.openDrawer(); - // }, - // child: Center( - // child: Image.asset( - // 'assets/images/png/menu.png', - // height: 15.h, - // width: 20.w, - // ), - // ), - // // Icon( - // // Icons.menu, - // // color: Colors.white, - // // size: 27.sp, - // // ), - // ), - // ), - body: Stack( - children: [ - CommonBlurLeft(), - CommonBlurRight(), - Stack(children: [ - Padding( - padding: EdgeInsets.symmetric(horizontal: 16, vertical: 16), - child: ListView(physics: BouncingScrollPhysics(), children: [ - sizedBoxHeight(15.h), - SizedBox( - height: 60, - width: double.infinity, - // color: Colors.amber, - child: ListView.builder( - shrinkWrap: true, - scrollDirection: Axis.horizontal, - itemCount: containerTexts.length, - itemBuilder: (context, index) { - return GestureDetector( - onTap: () { - selectedIndex.value = index; - }, - child: Row( + // CommonAppbar( + // titleTxt: '', + // // preferredSize: Size.fromHeight(60.h), + // showLeading: false, + // customleading: InkWell( + // onTap: () { + // _scaffoldKey1.currentState?.openDrawer(); + // }, + // child: Center( + // child: Image.asset( + // 'assets/images/png/menu.png', + // height: 15.h, + // width: 20.w, + // ), + // ), + // // Icon( + // // Icons.menu, + // // color: Colors.white, + // // size: 27.sp, + // // ), + // ), + // ), + body: Stack( + children: [ + CommonBlurLeft(), + CommonBlurRight(), + Stack(children: [ + Padding( + padding: EdgeInsets.symmetric(horizontal: 16, vertical: 16), + child: ListView(physics: BouncingScrollPhysics(), children: [ + sizedBoxHeight(15.h), + SizedBox( + height: 60, + width: double.infinity, + // color: Colors.amber, + child: ListView.builder( + shrinkWrap: true, + scrollDirection: Axis.horizontal, + itemCount: containerTexts.length, + itemBuilder: (context, index) { + return GestureDetector( + onTap: () { + selectedIndex.value = index; + }, + child: Row( + children: [ + topContainer(containerTexts[index], index), + sizedBoxWidth(10.w) + ], + ), + ); + }), + ), + sizedBoxHeight(20.h), + DefaultTabController( + length: 2, + // initialIndex: selectedIndex.value, + child: Column( + children: [ + MyTabBar(), + SizedBox( + height: 700.h, + child: TabBarView( children: [ - topContainer(containerTexts[index], index), - sizedBoxWidth(10.w) + ActiveCallsTab(), + ExitedCallsTab(), ], ), - ); - }), - ), - sizedBoxHeight(20.h), - DefaultTabController( - length: 2, - // initialIndex: selectedIndex.value, - child: Column( - children: [ - MyTabBar(), - SizedBox( - height: 700.h, - child: TabBarView( - children: [ - ActiveCallsTab(), - ExitedCallsTab(), - ], ), - ), - ], + ], + ), ), - ), - sizedBoxHeight(20.h), - ])) - ]) - ], + sizedBoxHeight(20.h), + ])) + ]) + ], + ), + bottomNavigationBar: bottomnavigationbar(mainController), ), - bottomNavigationBar: bottomnavigationbar(mainController), ); } + Future _onBackButtonPressed(BuildContext context) async { + bool? exitApp = await showDialog( + context: context, + builder: (context) { + return AlertDialog( + backgroundColor: const Color(0xFFFFF3E4), + title: const Text('Exit App'), + content: const Text('Do you really want to close the app?'), + actions: [ + TextButton( + onPressed: () { + Navigator.of(context).pop(false); + }, + child: const Text( + 'No', + style: TextStyle( + color: Color(0xff1B243D), + ), + ), + ), + TextButton( + onPressed: () { + SystemNavigator.pop(); + Navigator.pop(context); + }, + child: const Text( + 'Yes', + style: TextStyle( + color: Color(0xff1B243D), + ), + ), + ) + ], + ); + }); + return exitApp ?? false; + } + Widget ActiveCallsTab() { return Obx(() { WidgetsBinding.instance.addPostFrameCallback((_) { diff --git a/lib/view/Sidemenu/TermsAndCondition.dart b/lib/view/Sidemenu/TermsAndCondition.dart index 9d980d2..71d2591 100644 --- a/lib/view/Sidemenu/TermsAndCondition.dart +++ b/lib/view/Sidemenu/TermsAndCondition.dart @@ -1,4 +1,5 @@ import 'package:flutter/material.dart'; +import 'package:flutter_html/flutter_html.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:get/get.dart'; import 'package:traderscircuit/Utils/Common/CommonAppbar.dart'; @@ -61,6 +62,7 @@ class _TermsAndConditionsState extends State { SizedBox( height: 10.h, ), + text16W400( termsAndConditionModel.data!.content!, ), diff --git a/lib/view/login/AddDetails.dart b/lib/view/login/AddDetails.dart index 2c6df97..2231002 100644 --- a/lib/view/login/AddDetails.dart +++ b/lib/view/login/AddDetails.dart @@ -1,6 +1,7 @@ import 'dart:ui'; import 'package:flutter/material.dart'; +import 'package:flutter/services.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:get/get.dart'; import 'package:shared_preferences/shared_preferences.dart'; @@ -112,158 +113,202 @@ class _AddDetailsState extends State { @override Widget build(BuildContext context) { - return Scaffold( - appBar: CommonAppbar(titleTxt: "Add Details"), - backgroundColor: Colors.black, - extendBody: true, - body: Stack( - children: [ - CommonBlurLeft(), - CommonBlurRight(), - Stack( - children: [ - Padding( - padding: EdgeInsets.symmetric(horizontal: 16, vertical: 16), - child: Form( - key: _adddetailsform, - child: ListView( - physics: BouncingScrollPhysics(), - // mainAxisAlignment: MainAxisAlignment.start, - // crossAxisAlignment: CrossAxisAlignment.start, + return WillPopScope( + onWillPop: () async { + _onBackButtonPressed(context); + return true; // Return true to allow the pop action + }, + child: Scaffold( + appBar: CommonAppbar(titleTxt: "Add Details"), + backgroundColor: Colors.black, + extendBody: true, + body: Stack( + children: [ + CommonBlurLeft(), + CommonBlurRight(), + Stack( + children: [ + Padding( + padding: EdgeInsets.symmetric(horizontal: 16, vertical: 16), + child: Form( + key: _adddetailsform, + child: ListView( + physics: BouncingScrollPhysics(), + // mainAxisAlignment: MainAxisAlignment.start, + // crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Row( - children: [ - text18W400("Full Name"), - ], - ), - SizedBox( - height: 15.h, - ), - CustomTextFormField( - textEditingController: fullName, - ), - SizedBox( - height: 30.h, - ), - Row( - children: [ - text18W400("Email Address"), - ], - ), - SizedBox( - height: 15.h, - ), - CustomTextFormField( - textEditingController: email, - texttype: TextInputType.emailAddress, - ), - SizedBox( - height: 30.h, - ), - Row( - children: [ - text18W400("Phone Number"), - ], - ), - SizedBox( - height: 15.h, - ), - CustomTextFormField( - textEditingController: phone, - texttype: TextInputType.phone, - ), - SizedBox( - height: 30.h, - ), - Row( - children: [ - text18W400("Date Of Birth"), - ], - ), - SizedBox( - height: 15.h, - ), - CustomTextFormField( - textEditingController: dobcontroller, - suffixIcon: Icon( - Icons.calendar_month_outlined, - color: Colors.white, + children: [ + Row( + children: [ + text18W400("Full Name"), + ], ), - readonly: true, - onTap: () { - _selectDate(context); - }, - ), - SizedBox( - height: 30.h, - ), - Row( - children: [ - text18W400("City"), - ], - ), - SizedBox( - height: 15.h, - ), - CustomTextFormField( - textEditingController: city, - ), - SizedBox( - height: 40.h, - ), - Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Row( - children: [ - Image.asset( - "assets/images/png/whatsapp.png", - height: 34.h, - width: 34.w, - ), - SizedBox( - width: 10.w, - ), - text18W600("Get Updates on WhatsApp"), - ], + SizedBox( + height: 15.h, + ), + CustomTextFormField( + textEditingController: fullName, + ), + SizedBox( + height: 30.h, + ), + Row( + children: [ + text18W400("Email Address"), + ], + ), + SizedBox( + height: 15.h, + ), + CustomTextFormField( + textEditingController: email, + texttype: TextInputType.emailAddress, + ), + SizedBox( + height: 30.h, + ), + Row( + children: [ + text18W400("Phone Number"), + ], + ), + SizedBox( + height: 15.h, + ), + CustomTextFormField( + textEditingController: phone, + texttype: TextInputType.phone, + ), + SizedBox( + height: 30.h, + ), + Row( + children: [ + text18W400("Date Of Birth"), + ], + ), + SizedBox( + height: 15.h, + ), + CustomTextFormField( + textEditingController: dobcontroller, + suffixIcon: Icon( + Icons.calendar_month_outlined, + color: Colors.white, ), - Row( - mainAxisAlignment: MainAxisAlignment.end, - children: [ - Switch( - value: isSwitched, - onChanged: _toggleSwitch, - activeTrackColor: Colors.green, - activeColor: Colors.white, - inactiveTrackColor: Colors.white, - inactiveThumbColor: Colors.black, - ), - ], - ), - ], - ), - SizedBox( - height: 70.h, - ), - CommonBtn( - text: "Next", - onTap: () { - _addDetails(); - // Get.toNamed(RouteName.kyc); - }, - ), - SizedBox( - height: 10.h, - ), - ], + readonly: true, + onTap: () { + _selectDate(context); + }, + ), + SizedBox( + height: 30.h, + ), + Row( + children: [ + text18W400("City"), + ], + ), + SizedBox( + height: 15.h, + ), + CustomTextFormField( + textEditingController: city, + ), + SizedBox( + height: 40.h, + ), + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Row( + children: [ + Image.asset( + "assets/images/png/whatsapp.png", + height: 34.h, + width: 34.w, + ), + SizedBox( + width: 10.w, + ), + text18W600("Get Updates on WhatsApp"), + ], + ), + Row( + mainAxisAlignment: MainAxisAlignment.end, + children: [ + Switch( + value: isSwitched, + onChanged: _toggleSwitch, + activeTrackColor: Colors.green, + activeColor: Colors.white, + inactiveTrackColor: Colors.white, + inactiveThumbColor: Colors.black, + ), + ], + ), + ], + ), + SizedBox( + height: 70.h, + ), + CommonBtn( + text: "Next", + onTap: () { + _addDetails(); + // Get.toNamed(RouteName.kyc); + }, + ), + SizedBox( + height: 10.h, + ), + ], + ), ), ), - ), - ], - ), - ], + ], + ), + ], + ), ), ); } + + Future _onBackButtonPressed(BuildContext context) async { + bool? exitApp = await showDialog( + context: context, + builder: (context) { + return AlertDialog( + backgroundColor: const Color(0xFFFFF3E4), + title: const Text('Exit App'), + content: const Text('Do you really want to close the app?'), + actions: [ + TextButton( + onPressed: () { + Navigator.of(context).pop(false); + }, + child: const Text( + 'No', + style: TextStyle( + color: Color(0xff1B243D), + ), + ), + ), + TextButton( + onPressed: () { + SystemNavigator.pop(); + Navigator.pop(context); + }, + child: const Text( + 'Yes', + style: TextStyle( + color: Color(0xff1B243D), + ), + ), + ) + ], + ); + }); + return exitApp ?? false; + } } diff --git a/lib/view/login/Kyc.dart b/lib/view/login/Kyc.dart index 0679021..ac6b5e7 100644 --- a/lib/view/login/Kyc.dart +++ b/lib/view/login/Kyc.dart @@ -3,6 +3,7 @@ import 'dart:ui'; import 'package:dio/dio.dart'; import 'package:flutter/material.dart'; +import 'package:flutter/services.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:flutter_svg/flutter_svg.dart'; import 'package:get/get.dart' hide MultipartFile, FormData; @@ -95,465 +96,526 @@ class _KycState extends State { @override Widget build(BuildContext context) { return Obx( - () => Scaffold( - appBar: CommonAppbar( - titleTxt: "KYC", - customActionWidget: text16W400(""), - ), - backgroundColor: Colors.black, - extendBody: true, - body: Stack( - children: [ - const CommonBlurLeft(), - const CommonBlurRight(), - Stack( - children: [ - Padding( - padding: - const EdgeInsets.symmetric(horizontal: 16, vertical: 16), - child: Form( - key: _addkycform, - child: ListView( - physics: const BouncingScrollPhysics(), - children: [ - Row( - children: [ - text18W500("Step 1 : Personal Information"), - ], - ), - SizedBox( - height: 30.h, - ), - Row( - children: [ - text18W400("Upload pan card image"), - ], - ), - SizedBox( - height: 15.h, - ), - Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - InkWell( - onTap: () { - if (kycController.panFrontImage.isEmpty) { - Get.toNamed(RouteName.kycImage, arguments: { - "type": "pan front", - }); - } - }, - child: GlassmorphicContainer( - width: 170.w, - height: 105.h, - borderRadius: 8, - linearGradient: LinearGradient( + () => WillPopScope( + onWillPop: () async { + _onBackButtonPressed(context); + return true; // Return true to allow the pop action + }, + child: Scaffold( + appBar: CommonAppbar( + titleTxt: "KYC", + customActionWidget: text16W400(""), + ), + backgroundColor: Colors.black, + extendBody: true, + body: Stack( + children: [ + const CommonBlurLeft(), + const CommonBlurRight(), + Stack( + children: [ + Padding( + padding: const EdgeInsets.symmetric( + horizontal: 16, vertical: 16), + child: Form( + key: _addkycform, + child: ListView( + physics: const BouncingScrollPhysics(), + children: [ + Row( + children: [ + text18W500("Step 1 : Personal Information"), + ], + ), + SizedBox( + height: 30.h, + ), + Row( + children: [ + text18W400("Upload pan card image"), + ], + ), + SizedBox( + height: 15.h, + ), + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + InkWell( + onTap: () { + if (kycController.panFrontImage.isEmpty) { + Get.toNamed(RouteName.kycImage, arguments: { + "type": "pan front", + }); + } + }, + child: GlassmorphicContainer( + width: 170.w, + height: 105.h, + borderRadius: 8, + linearGradient: LinearGradient( + begin: Alignment.topLeft, + end: Alignment.bottomRight, + colors: [ + const Color(0xFFffffff) + .withOpacity(0.1), + const Color(0xFFFFFFFF) + .withOpacity(0.05), + ], + stops: const [ + 0.1, + 1, + ]), + border: 0.8, + blur: 10, + borderGradient: LinearGradient( begin: Alignment.topLeft, end: Alignment.bottomRight, colors: [ - const Color(0xFFffffff).withOpacity(0.1), - const Color(0xFFFFFFFF).withOpacity(0.05), + const Color(0xff9A0000).withOpacity(0.5), + const Color(0xFFffffff).withOpacity(0.5), ], - stops: const [ - 0.1, - 1, - ]), - border: 0.8, - blur: 10, - borderGradient: LinearGradient( - begin: Alignment.topLeft, - end: Alignment.bottomRight, - colors: [ - const Color(0xff9A0000).withOpacity(0.5), - const Color(0xFFffffff).withOpacity(0.5), - ], - ), - child: (kycController.panFrontImage.isNotEmpty) - ? Stack( - children: [ - Padding( - padding: const EdgeInsets.symmetric( - vertical: 20, horizontal: 40), - child: Image( - image: FileImage( - File( + ), + child: (kycController + .panFrontImage.isNotEmpty) + ? Stack( + children: [ + Padding( + padding: + const EdgeInsets.symmetric( + vertical: 20, + horizontal: 40), + child: Image( + image: FileImage( + File( + kycController + .panFrontImage.value, + ), + ), + fit: BoxFit.cover, + width: Get.width, + height: 50.h, + ), + ), + Positioned( + top: 6, + right: 10, + child: InkWell( + onTap: () { kycController - .panFrontImage.value, + .panFrontImage.value = ""; + }, + child: SvgPicture.asset( + "assets/images/svg/cancel.svg", + width: 18, + height: 18, ), ), - fit: BoxFit.cover, - width: Get.width, - height: 50.h, - ), - ), - Positioned( - top: 6, - right: 10, - child: InkWell( - onTap: () { - kycController - .panFrontImage.value = ""; - }, - child: SvgPicture.asset( - "assets/images/svg/cancel.svg", - width: 18, - height: 18, - ), - ), - ) - ], - ) - : Center( - child: Column( - mainAxisAlignment: - MainAxisAlignment.center, - children: [ - const Icon( - Icons.file_upload_outlined, - size: 42, - color: Colors.white, - ), - SizedBox( - height: 10.h, - ), - text14W400("Front Side") + ) ], + ) + : Center( + child: Column( + mainAxisAlignment: + MainAxisAlignment.center, + children: [ + const Icon( + Icons.file_upload_outlined, + size: 42, + color: Colors.white, + ), + SizedBox( + height: 10.h, + ), + text14W400("Front Side") + ], + ), ), - ), + ), ), - ), - InkWell( - onTap: () { - if (kycController.panBackImage.isEmpty) { - Get.toNamed(RouteName.kycImage, arguments: { - "type": "pan back", - }); - } - }, - child: GlassmorphicContainer( - width: 170.w, - height: 105.h, - borderRadius: 8, - linearGradient: LinearGradient( + InkWell( + onTap: () { + if (kycController.panBackImage.isEmpty) { + Get.toNamed(RouteName.kycImage, arguments: { + "type": "pan back", + }); + } + }, + child: GlassmorphicContainer( + width: 170.w, + height: 105.h, + borderRadius: 8, + linearGradient: LinearGradient( + begin: Alignment.topLeft, + end: Alignment.bottomRight, + colors: [ + const Color(0xFFffffff) + .withOpacity(0.1), + const Color(0xFFFFFFFF) + .withOpacity(0.05), + ], + stops: const [ + 0.1, + 1, + ]), + border: 0.8, + blur: 10, + borderGradient: LinearGradient( begin: Alignment.topLeft, end: Alignment.bottomRight, colors: [ - const Color(0xFFffffff).withOpacity(0.1), - const Color(0xFFFFFFFF).withOpacity(0.05), + const Color(0xff9A0000).withOpacity(0.5), + const Color(0xFFffffff).withOpacity(0.5), ], - stops: const [ - 0.1, - 1, - ]), - border: 0.8, - blur: 10, - borderGradient: LinearGradient( - begin: Alignment.topLeft, - end: Alignment.bottomRight, - colors: [ - const Color(0xff9A0000).withOpacity(0.5), - const Color(0xFFffffff).withOpacity(0.5), - ], - ), - child: (kycController.panBackImage.isNotEmpty) - ? Stack( - children: [ - Padding( - padding: const EdgeInsets.symmetric( - vertical: 20, horizontal: 40), - child: Image( - image: FileImage( - File( + ), + child: (kycController.panBackImage.isNotEmpty) + ? Stack( + children: [ + Padding( + padding: + const EdgeInsets.symmetric( + vertical: 20, + horizontal: 40), + child: Image( + image: FileImage( + File( + kycController + .panBackImage.value, + ), + ), + fit: BoxFit.cover, + width: Get.width, + height: 50.h, + ), + ), + Positioned( + top: 6, + right: 10, + child: InkWell( + onTap: () { kycController - .panBackImage.value, + .panBackImage.value = ""; + }, + child: SvgPicture.asset( + "assets/images/svg/cancel.svg", + width: 18, + height: 18, ), ), - fit: BoxFit.cover, - width: Get.width, - height: 50.h, - ), - ), - Positioned( - top: 6, - right: 10, - child: InkWell( - onTap: () { - kycController - .panBackImage.value = ""; - }, - child: SvgPicture.asset( - "assets/images/svg/cancel.svg", - width: 18, - height: 18, - ), - ), - ) - ], - ) - : Center( - child: Column( - mainAxisAlignment: - MainAxisAlignment.center, - children: [ - const Icon( - Icons.file_upload_outlined, - size: 42, - color: Colors.white, - ), - SizedBox( - height: 10.h, - ), - text14W400("Back Side") + ) ], + ) + : Center( + child: Column( + mainAxisAlignment: + MainAxisAlignment.center, + children: [ + const Icon( + Icons.file_upload_outlined, + size: 42, + color: Colors.white, + ), + SizedBox( + height: 10.h, + ), + text14W400("Back Side") + ], + ), ), - ), - ), - ) - ], - ), - SizedBox( - height: 30.h, - ), - Row( - children: [ - text18W400("Pan Card"), - ], - ), - SizedBox( - height: 15.h, - ), - CustomTextFormField( - textEditingController: pannumber, - ), - SizedBox( - height: 15.h, - ), - Row( - children: [ - text18W400("Aadhar Number"), - ], - ), - SizedBox( - height: 15.h, - ), - CustomTextFormField( - textEditingController: aadhaarnumber, - texttype: TextInputType.phone, - ), - SizedBox( - height: 30.h, - ), - Row( - children: [ - text18W400("Upload Aadhar card image"), - ], - ), - SizedBox( - height: 15.h, - ), - Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - InkWell( - onTap: () { - if (kycController.aadharFrontImage.isEmpty) { - Get.toNamed(RouteName.kycImage, arguments: { - "type": "aadhar front", - }); - } - }, - child: GlassmorphicContainer( - width: 170.w, - height: 105.h, - borderRadius: 8, - linearGradient: LinearGradient( + ), + ) + ], + ), + SizedBox( + height: 30.h, + ), + Row( + children: [ + text18W400("Pan Card"), + ], + ), + SizedBox( + height: 15.h, + ), + CustomTextFormField( + textEditingController: pannumber, + ), + SizedBox( + height: 15.h, + ), + Row( + children: [ + text18W400("Aadhar Number"), + ], + ), + SizedBox( + height: 15.h, + ), + CustomTextFormField( + textEditingController: aadhaarnumber, + texttype: TextInputType.phone, + ), + SizedBox( + height: 30.h, + ), + Row( + children: [ + text18W400("Upload Aadhar card image"), + ], + ), + SizedBox( + height: 15.h, + ), + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + InkWell( + onTap: () { + if (kycController.aadharFrontImage.isEmpty) { + Get.toNamed(RouteName.kycImage, arguments: { + "type": "aadhar front", + }); + } + }, + child: GlassmorphicContainer( + width: 170.w, + height: 105.h, + borderRadius: 8, + linearGradient: LinearGradient( + begin: Alignment.topLeft, + end: Alignment.bottomRight, + colors: [ + const Color(0xFFffffff) + .withOpacity(0.1), + const Color(0xFFFFFFFF) + .withOpacity(0.05), + ], + stops: const [ + 0.1, + 1, + ]), + border: 0.8, + blur: 10, + borderGradient: LinearGradient( begin: Alignment.topLeft, end: Alignment.bottomRight, colors: [ - const Color(0xFFffffff).withOpacity(0.1), - const Color(0xFFFFFFFF).withOpacity(0.05), + const Color(0xff9A0000).withOpacity(0.5), + const Color(0xFFffffff).withOpacity(0.5), ], - stops: const [ - 0.1, - 1, - ]), - border: 0.8, - blur: 10, - borderGradient: LinearGradient( - begin: Alignment.topLeft, - end: Alignment.bottomRight, - colors: [ - const Color(0xff9A0000).withOpacity(0.5), - const Color(0xFFffffff).withOpacity(0.5), - ], - ), - child: (kycController - .aadharFrontImage.isNotEmpty) - ? Stack( - children: [ - Padding( - padding: const EdgeInsets.symmetric( - vertical: 20, horizontal: 40), - child: Image( - image: FileImage( - File( - kycController - .aadharFrontImage.value, + ), + child: (kycController + .aadharFrontImage.isNotEmpty) + ? Stack( + children: [ + Padding( + padding: + const EdgeInsets.symmetric( + vertical: 20, + horizontal: 40), + child: Image( + image: FileImage( + File( + kycController + .aadharFrontImage.value, + ), + ), + fit: BoxFit.cover, + width: Get.width, + height: 50.h, + ), + ), + Positioned( + top: 6, + right: 10, + child: InkWell( + onTap: () { + kycController.aadharFrontImage + .value = ""; + }, + child: SvgPicture.asset( + "assets/images/svg/cancel.svg", + width: 18, + height: 18, ), ), - fit: BoxFit.cover, - width: Get.width, - height: 50.h, - ), - ), - Positioned( - top: 6, - right: 10, - child: InkWell( - onTap: () { - kycController.aadharFrontImage - .value = ""; - }, - child: SvgPicture.asset( - "assets/images/svg/cancel.svg", - width: 18, - height: 18, - ), - ), - ) - ], - ) - : Center( - child: Column( - mainAxisAlignment: - MainAxisAlignment.center, - children: [ - const Icon( - Icons.file_upload_outlined, - size: 42, - color: Colors.white, - ), - SizedBox( - height: 10.h, - ), - text14W400("Front Side") + ) ], + ) + : Center( + child: Column( + mainAxisAlignment: + MainAxisAlignment.center, + children: [ + const Icon( + Icons.file_upload_outlined, + size: 42, + color: Colors.white, + ), + SizedBox( + height: 10.h, + ), + text14W400("Front Side") + ], + ), ), - ), + ), ), - ), - InkWell( - onTap: () { - if (kycController.aadharBackImage.isEmpty) { - Get.toNamed(RouteName.kycImage, arguments: { - "type": "aadhar back", - }); - } - }, - child: GlassmorphicContainer( - width: 170.w, - height: 105.h, - borderRadius: 8, - linearGradient: LinearGradient( + InkWell( + onTap: () { + if (kycController.aadharBackImage.isEmpty) { + Get.toNamed(RouteName.kycImage, arguments: { + "type": "aadhar back", + }); + } + }, + child: GlassmorphicContainer( + width: 170.w, + height: 105.h, + borderRadius: 8, + linearGradient: LinearGradient( + begin: Alignment.topLeft, + end: Alignment.bottomRight, + colors: [ + const Color(0xFFffffff) + .withOpacity(0.1), + const Color(0xFFFFFFFF) + .withOpacity(0.05), + ], + stops: const [ + 0.1, + 1, + ]), + border: 0.8, + blur: 10, + borderGradient: LinearGradient( begin: Alignment.topLeft, end: Alignment.bottomRight, colors: [ - const Color(0xFFffffff).withOpacity(0.1), - const Color(0xFFFFFFFF).withOpacity(0.05), + const Color(0xff9A0000).withOpacity(0.5), + const Color(0xFFffffff).withOpacity(0.5), ], - stops: const [ - 0.1, - 1, - ]), - border: 0.8, - blur: 10, - borderGradient: LinearGradient( - begin: Alignment.topLeft, - end: Alignment.bottomRight, - colors: [ - const Color(0xff9A0000).withOpacity(0.5), - const Color(0xFFffffff).withOpacity(0.5), - ], - ), - child: (kycController - .aadharBackImage.isNotEmpty) - ? Stack( - children: [ - Padding( - padding: const EdgeInsets.symmetric( - vertical: 20, horizontal: 40), - child: Image( - image: FileImage( - File( - kycController - .aadharBackImage.value, + ), + child: (kycController + .aadharBackImage.isNotEmpty) + ? Stack( + children: [ + Padding( + padding: + const EdgeInsets.symmetric( + vertical: 20, + horizontal: 40), + child: Image( + image: FileImage( + File( + kycController + .aadharBackImage.value, + ), + ), + fit: BoxFit.cover, + width: Get.width, + height: 50.h, + ), + ), + Positioned( + top: 6, + right: 10, + child: InkWell( + onTap: () { + kycController.aadharBackImage + .value = ""; + }, + child: SvgPicture.asset( + "assets/images/svg/cancel.svg", + width: 18, + height: 18, ), ), - fit: BoxFit.cover, - width: Get.width, - height: 50.h, - ), - ), - Positioned( - top: 6, - right: 10, - child: InkWell( - onTap: () { - kycController - .aadharBackImage.value = ""; - }, - child: SvgPicture.asset( - "assets/images/svg/cancel.svg", - width: 18, - height: 18, - ), - ), - ) - ], - ) - : Center( - child: Column( - mainAxisAlignment: - MainAxisAlignment.center, - children: [ - const Icon( - Icons.file_upload_outlined, - size: 42, - color: Colors.white, - ), - SizedBox( - height: 10.h, - ), - text14W400("Back Side") + ) ], + ) + : Center( + child: Column( + mainAxisAlignment: + MainAxisAlignment.center, + children: [ + const Icon( + Icons.file_upload_outlined, + size: 42, + color: Colors.white, + ), + SizedBox( + height: 10.h, + ), + text14W400("Back Side") + ], + ), ), - ), - ), - ) - ], - ), - SizedBox( - height: 70.h, - ), - CommonBtn( - text: "Next", - onTap: () { - _addKyc(); - // Get.toNamed(RouteName.updateriskprofile); - }, - ), - SizedBox( - height: 10.h, - ), - ], + ), + ) + ], + ), + SizedBox( + height: 70.h, + ), + CommonBtn( + text: "Next", + onTap: () { + _addKyc(); + // Get.toNamed(RouteName.updateriskprofile); + }, + ), + SizedBox( + height: 10.h, + ), + ], + ), ), ), - ), - ], - ), - ], + ], + ), + ], + ), ), ), ); } + + Future _onBackButtonPressed(BuildContext context) async { + bool? exitApp = await showDialog( + context: context, + builder: (context) { + return AlertDialog( + backgroundColor: const Color(0xFFFFF3E4), + title: const Text('Exit App'), + content: const Text('Do you really want to close the app?'), + actions: [ + TextButton( + onPressed: () { + Navigator.of(context).pop(false); + }, + child: const Text( + 'No', + style: TextStyle( + color: Color(0xff1B243D), + ), + ), + ), + TextButton( + onPressed: () { + SystemNavigator.pop(); + Navigator.pop(context); + }, + child: const Text( + 'Yes', + style: TextStyle( + color: Color(0xff1B243D), + ), + ), + ) + ], + ); + }); + return exitApp ?? false; + } } diff --git a/lib/view/login/LoginScreen.dart b/lib/view/login/LoginScreen.dart index 7345b86..e0cfb95 100644 --- a/lib/view/login/LoginScreen.dart +++ b/lib/view/login/LoginScreen.dart @@ -33,347 +33,390 @@ class _LoginScreenState extends State { @override Widget build(BuildContext context) { - return Scaffold( - backgroundColor: Colors.black, - extendBody: true, - body: Stack( - children: [ - const CommonBlurLeft(), - const CommonBlurRight(), - Stack( - children: [ - Padding( - padding: - const EdgeInsets.symmetric(horizontal: 16, vertical: 16), - child: Form( - key: _sendotpform, - child: ListView( - physics: const BouncingScrollPhysics(), - // mainAxisAlignment: MainAxisAlignment.start, - // crossAxisAlignment: CrossAxisAlignment.start, - children: [ - SizedBox( - height: 20.h, - ), - const Row( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Text( - "Traders Circuit", - style: TextStyle( - fontFamily: 'hiragino', - color: Colors.white, - fontSize: 25, - fontWeight: FontWeight.w600), - ), - ], - ), - SizedBox( - height: 42.h, - ), - const Text( - "Lets get started ", - style: TextStyle( - fontFamily: 'hiragino', - color: Colors.white, - fontSize: 24, - fontWeight: FontWeight.w700), - ), - SizedBox( - height: 10.h, - ), - text18W800("Enter your mobile number to get otp"), - SizedBox( - height: 35.h, - ), - Row( - children: [ - Expanded( - child: GlassmorphicContainer( - width: 60, - height: 50, - borderRadius: 8, - blur: 10, - alignment: Alignment.center, - border: 0.8, - linearGradient: LinearGradient( + return WillPopScope( + onWillPop: () async { + _onBackButtonPressed(context); + return true; // Return true to allow the pop action + }, + child: Scaffold( + backgroundColor: Colors.black, + extendBody: true, + body: Stack( + children: [ + const CommonBlurLeft(), + const CommonBlurRight(), + Stack( + children: [ + Padding( + padding: + const EdgeInsets.symmetric(horizontal: 16, vertical: 16), + child: Form( + key: _sendotpform, + child: ListView( + physics: const BouncingScrollPhysics(), + // mainAxisAlignment: MainAxisAlignment.start, + // crossAxisAlignment: CrossAxisAlignment.start, + children: [ + SizedBox( + height: 20.h, + ), + const Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Text( + "Traders Circuit", + style: TextStyle( + fontFamily: 'hiragino', + color: Colors.white, + fontSize: 25, + fontWeight: FontWeight.w600), + ), + ], + ), + SizedBox( + height: 42.h, + ), + const Text( + "Lets get started ", + style: TextStyle( + fontFamily: 'hiragino', + color: Colors.white, + fontSize: 24, + fontWeight: FontWeight.w700), + ), + SizedBox( + height: 10.h, + ), + text18W800("Enter your mobile number to get otp"), + SizedBox( + height: 35.h, + ), + Row( + children: [ + Expanded( + child: GlassmorphicContainer( + width: 60, + height: 50, + borderRadius: 8, + blur: 10, + alignment: Alignment.center, + border: 0.8, + linearGradient: LinearGradient( + begin: Alignment.topLeft, + end: Alignment.bottomRight, + colors: [ + Colors.white.withOpacity(0.1), + const Color(0xFFFFFFFF).withOpacity(0.05), + ], + stops: const [ + 0.1, + 1, + ]), + borderGradient: LinearGradient( begin: Alignment.topLeft, end: Alignment.bottomRight, colors: [ - Colors.white.withOpacity(0.1), - const Color(0xFFFFFFFF).withOpacity(0.05), + const Color(0xff9A0000).withOpacity(0.5), + const Color(0xFFffffff).withOpacity(0.5), ], - stops: const [ - 0.1, - 1, - ]), - borderGradient: LinearGradient( - begin: Alignment.topLeft, - end: Alignment.bottomRight, - colors: [ - const Color(0xff9A0000).withOpacity(0.5), - const Color(0xFFffffff).withOpacity(0.5), - ], - ), - child: Row( - crossAxisAlignment: CrossAxisAlignment.center, - mainAxisAlignment: MainAxisAlignment.center, - children: [ - // SvgPicture.asset("assets/images/svg/india.svg"), - Image.asset( - "assets/images/png/india.png", - height: 25.h, - width: 25.h, - ), - const SizedBox( - width: 2, - ), - const Text( - "+91", - style: TextStyle( - fontFamily: 'hiragino', - fontSize: 15, - color: Colors.white, + ), + child: Row( + crossAxisAlignment: CrossAxisAlignment.center, + mainAxisAlignment: MainAxisAlignment.center, + children: [ + // SvgPicture.asset("assets/images/svg/india.svg"), + Image.asset( + "assets/images/png/india.png", + height: 25.h, + width: 25.h, ), - ) - ], + const SizedBox( + width: 2, + ), + const Text( + "+91", + style: TextStyle( + fontFamily: 'hiragino', + fontSize: 15, + color: Colors.white, + ), + ) + ], + ), ), ), - ), - const SizedBox( - width: 10, - ), - SizedBox( - width: 285.w, - child: CustomTextFormField( - texttype: TextInputType.phone, - textEditingController: phonecontroller, - // validator: (value) { - // if (value.isEmpty) { - // return 'Enter your phone number'; - // } else if (!RegExp(r'(^(?:[+0]9)?[0-9]{10}$)') - // .hasMatch(value)) { - // return 'Enter a valid phone number'; - // } else if (!isValidPhoneNumber(value)) { - // return 'Phone number cannot contain 10 zeros'; - // } - // return null; - // }, - inputFormatters: [ - LengthLimitingTextInputFormatter(10), - FilteringTextInputFormatter.allow( - RegExp('[0-9]')), + const SizedBox( + width: 10, + ), + SizedBox( + width: 285.w, + child: CustomTextFormField( + texttype: TextInputType.phone, + textEditingController: phonecontroller, + // validator: (value) { + // if (value.isEmpty) { + // return 'Enter your phone number'; + // } else if (!RegExp(r'(^(?:[+0]9)?[0-9]{10}$)') + // .hasMatch(value)) { + // return 'Enter a valid phone number'; + // } else if (!isValidPhoneNumber(value)) { + // return 'Phone number cannot contain 10 zeros'; + // } + // return null; + // }, + inputFormatters: [ + LengthLimitingTextInputFormatter(10), + FilteringTextInputFormatter.allow( + RegExp('[0-9]')), + ], + ), + ) + ], + ), + const SizedBox( + height: 10, + ), + text14W300( + "We’ll send six digit code to the registered number. Standard data rates may apply"), + SizedBox( + height: 65.h, + ), + CommonBtn( + text: "Login/Signup", + onTap: () async { + final isValid = + _sendotpform.currentState?.validate(); + if (isValid!) { + utils.loader(); + FocusManager.instance.primaryFocus?.unfocus(); + + Map myLoginData = { + "mobile_number": phonecontroller.text, + }; + + var resp = + await SendOtpAPI(myLoginData).sendOtpApi(); + print(resp.status); + print('Api msg : ${resp.message}'); + + if (resp.status == ResponseStatus.SUCCESS) { + Get.back(); + print("api response is ${resp.data}"); + Utils.showToast("OTP sent successfully"); + + Map res = resp.data; + print(res); + + Get.toNamed(RouteName.verifyotp, arguments: { + "phonenumber": phonecontroller.text + }); + } else { + Get.back(); + Utils.showToast(resp.message); + print('Api msg : ${resp.message}'); + } + } else { + Get.snackbar( + "Error", "Please Enter Login Credentials", + margin: EdgeInsets.all(8), + snackStyle: SnackStyle.FLOATING, + snackPosition: SnackPosition.BOTTOM); + } + }), + SizedBox( + height: 10.h, + ), + text14W300( + "By continuing, you agree to our Terms & Conditions"), + SizedBox( + height: 45.h, + ), + Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Container( + height: 0.2.h, + width: 108.w, + color: Colors.white, + ), + SizedBox( + width: 22.w, + ), + text18W600("OR"), + SizedBox( + width: 22.w, + ), + Container( + height: 0.2.h, + width: 108.w, + color: Colors.white, + ), + ], + ), + SizedBox( + height: 40.h, + ), + GlassmorphicContainer( + width: double.infinity, + height: 55.h, + borderRadius: 8, + linearGradient: LinearGradient( + begin: Alignment.topLeft, + end: Alignment.bottomRight, + colors: [ + const Color(0xFFffffff).withOpacity(0.1), + const Color(0xFFFFFFFF).withOpacity(0.05), + ], + stops: const [ + 0.1, + 1, + ]), + border: 0.3, + blur: 10, + borderGradient: LinearGradient( + begin: Alignment.topLeft, + end: Alignment.bottomRight, + colors: [ + const Color(0xFFAF2E89).withOpacity(0.2), + const Color(0xFFA23E31).withOpacity(0.2), + const Color(0xFF0000).withOpacity(0.2), + ], + stops: const [ + 0.3, + 0.6, + 1, + ]), + child: Center( + child: Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Image.asset( + "assets/images/png/apple.png", + height: 30.h, + width: 30.w, + ), + SizedBox( + width: 7.h, + ), + text16W400("Continue with apple"), ], ), - ) - ], - ), - const SizedBox( - height: 10, - ), - text14W300( - "We’ll send six digit code to the registered number. Standard data rates may apply"), - SizedBox( - height: 65.h, - ), - CommonBtn( - text: "Login/Signup", - onTap: () async { - final isValid = - _sendotpform.currentState?.validate(); - if (isValid!) { - utils.loader(); - FocusManager.instance.primaryFocus?.unfocus(); - - Map myLoginData = { - "mobile_number": phonecontroller.text, - }; - - var resp = - await SendOtpAPI(myLoginData).sendOtpApi(); - print(resp.status); - print('Api msg : ${resp.message}'); - - if (resp.status == ResponseStatus.SUCCESS) { - Get.back(); - print("api response is ${resp.data}"); - Utils.showToast("OTP sent successfully"); - - Map res = resp.data; - print(res); - - Get.toNamed(RouteName.verifyotp, arguments: { - "phonenumber": phonecontroller.text - }); - } else { - Get.back(); - Utils.showToast(resp.message); - print('Api msg : ${resp.message}'); - } - } else { - Get.snackbar( - "Error", "Please Enter Login Credentials", - margin: EdgeInsets.all(8), - snackStyle: SnackStyle.FLOATING, - snackPosition: SnackPosition.BOTTOM); - } - }), - SizedBox( - height: 10.h, - ), - text14W300( - "By continuing, you agree to our Terms & Conditions"), - SizedBox( - height: 45.h, - ), - Row( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Container( - height: 0.2.h, - width: 108.w, - color: Colors.white, - ), - SizedBox( - width: 22.w, - ), - text18W600("OR"), - SizedBox( - width: 22.w, - ), - Container( - height: 0.2.h, - width: 108.w, - color: Colors.white, - ), - ], - ), - SizedBox( - height: 40.h, - ), - GlassmorphicContainer( - width: double.infinity, - height: 55.h, - borderRadius: 8, - linearGradient: LinearGradient( - begin: Alignment.topLeft, - end: Alignment.bottomRight, - colors: [ - const Color(0xFFffffff).withOpacity(0.1), - const Color(0xFFFFFFFF).withOpacity(0.05), - ], - stops: const [ - 0.1, - 1, - ]), - border: 0.3, - blur: 10, - borderGradient: LinearGradient( - begin: Alignment.topLeft, - end: Alignment.bottomRight, - colors: [ - const Color(0xFFAF2E89).withOpacity(0.2), - const Color(0xFFA23E31).withOpacity(0.2), - const Color(0xFF0000).withOpacity(0.2), - ], - stops: const [ - 0.3, - 0.6, - 1, - ]), - child: Center( - child: Row( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Image.asset( - "assets/images/png/apple.png", - height: 30.h, - width: 30.w, - ), - SizedBox( - width: 7.h, - ), - text16W400("Continue with apple"), - ], ), ), - ), - SizedBox( - height: 15.h, - ), - GlassmorphicContainer( - width: double.infinity, - height: 55.h, - borderRadius: 8, - linearGradient: LinearGradient( - begin: Alignment.topLeft, - end: Alignment.bottomRight, - colors: [ - const Color(0xFFffffff).withOpacity(0.1), - const Color(0xFFFFFFFF).withOpacity(0.05), - ], - stops: const [ - 0.1, - 1, - ]), - border: 0.5, - blur: 10, - borderGradient: LinearGradient( - begin: Alignment.topLeft, - end: Alignment.bottomRight, - colors: [ - const Color(0xFFAF2E89).withOpacity(0.2), - const Color(0xFFA23E31).withOpacity(0.2), - const Color(0xFF0000).withOpacity(0.2), - ], - stops: const [ - 0.3, - 0.6, - 1, - ]), - child: Center( - child: Row( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Image.asset( - "assets/images/png/google.png", - height: 30.h, - width: 30.w, - ), - SizedBox( - width: 7.h, - ), - text16W400( - "Continue with google", - ), - ], - ), + SizedBox( + height: 15.h, ), - ), - SizedBox( - height: 45.h, - ), - Row( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - InkWell( - onTap: () { - Get.toNamed(RouteName.mainscreen); - }, - child: text16W700( - "Continue as guest", + GlassmorphicContainer( + width: double.infinity, + height: 55.h, + borderRadius: 8, + linearGradient: LinearGradient( + begin: Alignment.topLeft, + end: Alignment.bottomRight, + colors: [ + const Color(0xFFffffff).withOpacity(0.1), + const Color(0xFFFFFFFF).withOpacity(0.05), + ], + stops: const [ + 0.1, + 1, + ]), + border: 0.5, + blur: 10, + borderGradient: LinearGradient( + begin: Alignment.topLeft, + end: Alignment.bottomRight, + colors: [ + const Color(0xFFAF2E89).withOpacity(0.2), + const Color(0xFFA23E31).withOpacity(0.2), + const Color(0xFF0000).withOpacity(0.2), + ], + stops: const [ + 0.3, + 0.6, + 1, + ]), + child: Center( + child: Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Image.asset( + "assets/images/png/google.png", + height: 30.h, + width: 30.w, + ), + SizedBox( + width: 7.h, + ), + text16W400( + "Continue with google", + ), + ], ), ), - ], - ) - ], + ), + SizedBox( + height: 45.h, + ), + Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + InkWell( + onTap: () { + Get.toNamed(RouteName.mainscreen); + }, + child: text16W700( + "Continue as guest", + ), + ), + ], + ) + ], + ), ), ), - ), - ], - ), - ], + ], + ), + ], + ), ), ); } -} + + Future _onBackButtonPressed(BuildContext context) async { + bool? exitApp = await showDialog( + context: context, + builder: (context) { + return AlertDialog( + backgroundColor: const Color(0xFFFFF3E4), + title: const Text('Exit App'), + content: const Text('Do you really want to close the app?'), + actions: [ + TextButton( + onPressed: () { + Navigator.of(context).pop(false); + }, + child: const Text( + 'No', + style: TextStyle( + color: Color(0xff1B243D), + ), + ), + ), + TextButton( + onPressed: () { + SystemNavigator.pop(); + Navigator.pop(context); + }, + child: const Text( + 'Yes', + style: TextStyle( + color: Color(0xff1B243D), + ), + ), + ) + ], + ); + }); + return exitApp ?? false; + }} diff --git a/lib/view/onBoarding/splashScreen.dart b/lib/view/onBoarding/splashScreen.dart index 049f6ca..0dd2054 100644 --- a/lib/view/onBoarding/splashScreen.dart +++ b/lib/view/onBoarding/splashScreen.dart @@ -138,7 +138,7 @@ class _SplashScreenState extends State "Traders Circuit", style: TextStyle( fontFamily: 'hiragino', - fontSize: 50, + fontSize: 48.sp, fontWeight: FontWeight.w600, color: Colors.white), ), diff --git a/pubspec.lock b/pubspec.lock index 2f2e831..0a94cf1 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -157,10 +157,10 @@ packages: dependency: transitive description: name: csslib - sha256: "706b5707578e0c1b4b7550f64078f0a0f19dec3f50a178ffae7006b0a9ca58fb" + sha256: "831883fb353c8bdc1d71979e5b342c7d88acfbc643113c14ae51e2442ea0f20f" url: "https://pub.dev" source: hosted - version: "1.0.0" + version: "0.17.3" cupertino_icons: dependency: "direct main" description: @@ -334,6 +334,14 @@ packages: url: "https://pub.dev" source: hosted version: "3.3.1" + flutter_html: + dependency: "direct main" + description: + name: flutter_html + sha256: "02ad69e813ecfc0728a455e4bf892b9379983e050722b1dce00192ee2e41d1ee" + url: "https://pub.dev" + source: hosted + version: "3.0.0-beta.2" flutter_isolate: dependency: transitive description: @@ -592,6 +600,14 @@ packages: url: "https://pub.dev" source: hosted version: "2.1.1" + list_counter: + dependency: transitive + description: + name: list_counter + sha256: c447ae3dfcd1c55f0152867090e67e219d42fe6d4f2807db4bbe8b8d69912237 + url: "https://pub.dev" + source: hosted + version: "1.0.2" local_auth: dependency: "direct main" description: @@ -1279,7 +1295,5 @@ packages: source: hosted version: "6.3.0" sdks: - - dart: ">=3.2.3 <4.0.0" - flutter: ">=3.16.6" - + dart: ">=3.2.0-194.0.dev <4.0.0" + flutter: ">=3.13.0" diff --git a/pubspec.yaml b/pubspec.yaml index d128e7b..6725fb9 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -47,6 +47,8 @@ dependencies: just_audio: ^0.9.37 audio_video_progress_bar: ^2.0.2 syncfusion_flutter_pdfviewer: + flutter_html: ^3.0.0-beta.2 + dev_dependencies: flutter_test: