From 3d6658e7c01cd1a21ce22a3197d09a37bcd2a41d Mon Sep 17 00:00:00 2001 From: venbaittech Date: Tue, 11 Feb 2025 17:36:57 +0530 Subject: [PATCH] chat screen issue fix --- .../UAE_Numbers/uae_numbers.dart | 6 +- .../Screens/charts/screens/chart_screen.dart | 338 ++++++++++-------- .../drawer_routes/custom_drawer_routes.dart | 38 +- 3 files changed, 230 insertions(+), 152 deletions(-) diff --git a/lib/presentation/Screens/Bottom Navigation Pages/UAE_Numbers/uae_numbers.dart b/lib/presentation/Screens/Bottom Navigation Pages/UAE_Numbers/uae_numbers.dart index 1e557238..ea0e1602 100644 --- a/lib/presentation/Screens/Bottom Navigation Pages/UAE_Numbers/uae_numbers.dart +++ b/lib/presentation/Screens/Bottom Navigation Pages/UAE_Numbers/uae_numbers.dart @@ -42,7 +42,9 @@ class UaeNumbers extends StatelessWidget { 'UAE Numbers', 'أرقام الإمارات', )), + body: uaenumberWidget(), + ), ); } @@ -117,8 +119,8 @@ class _UaenumberWidgetState extends ConsumerState { hintStyle: TextStyle(color: Color(0xFF898C81)), prefixIcon: Image.asset( MiscIconAssetPath.search, - width: 15, - height: 10, + // width: 15, + // height: 10, ), border: InputBorder.none, contentPadding: diff --git a/lib/presentation/Screens/charts/screens/chart_screen.dart b/lib/presentation/Screens/charts/screens/chart_screen.dart index db1127fd..2834dc6c 100644 --- a/lib/presentation/Screens/charts/screens/chart_screen.dart +++ b/lib/presentation/Screens/charts/screens/chart_screen.dart @@ -13,7 +13,7 @@ import 'package:uae_stat/presentation/Screens/charts/widgets/chart_widget.dart'; import 'package:uae_stat/presentation/components/indicators/locale_provider.dart'; import 'package:uae_stat/presentation/components/my_toggle.dart'; import 'package:flutter_gen/gen_l10n/app_localizations.dart'; - +import 'package:uae_stat/presentation/routes/drawer_routes/custom_drawer_routes.dart'; import 'package:uae_stat/presentation/Screens/app_tour/Target_content.dart'; import '../filters/search_filter_helper.dart'; @@ -1826,50 +1826,60 @@ class _ChartScreen1State extends ConsumerState { double mywidth = MediaQuery.of(context).size.width; final color = Color(int.parse(widget.bgColor.replaceFirst('0x', ''), radix: 16)); - return Scaffold( + return BaseScaffold( key: _scaffoldKey, - backgroundColor: color, - appBar: AppBar( - backgroundColor: color, - elevation: 0, - actions: [ - // IconButton( - // onPressed: () {}, - // icon: const Icon(Icons.toggle_off_outlined), - // ), - MyToggle( - // key: toggleKey, - isOn: locale?.languageCode == 'en', - knobTextWhenOn: 'ع', - knobTextWhenOff: 'EN', - pathColorWhenOn: Colors.grey.shade300, - pathColorWhenOff: Colors.grey.shade300, - onTap: () { - ref.read(localeProvider.notifier).toggleLocale(); - }, - ), - ], - leading: IconButton( - icon: Icon(Icons.arrow_back_ios_new, color: Colors.white), - onPressed: () { - if (widget.keyParam == 'home') { - context.go('/myhomepage'); - } else { - context.go('/uaenumbers'); - } - }, - ), - title: Text( - context.translate( - 'UAE Numbers', - 'أرقام الإمارات', - ), - style: TextStyle(color: Colors.white), - ), - ), + // backgroundColor: color, + // appBar: AppBar( + // backgroundColor: color, + // elevation: 0, + // actions: [ + // // IconButton( + // // onPressed: () {}, + // // icon: const Icon(Icons.toggle_off_outlined), + // // ), + // MyToggle( + // // key: toggleKey, + // isOn: locale?.languageCode == 'en', + // knobTextWhenOn: 'ع', + // knobTextWhenOff: 'EN', + // pathColorWhenOn: Colors.grey.shade300, + // pathColorWhenOff: Colors.grey.shade300, + // onTap: () { + // ref.read(localeProvider.notifier).toggleLocale(); + // }, + // ), + // ], + // leading: IconButton( + // icon: Icon(Icons.arrow_back_ios_new, color: Colors.white), + // onPressed: () { + // if (widget.keyParam == 'home') { + // context.go('/myhomepage'); + // } else { + // context.go('/uaenumbers'); + // } + // }, + // ), + // title: Text( + // context.translate( + // 'UAE Numbers', + // 'أرقام الإمارات', + // ), + // style: TextStyle(color: Colors.white), + // ), + // ), + title: Text(context.translate( + 'UAE Numbers', + 'أرقام الإمارات', + ),), + appbarColor: Color(int.parse(widget.bgColor)), // Example color + showBackButton: true, + colorChange:true, + navBackArrow: Text(widget.keyParam ?? 'Default Value'), body: isLoading ? Center(child: CircularProgressIndicator()) - : Column( + : Container( + color: color, + child: Column( children: [ Container( // height: myheight / 5, @@ -1877,7 +1887,7 @@ class _ChartScreen1State extends ConsumerState { color: color, child: Padding( padding: EdgeInsets.only( - left: 30, right: 30, top: 10, bottom: 5), + left: 30, right: 30, top: 8, bottom: 5), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ @@ -1886,18 +1896,23 @@ class _ChartScreen1State extends ConsumerState { style: TextStyle( color: Colors.white, fontSize: 26, + fontWeight: FontWeight.w400, + fontFamily: 'Roboto' ), ), Container( - width: mywidth / 4, + width: mywidth / 7, + height: 1.5, child: Divider( - thickness: 8, + thickness: 3, color: Colors.white, )), Text( widget.title, - style: TextStyle(color: Colors.white, fontSize: 20), - ), + style: TextStyle(color: Colors.white, fontSize: 20, + fontWeight: FontWeight.w400, + fontFamily: 'Roboto'), + ), // Row( // mainAxisAlignment: MainAxisAlignment.end, // children: [ @@ -1920,97 +1935,132 @@ class _ChartScreen1State extends ConsumerState { ], ), )), + SizedBox( + // color: Colors.redAccent, + child: Column( + crossAxisAlignment: CrossAxisAlignment.end, + children: [ + Row( + mainAxisAlignment: MainAxisAlignment.end, + children: [ + Row( + key: bookMarkKey, + children: [ + Text( + context.translate( + 'Bookmark', + 'إشارة مرجعية', + ), + style: const TextStyle( + fontSize: 16, + color: Colors.white, + ), + ), + SizedBox(width: 5), + GestureDetector( + onTap: () { + if (isBookmarked) { + showRemoveBookmarkDialog(); + } else { + showAddBookmarkDialog(); + } + }, + + child: Row( + children: [ + // Text( + // "Bookmark", + // style: const TextStyle( + // fontSize: 16, + // color: Colors.white), + // ), + // const SizedBox(width: 5), + Image.asset( + isBookmarked + ? UaeNumbersAssetPath + .bookmarksSelectedUae // Filled bookmark image + : UaeNumbersAssetPath + .bookmarksUae, // Default bookmark image + // color: Colors.white, + width: 24, + height: 24, + ), + ], + ), + ), + ], + ), + SizedBox(width: 10), + Row( + children: [ + Text( + context.translate( + 'Share', + 'يشارك', + ), + style: const TextStyle( + fontSize: 16, + color: Colors.white, + ), + ), + SizedBox(width: 5), + Stack( + children: [ + Image.asset( + UaeNumbersAssetPath.shareUae, + color: Colors.white, // Outline color + width: 24, // Slightly larger + height: 24, + ), + Image.asset( + UaeNumbersAssetPath.shareUae, + color: Colors.white, + width: 24, + height: 24, + ), + ], + ) + ], + ), + SizedBox( + width: 10), // Horizontal space between items + Row( + children: [ + Text( + context.translate( + 'Filter', + 'فلتر', + ), + style: const TextStyle( + fontSize: 16, + color: Colors.white, + ), + ), + + IconButton( + icon: Icon(Icons.filter_alt_outlined, + color: Colors.white, size: 24), + onPressed: () { + showRightSideModal( + context, filterData, chartsData); + }, + ), + + ], + ), + SizedBox( + width: 10), + ], + ), + ], + ), + ), Expanded( + child: Padding( + padding: const EdgeInsets.all(10.0), child: ListView( children: [ - Column( - crossAxisAlignment: CrossAxisAlignment.end, - children: [ - Row( - mainAxisAlignment: MainAxisAlignment.end, - children: [ - Row( - key: bookMarkKey, - children: [ - Text( - context.translate( - 'Bookmark', - 'إشارة مرجعية', - ), - style: const TextStyle( - fontSize: 16, - color: Colors.white, - ), - ), - SizedBox(width: 5), - GestureDetector( - onTap: () { - if (isBookmarked) { - showRemoveBookmarkDialog(); - } else { - showAddBookmarkDialog(); - } - }, - child: Row( - children: [ - Text( - "Bookmark", - style: const TextStyle( - fontSize: 16, - color: Colors.white), - ), - const SizedBox(width: 5), - Image.asset( - isBookmarked - ? UaeNumbersAssetPath - .bookmarksSelectedUae // Filled bookmark image - : UaeNumbersAssetPath - .bookmarksUae, // Default bookmark image - // color: Colors.white, - width: 24, - height: 24, - ), - ], - ), - ), - ], - ), - SizedBox(width: 10), - Row( - children: [ - Text( - context.translate( - 'Share', - 'يشارك', - ), - style: const TextStyle( - fontSize: 16, - color: Colors.white, - ), - ), - SizedBox(width: 5), - Image.asset( - UaeNumbersAssetPath.shareUae, - color: Colors.white, - width: 24, - height: 24, - ), - ], - ), - SizedBox( - width: 5), // Horizontal space between items - IconButton( - icon: Icon(Icons.filter_alt_outlined, - color: Colors.white, size: 28), - onPressed: () { - showRightSideModal( - context, filterData, chartsData); - }, - ), - ], - ), - ], - ), + Row( mainAxisAlignment: MainAxisAlignment.center, children: [ @@ -2223,7 +2273,7 @@ class _ChartScreen1State extends ConsumerState { size: 30); // Fallback icon }, ), - const SizedBox(height: 5), + const SizedBox(height: 1), Flexible( fit: FlexFit.loose, // child: FittedBox( @@ -2242,12 +2292,15 @@ class _ChartScreen1State extends ConsumerState { ), // ), ), - const SizedBox(height: 1), - Text( + const SizedBox(height: 5), + Flexible( + fit: FlexFit.loose, + child: FittedBox( + child:Text( '(${data['firstYear'] ?? 'NA'} - ${data['lastYear'] ?? 'NA'})', style: const TextStyle( fontSize: 10, color: Colors.grey), - ), + ),),), const SizedBox(height: 1), Flexible( fit: FlexFit.loose, @@ -2425,9 +2478,11 @@ class _ChartScreen1State extends ConsumerState { ), ], ), + ), ), ], ), + ), ); } @@ -2437,8 +2492,8 @@ class _ChartScreen1State extends ConsumerState { Color(int.parse(widget.bgColor.replaceFirst('0x', ''), radix: 16)); return Container( margin: EdgeInsets.symmetric(horizontal: 5.0), - width: 35.0, // Set the width of the circle - height: 35.0, + width: 30.0, // Set the width of the circle + height: 30.0, decoration: BoxDecoration( color: onPressed == null ? Colors.grey[400] : Colors.white, shape: BoxShape.circle, @@ -2479,6 +2534,7 @@ class _ChartScreen1State extends ConsumerState { style: TextStyle( color: isActive ? Colors.black : Colors.white, fontWeight: isActive ? FontWeight.w500 : FontWeight.w400, + fontSize: 13, ), ), ), diff --git a/lib/presentation/routes/drawer_routes/custom_drawer_routes.dart b/lib/presentation/routes/drawer_routes/custom_drawer_routes.dart index d669fdae..8260a020 100644 --- a/lib/presentation/routes/drawer_routes/custom_drawer_routes.dart +++ b/lib/presentation/routes/drawer_routes/custom_drawer_routes.dart @@ -32,7 +32,9 @@ class BaseScaffold extends ConsumerStatefulWidget { this.actions, this.showDivider = false, this.dividerColor, + this.navBackArrow, this.showBackButton = false, + this.colorChange = false, this.mycenterTitle = false, this.appbarColor, this.mytitleColor, @@ -40,9 +42,11 @@ class BaseScaffold extends ConsumerStatefulWidget { }); final Widget body; final Widget title; + final Widget? navBackArrow; final Color? dividerColor; final bool showDivider; final bool showBackButton; + final bool colorChange; final bool? mycenterTitle; final List? actions; final Color? bottomColor; @@ -636,13 +640,24 @@ class _BaseScaffoldState extends ConsumerState { return Scaffold( backgroundColor: Colors.white, appBar: AppBar( - // title: widget.title, - title: Align( - alignment: Alignment.centerLeft, // Aligns the title to the left - child: widget.title, + title: Padding( + padding: EdgeInsets.only(top: 10), + child: Align( + alignment: Alignment.centerLeft, + child: DefaultTextStyle( + style: TextStyle( + color: widget.colorChange ? Colors.white : Color(0xFF414042), + fontSize: 22, + fontFamily: 'Roboto', + fontWeight: FontWeight.w500, + ), + child: widget.title, + ), + ), ), + titleSpacing: 0, - backgroundColor: Colors.white, + backgroundColor: widget.appbarColor ?? Colors.white, leadingWidth: widget.showBackButton ? mywidth * 0.25 : null, bottom: widget.showDivider ? PreferredSize( @@ -675,23 +690,28 @@ class _BaseScaffoldState extends ConsumerState { children: [ if (widget.showBackButton == true) Positioned( - left: 15, + top: 10, + left: 18, child: IconButton( color: Colors.white, icon: const Icon(Icons.arrow_back_ios_new), onPressed: () { - Navigator.of(context).pop(); + if ((widget.navBackArrow as Text).data == 'home') { + context.go('/myhomepage'); + } else { + context.go('/uaenumbers'); + } }, ), ), Positioned( top: 8, - right: 10, + right: 4, child: Builder( builder: (BuildContext context) { return IconButton( key: drawerKey, - color: Colors.black, + color: widget.colorChange ? Colors.white : Colors.black, icon: const Icon(Icons.menu, size: 30), onPressed: () { Scaffold.of(context).openDrawer();