From 0316ea9228134cf6ca0eb376c9e4101562c98db5 Mon Sep 17 00:00:00 2001 From: mso7nueh Date: Wed, 4 Sep 2024 11:51:03 +0300 Subject: [PATCH] feat(profile): add button for weight and circumferences --- .../feed/presentation/pages/feed_screen.dart | 1 + .../bloc/profile_cubit/profile_cubit.dart | 14 +- .../presentation/pages/profile_screen.dart | 12 +- .../widgets/circumference_chart_widget.dart | 223 ++++++++++++++---- .../widgets/weight_chart_widget.dart | 192 +++++++++++---- .../repositories/profile_repository.dart | 16 +- .../profile/services/profile_service.dart | 6 +- .../profile/services/profile_service.g.dart | 30 +-- lib/main.dart | 42 ++-- pubspec.yaml | 2 +- 10 files changed, 385 insertions(+), 153 deletions(-) diff --git a/lib/features/feed/presentation/pages/feed_screen.dart b/lib/features/feed/presentation/pages/feed_screen.dart index 241d454a..824c5840 100644 --- a/lib/features/feed/presentation/pages/feed_screen.dart +++ b/lib/features/feed/presentation/pages/feed_screen.dart @@ -32,6 +32,7 @@ class _FeedScreenState extends State { return Scaffold( floatingActionButton: _selectedChipIndex == 1 ? FloatingActionButton.small( + heroTag: 'recipesTagsFilter', backgroundColor: appTheme.blueA400, shape: CircleBorder(), child: Icon( diff --git a/lib/features/profile/presentation/bloc/profile_cubit/profile_cubit.dart b/lib/features/profile/presentation/bloc/profile_cubit/profile_cubit.dart index d36ff4d5..8ff0939d 100644 --- a/lib/features/profile/presentation/bloc/profile_cubit/profile_cubit.dart +++ b/lib/features/profile/presentation/bloc/profile_cubit/profile_cubit.dart @@ -45,6 +45,12 @@ class ProfileCubit extends Cubit { waistCircumference: waistCircumference, hipCircumference: hipCircumference, ); + emit( + ProfileState.loaded( + profile: await profileRepository.getMyProfile(), + blogPosts: (state as ProfileStateLoaded).blogPosts, + ), + ); } catch (e) { emit(ProfileState.error(errorMessage: e.toString())); print(e); @@ -52,12 +58,18 @@ class ProfileCubit extends Cubit { } addWeight({ - required int weight, + required double weight, }) async { try { await profileRepository.addWeight( weight: weight, ); + emit( + ProfileState.loaded( + profile: await profileRepository.getMyProfile(), + blogPosts: (state as ProfileStateLoaded).blogPosts, + ), + ); } catch (e) { emit(ProfileState.error(errorMessage: e.toString())); print(e); diff --git a/lib/features/profile/presentation/pages/profile_screen.dart b/lib/features/profile/presentation/pages/profile_screen.dart index b0aeb788..05f53ce8 100644 --- a/lib/features/profile/presentation/pages/profile_screen.dart +++ b/lib/features/profile/presentation/pages/profile_screen.dart @@ -112,8 +112,16 @@ class _ProfileScreenState extends State { ), Builder( builder: (context) { - if (_selectedChipIndex == 0) return WeightChartWidget(chartPoints: chartPoints); - if (_selectedChipIndex == 1) return CircumferenceChartWidget(chartData: chartData); + if (_selectedChipIndex == 0) + return WeightChartWidget( + chartPoints: chartPoints, + profileCubit: context.read(), + ); + if (_selectedChipIndex == 1) + return CircumferenceChartWidget( + chartData: chartData, + profileCubit: context.read(), + ); if (_selectedChipIndex == 2) return ImtChartWidget(chartPoints: chartPoints); else diff --git a/lib/features/profile/presentation/widgets/circumference_chart_widget.dart b/lib/features/profile/presentation/widgets/circumference_chart_widget.dart index 9294a361..23f9c55d 100644 --- a/lib/features/profile/presentation/widgets/circumference_chart_widget.dart +++ b/lib/features/profile/presentation/widgets/circumference_chart_widget.dart @@ -1,36 +1,63 @@ import 'package:eatvio_app/core/app_export.dart'; import 'package:eatvio_app/features/profile/models/profile_model.dart'; +import 'package:eatvio_app/features/profile/presentation/bloc/profile_cubit/profile_cubit.dart'; +import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:intl/intl.dart'; import 'package:syncfusion_flutter_charts/charts.dart'; -class CircumferenceChartWidget extends StatelessWidget { +class CircumferenceChartWidget extends StatefulWidget { final List chartData; + final ProfileCubit profileCubit; const CircumferenceChartWidget({ super.key, required this.chartData, + required this.profileCubit, }); + @override + State createState() => _CircumferenceChartWidgetState(); +} + +class _CircumferenceChartWidgetState extends State { + late final chestController; + late final hipController; + late final waistController; + late int chest; + late int hip; + late int waist; + + @override + void initState() { + super.initState(); + chestController = FixedExtentScrollController(initialItem: int.parse(widget.chartData.last.chestCircumference.toString())); + hipController = FixedExtentScrollController(initialItem: int.parse(widget.chartData.last.hipCircumference.toString())); + waistController = FixedExtentScrollController(initialItem: int.parse(widget.chartData.last.waistCircumference.toString())); + chest = widget.chartData.last.chestCircumference; + hip = widget.chartData.last.hipCircumference; + waist = widget.chartData.last.waistCircumference; + } + @override Widget build(BuildContext context) { return Column( children: [ SingleChildScrollView( - padding: EdgeInsets.symmetric(horizontal: 16), + padding: EdgeInsets.symmetric(horizontal: 16, vertical: 8), scrollDirection: Axis.horizontal, physics: const BouncingScrollPhysics(), child: Row( children: [ Text( - '${chartData.last.chestCircumference} см', + '${widget.chartData.last.chestCircumference} см', style: TextStyle( color: Colors.black, fontSize: 48, fontWeight: FontWeight.w500, ), ), - chartData.last.chestCircumference > chartData[chartData.length - 2].chestCircumference + widget.chartData.last.chestCircumference > widget.chartData[widget.chartData.length - 2].chestCircumference ? Icon( Icons.arrow_drop_up, size: 48, @@ -42,14 +69,14 @@ class CircumferenceChartWidget extends StatelessWidget { color: Colors.grey, ), Text( - '${chartData.last.waistCircumference} см', + '${widget.chartData.last.waistCircumference} см', style: TextStyle( color: Colors.black, fontSize: 48, fontWeight: FontWeight.w500, ), ), - chartData.last.waistCircumference > chartData[chartData.length - 2].waistCircumference + widget.chartData.last.waistCircumference > widget.chartData[widget.chartData.length - 2].waistCircumference ? Icon( Icons.arrow_drop_up, size: 48, @@ -61,14 +88,14 @@ class CircumferenceChartWidget extends StatelessWidget { color: Colors.grey, ), Text( - '${chartData.last.hipCircumference} см', + '${widget.chartData.last.hipCircumference} см', style: TextStyle( color: Colors.black, fontSize: 48, fontWeight: FontWeight.w500, ), ), - chartData.last.hipCircumference > chartData[chartData.length - 2].hipCircumference + widget.chartData.last.hipCircumference > widget.chartData[widget.chartData.length - 2].hipCircumference ? Icon( Icons.arrow_drop_up, size: 48, @@ -82,43 +109,147 @@ class CircumferenceChartWidget extends StatelessWidget { ], ), ), - SfCartesianChart( - margin: EdgeInsets.symmetric(horizontal: 8), - enableAxisAnimation: true, - plotAreaBorderWidth: 0, - trackballBehavior: TrackballBehavior( - enable: true, - activationMode: ActivationMode.singleTap, - tooltipDisplayMode: TrackballDisplayMode.groupAllPoints, - tooltipSettings: InteractiveTooltip(), - lineType: TrackballLineType.vertical, - ), - primaryXAxis: DateTimeCategoryAxis( - tickPosition: TickPosition.inside, - majorTickLines: MajorTickLines( - size: 0, + Stack( + alignment: Alignment.bottomRight, + children: [ + SfCartesianChart( + margin: EdgeInsets.symmetric(horizontal: 8), + enableAxisAnimation: true, + plotAreaBorderWidth: 0, + trackballBehavior: TrackballBehavior( + enable: true, + activationMode: ActivationMode.singleTap, + tooltipDisplayMode: TrackballDisplayMode.groupAllPoints, + tooltipSettings: InteractiveTooltip(), + lineType: TrackballLineType.vertical, + ), + primaryXAxis: DateTimeCategoryAxis( + tickPosition: TickPosition.inside, + majorTickLines: MajorTickLines( + size: 0, + ), + edgeLabelPlacement: EdgeLabelPlacement.shift, + dateFormat: DateFormat.MMMd('ru'), + labelStyle: TextStyle( + color: Colors.grey, + ), + majorGridLines: MajorGridLines(dashArray: [1], color: Colors.grey.withOpacity(0.3)), + axisLine: AxisLine( + color: Colors.grey.withOpacity(0.3), + width: 0.4, + ), + ), + primaryYAxis: NumericAxis( + isVisible: false, + labelFormat: '{value} см', + axisLine: AxisLine( + width: 1, + ), + majorTickLines: MajorTickLines(size: 0), + ), + series: _getSplineSeries(), + tooltipBehavior: TooltipBehavior(enable: true), ), - edgeLabelPlacement: EdgeLabelPlacement.shift, - dateFormat: DateFormat.MMMd('ru'), - labelStyle: TextStyle( - color: Colors.grey, + FloatingActionButton.small( + heroTag: 'addWeight', + onPressed: () { + showModalBottomSheet( + useRootNavigator: true, + context: context, + builder: (context) { + return Column( + children: [ + Expanded( + child: Row( + children: [ + Expanded( + child: CupertinoPicker( + magnification: 1.22, + squeeze: 1.2, + useMagnifier: true, + scrollController: chestController, + itemExtent: 24, + onSelectedItemChanged: (int value) { + chest = value; + }, + children: [ + for (int i = 0; i < 301; i++) Text('$i'), + ], + ), + ), + Expanded( + child: CupertinoPicker( + magnification: 1.22, + squeeze: 1.2, + useMagnifier: true, + scrollController: hipController, + itemExtent: 24, + onSelectedItemChanged: (int value) { + hip = value; + }, + children: [ + for (int i = 0; i < 301; i++) Text('$i'), + ], + ), + ), + Expanded( + child: CupertinoPicker( + magnification: 1.22, + squeeze: 1.2, + useMagnifier: true, + scrollController: waistController, + itemExtent: 24, + onSelectedItemChanged: (int value) { + waist = value; + }, + children: [ + for (int i = 0; i < 301; i++) Text('$i'), + ], + ), + ), + ], + ), + ), + InkWell( + onTap: () { + widget.profileCubit.addCircumference( + chestCircumference: chest, + waistCircumference: waist, + hipCircumference: hip, + ); + Navigator.of(context).pop(); + }, + borderRadius: BorderRadius.circular(16), + child: Ink( + width: MediaQuery.of(context).size.width - 32, + padding: EdgeInsets.all(16), + decoration: BoxDecoration( + color: appTheme.blueA400, + borderRadius: BorderRadius.circular(16), + ), + child: Center( + child: Text( + 'Сохранить', + style: TextStyle( + color: Colors.white, + ), + ), + ), + ), + ), + ], + ); + }, + ); + }, + backgroundColor: Colors.red, + shape: CircleBorder(), + child: Icon( + Icons.add, + color: Colors.white, + ), ), - majorGridLines: MajorGridLines(dashArray: [1], color: Colors.grey.withOpacity(0.3)), - axisLine: AxisLine( - color: Colors.grey.withOpacity(0.3), - width: 0.4, - ), - ), - primaryYAxis: NumericAxis( - isVisible: false, - labelFormat: '{value} см', - axisLine: AxisLine( - width: 1, - ), - majorTickLines: MajorTickLines(size: 0), - ), - series: _getSplineSeries(), - tooltipBehavior: TooltipBehavior(enable: true), + ], ), ], ); @@ -141,7 +272,7 @@ class CircumferenceChartWidget extends StatelessWidget { labelAlignment: ChartDataLabelAlignment.top, isVisible: true, ), - dataSource: chartData, + dataSource: widget.chartData, borderColor: seriesColor1, gradient: LinearGradient( colors: [ @@ -166,7 +297,7 @@ class CircumferenceChartWidget extends StatelessWidget { labelAlignment: ChartDataLabelAlignment.top, isVisible: true, ), - dataSource: chartData, + dataSource: widget.chartData, borderColor: seriesColor2, gradient: LinearGradient( colors: [ @@ -191,7 +322,7 @@ class CircumferenceChartWidget extends StatelessWidget { labelAlignment: ChartDataLabelAlignment.top, isVisible: true, ), - dataSource: chartData, + dataSource: widget.chartData, borderColor: seriesColor3, gradient: LinearGradient( colors: [ diff --git a/lib/features/profile/presentation/widgets/weight_chart_widget.dart b/lib/features/profile/presentation/widgets/weight_chart_widget.dart index 7c75ad61..684a052c 100644 --- a/lib/features/profile/presentation/widgets/weight_chart_widget.dart +++ b/lib/features/profile/presentation/widgets/weight_chart_widget.dart @@ -1,17 +1,40 @@ import 'package:eatvio_app/core/app_export.dart'; import 'package:eatvio_app/features/profile/models/profile_model.dart'; +import 'package:eatvio_app/features/profile/presentation/bloc/profile_cubit/profile_cubit.dart'; +import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:intl/intl.dart'; import 'package:syncfusion_flutter_charts/charts.dart'; -class WeightChartWidget extends StatelessWidget { +class WeightChartWidget extends StatefulWidget { final List chartPoints; + final ProfileCubit profileCubit; const WeightChartWidget({ super.key, required this.chartPoints, + required this.profileCubit, }); + @override + State createState() => _WeightChartWidgetState(); +} + +class _WeightChartWidgetState extends State { + late final weightKiloController; + late final weightGramsController; + late int weightKilo; + late int weightGrams; + + @override + void initState() { + super.initState(); + weightKiloController = FixedExtentScrollController(initialItem: int.parse(widget.chartPoints.last.weight.toString().split('.')[0]) - 20); + weightGramsController = FixedExtentScrollController(initialItem: int.parse(widget.chartPoints.last.weight.toString().split('.')[1][0])); + weightKilo = int.parse(widget.chartPoints.last.weight.toString().split('.')[0]); + weightGrams = int.parse(widget.chartPoints.last.weight.toString().split('.')[1][0]); + } + @override Widget build(BuildContext context) { return Column( @@ -22,14 +45,14 @@ class WeightChartWidget extends StatelessWidget { child: Row( children: [ Text( - '${chartPoints.last.weight.toStringAsFixed(2)} кг', + '${widget.chartPoints.last.weight.toStringAsFixed(1)} кг', style: TextStyle( color: Colors.black, fontSize: 48, fontWeight: FontWeight.w500, ), ), - chartPoints.last.weight > chartPoints[chartPoints.length - 2].weight + widget.chartPoints.last.weight > widget.chartPoints[widget.chartPoints.length - 2].weight ? Icon( Icons.arrow_drop_up, size: 48, @@ -43,46 +66,131 @@ class WeightChartWidget extends StatelessWidget { ], ), ), - SfCartesianChart( - margin: EdgeInsets.symmetric(horizontal: 8), - enableAxisAnimation: true, - plotAreaBorderWidth: 0, - trackballBehavior: TrackballBehavior( - enable: true, - activationMode: ActivationMode.singleTap, - tooltipDisplayMode: TrackballDisplayMode.groupAllPoints, - tooltipSettings: InteractiveTooltip(), - lineType: TrackballLineType.vertical, - ), - primaryXAxis: DateTimeCategoryAxis( - initialVisibleMinimum: chartPoints.first.createdAt, - initialVisibleMaximum: chartPoints.last.createdAt, - tickPosition: TickPosition.inside, - majorTickLines: MajorTickLines( - size: 0, + Stack( + alignment: Alignment.bottomRight, + children: [ + SfCartesianChart( + margin: EdgeInsets.symmetric(horizontal: 8), + enableAxisAnimation: true, + plotAreaBorderWidth: 0, + trackballBehavior: TrackballBehavior( + enable: true, + activationMode: ActivationMode.singleTap, + tooltipDisplayMode: TrackballDisplayMode.groupAllPoints, + tooltipSettings: InteractiveTooltip(), + lineType: TrackballLineType.vertical, + ), + primaryXAxis: DateTimeCategoryAxis( + initialVisibleMinimum: widget.chartPoints.first.createdAt, + initialVisibleMaximum: widget.chartPoints.last.createdAt, + tickPosition: TickPosition.inside, + majorTickLines: MajorTickLines( + size: 0, + ), + edgeLabelPlacement: EdgeLabelPlacement.shift, + dateFormat: DateFormat.MMMd('ru'), + labelStyle: TextStyle( + color: Colors.grey, + ), + majorGridLines: MajorGridLines(dashArray: [1], color: Colors.grey.withOpacity(0.3)), + axisLine: AxisLine( + color: Colors.grey.withOpacity(0.3), + width: 0.4, + ), + ), + primaryYAxis: NumericAxis( + isVisible: false, + labelFormat: '{value} кг', + majorGridLines: MajorGridLines(dashArray: [1], color: Colors.grey), + axisLine: AxisLine( + width: 1, + ), + majorTickLines: MajorTickLines(size: 0), + ), + series: _getSplineSeries(), + tooltipBehavior: TooltipBehavior(enable: true), ), - edgeLabelPlacement: EdgeLabelPlacement.shift, - dateFormat: DateFormat.MMMd('ru'), - labelStyle: TextStyle( - color: Colors.grey, + FloatingActionButton.small( + heroTag: 'addWeight', + onPressed: () { + showModalBottomSheet( + useRootNavigator: true, + context: context, + builder: (context) { + return Column( + children: [ + Expanded( + child: Row( + children: [ + Expanded( + child: CupertinoPicker( + magnification: 1.22, + squeeze: 1.2, + useMagnifier: true, + scrollController: weightKiloController, + itemExtent: 24, + onSelectedItemChanged: (int value) { + weightKilo = value + 20; + }, + children: [ + for (int i = 20; i < 301; i++) Text('$i'), + ], + ), + ), + Expanded( + child: CupertinoPicker( + magnification: 1.22, + squeeze: 1.2, + useMagnifier: true, + scrollController: weightGramsController, + itemExtent: 24, + onSelectedItemChanged: (int value) { + weightGrams = value; + }, + children: [ + for (int i = 0; i < 10; i++) Text('$i'), + ], + ), + ), + ], + ), + ), + InkWell( + onTap: () { + widget.profileCubit.addWeight(weight: double.parse('$weightKilo.$weightGrams')); + Navigator.of(context).pop(); + }, + borderRadius: BorderRadius.circular(16), + child: Ink( + width: MediaQuery.of(context).size.width - 32, + padding: EdgeInsets.all(16), + decoration: BoxDecoration( + color: appTheme.blueA400, + borderRadius: BorderRadius.circular(16), + ), + child: Center( + child: Text( + 'Сохранить', + style: TextStyle( + color: Colors.white, + ), + ), + ), + ), + ), + ], + ); + }, + ); + }, + backgroundColor: Colors.red, + shape: CircleBorder(), + child: Icon( + Icons.add, + color: Colors.white, + ), ), - majorGridLines: MajorGridLines(dashArray: [1], color: Colors.grey.withOpacity(0.3)), - axisLine: AxisLine( - color: Colors.grey.withOpacity(0.3), - width: 0.4, - ), - ), - primaryYAxis: NumericAxis( - isVisible: false, - labelFormat: '{value} кг', - majorGridLines: MajorGridLines(dashArray: [1], color: Colors.grey), - axisLine: AxisLine( - width: 1, - ), - majorTickLines: MajorTickLines(size: 0), - ), - series: _getSplineSeries(), - tooltipBehavior: TooltipBehavior(enable: true), + ], ), ], ); @@ -101,7 +209,7 @@ class WeightChartWidget extends StatelessWidget { labelAlignment: ChartDataLabelAlignment.top, isVisible: true, ), - dataSource: chartPoints, + dataSource: widget.chartPoints, borderColor: appTheme.blueA400, gradient: LinearGradient( colors: [ diff --git a/lib/features/profile/repositories/profile_repository.dart b/lib/features/profile/repositories/profile_repository.dart index 2261f74b..0520188f 100644 --- a/lib/features/profile/repositories/profile_repository.dart +++ b/lib/features/profile/repositories/profile_repository.dart @@ -23,7 +23,7 @@ class ProfileRepository { } } - Future addCircumference({ + Future addCircumference({ required int chestCircumference, required int waistCircumference, required int hipCircumference, @@ -33,23 +33,17 @@ class ProfileRepository { chestCircumference: chestCircumference, waistCircumference: waistCircumference, hipCircumference: hipCircumference, - )) - .values - .first; + )); } catch (e) { rethrow; } } - Future addWeight({ - required int weight, + Future addWeight({ + required double weight, }) async { try { - return (await profileService.addWeight( - weight: weight, - )) - .values - .first; + return (await profileService.addWeight(weight: weight)); } catch (e) { rethrow; } diff --git a/lib/features/profile/services/profile_service.dart b/lib/features/profile/services/profile_service.dart index 94a4bdc9..8ab452c9 100644 --- a/lib/features/profile/services/profile_service.dart +++ b/lib/features/profile/services/profile_service.dart @@ -18,15 +18,15 @@ abstract class ProfileService { Future getMyProfile(); @POST('/api/profile/addCircumference') - Future> addCircumference({ + Future addCircumference({ @Part(name: 'chest_circumference') required int chestCircumference, @Part(name: 'waist_circumference') required int waistCircumference, @Part(name: 'hip_circumference') required int hipCircumference, }); @POST('/api/profile/addWeight') - Future> addWeight({ - @Part() required int weight, + Future addWeight({ + @Part() required double weight, }); @GET('/api/blogPosts/search_by_author/{slug}') diff --git a/lib/features/profile/services/profile_service.g.dart b/lib/features/profile/services/profile_service.g.dart index 366a5226..cbab3e03 100644 --- a/lib/features/profile/services/profile_service.g.dart +++ b/lib/features/profile/services/profile_service.g.dart @@ -88,7 +88,7 @@ class _ProfileService implements ProfileService { } @override - Future> addCircumference({ + Future addCircumference({ required int chestCircumference, required int waistCircumference, required int hipCircumference, @@ -109,7 +109,7 @@ class _ProfileService implements ProfileService { 'hip_circumference', hipCircumference.toString(), )); - final _options = _setStreamType>(Options( + final _options = _setStreamType(Options( method: 'POST', headers: _headers, extra: _extra, @@ -125,20 +125,11 @@ class _ProfileService implements ProfileService { _dio.options.baseUrl, baseUrl, ))); - final _result = await _dio.fetch>(_options); - late Map _value; - try { - _value = _result.data!.map((k, dynamic v) => - MapEntry(k, Circumference.fromJson(v as Map))); - } on Object catch (e, s) { - errorLogger?.logError(e, s, _options); - rethrow; - } - return _value; + await _dio.fetch(_options); } @override - Future> addWeight({required int weight}) async { + Future addWeight({required double weight}) async { final _extra = {}; final queryParameters = {}; final _headers = {}; @@ -147,7 +138,7 @@ class _ProfileService implements ProfileService { 'weight', weight.toString(), )); - final _options = _setStreamType>(Options( + final _options = _setStreamType(Options( method: 'POST', headers: _headers, extra: _extra, @@ -163,16 +154,7 @@ class _ProfileService implements ProfileService { _dio.options.baseUrl, baseUrl, ))); - final _result = await _dio.fetch>(_options); - late Map _value; - try { - _value = _result.data!.map((k, dynamic v) => - MapEntry(k, ChartPointModel.fromJson(v as Map))); - } on Object catch (e, s) { - errorLogger?.logError(e, s, _options); - rethrow; - } - return _value; + await _dio.fetch(_options); } @override diff --git a/lib/main.dart b/lib/main.dart index a0867795..948cdf34 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -1,6 +1,5 @@ import 'package:eatvio_app/app_router.dart'; import 'package:eatvio_app/core/initialization_cubit/initialization_cubit.dart'; -import 'package:eatvio_app/core/initialization_cubit/initialization_state.dart'; import 'package:eatvio_app/features/bottom_navigation_bar/presentation/bloc/new_messages_cubit/new_messages_cubit.dart'; import 'package:eatvio_app/features/bottom_navigation_bar/presentation/bloc/notifications_cubit/notifications_cubit.dart'; import 'package:eatvio_app/features/bottom_navigation_bar/presentation/bloc/profile_avatar_cubit/profile_avatar_cubit.dart'; @@ -53,29 +52,26 @@ class MyApp extends StatelessWidget { BlocProvider(create: (context) => sl()..loadCalendarList()), BlocProvider(create: (context) => sl()..loadRecipeCreate()), ], - child: BlocListener( - listener: (BuildContext context, InitializationState state) {}, - child: KeyboardDismisser( - gestures: [ - GestureType.onTap, - GestureType.onPanUpdateDownDirection, + child: KeyboardDismisser( + gestures: [ + GestureType.onTap, + GestureType.onPanUpdateDownDirection, + ], + child: MaterialApp.router( + theme: theme, + routerConfig: AppRouter.appRouter, + debugShowCheckedModeBanner: false, + localizationsDelegates: [ + AppLocalizationDelegate(), + GlobalMaterialLocalizations.delegate, + GlobalWidgetsLocalizations.delegate, + GlobalCupertinoLocalizations.delegate, + ], + supportedLocales: [ + Locale( + 'ru', + ), ], - child: MaterialApp.router( - theme: theme, - routerConfig: AppRouter.appRouter, - debugShowCheckedModeBanner: false, - localizationsDelegates: [ - AppLocalizationDelegate(), - GlobalMaterialLocalizations.delegate, - GlobalWidgetsLocalizations.delegate, - GlobalCupertinoLocalizations.delegate, - ], - supportedLocales: [ - Locale( - 'ru', - ), - ], - ), ), ), ); diff --git a/pubspec.yaml b/pubspec.yaml index 514eb4a2..a70e6c94 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -42,7 +42,7 @@ dependencies: badges: ^3.1.2 google_fonts: ^6.2.1 location: ^6.0.2 - syncfusion_flutter_charts: ^26.2.11 + syncfusion_flutter_charts: ^26.2.12 table_calendar: ^3.1.2 flutter_keyboard_visibility: ^6.0.0 share_plus: ^10.0.0