From 84843e81f7f9de9fb05c48aaf218caf03dd45c12 Mon Sep 17 00:00:00 2001 From: kaushal1717 Date: Tue, 6 Jun 2023 10:30:55 +0530 Subject: [PATCH 1/6] [Buttons Added] Animated Buttons --- .../all_buttons/animated_button/button11.dart | 50 ++++++++++++++ .../all_buttons/animated_button/button12.dart | 68 +++++++++++++++++++ pubspec.lock | 34 +++++----- 3 files changed, 135 insertions(+), 17 deletions(-) create mode 100644 lib/ui_components/buttons/all_buttons/animated_button/button11.dart create mode 100644 lib/ui_components/buttons/all_buttons/animated_button/button12.dart diff --git a/lib/ui_components/buttons/all_buttons/animated_button/button11.dart b/lib/ui_components/buttons/all_buttons/animated_button/button11.dart new file mode 100644 index 0000000..ef73e0d --- /dev/null +++ b/lib/ui_components/buttons/all_buttons/animated_button/button11.dart @@ -0,0 +1,50 @@ +import 'package:flutter/material.dart'; + +class Button11 extends StatefulWidget { + final String title; + const Button11(this.title, {super.key}); + + @override + State createState() => _Button11State(); +} + +class _Button11State extends State { + bool _isLoading = false; + @override + Widget build(BuildContext context) { + return ElevatedButton( + onPressed: () async { + setState(() => _isLoading = true); + await Future.delayed(const Duration(seconds: 3)); + setState(() => _isLoading = false); + }, + style: ElevatedButton.styleFrom( + backgroundColor: const Color.fromARGB(255, 0, 194, 203), + fixedSize: const Size(100, 60), + shape: + RoundedRectangleBorder(borderRadius: BorderRadius.circular(50))), + child: _isLoading + // ignore: sized_box_for_whitespace + ? Container( + width: 200, + height: 60, + child: Row( + children: const [ + CircularProgressIndicator(color: Colors.white), + SizedBox(width: 30), + Text('Please wait...', + style: TextStyle( + fontSize: 20, + // fontWeight: FontWeight.w600, + color: Color.fromARGB(255, 255, 255, 255))) + ], + ), + ) + : Text(widget.title, + style: const TextStyle( + fontSize: 20, + // fontWeight: FontWeight.w600, + color: Color.fromARGB(255, 255, 255, 255))), + ); + } +} diff --git a/lib/ui_components/buttons/all_buttons/animated_button/button12.dart b/lib/ui_components/buttons/all_buttons/animated_button/button12.dart new file mode 100644 index 0000000..54056de --- /dev/null +++ b/lib/ui_components/buttons/all_buttons/animated_button/button12.dart @@ -0,0 +1,68 @@ +import 'package:flutter/material.dart'; + +enum ButtonState { init, loading, done } + +class Button12 extends StatefulWidget { + final String title; + const Button12(this.title, {super.key}); + @override + Button12State createState() => Button12State(); +} + +class Button12State extends State { + bool _isAnimating = true; + ButtonState state = ButtonState.init; + @override + Widget build(BuildContext context) { + var width = MediaQuery.of(context).size.width; + bool isStretched = _isAnimating || state == ButtonState.init; + bool isDone = state == ButtonState.done; + return AnimatedContainer( + duration: const Duration(milliseconds: 300), + curve: Curves.easeIn, + alignment: Alignment.center, + width: state == ButtonState.init ? width : 100, + height: 70, + onEnd: () => setState(() => _isAnimating = !_isAnimating), + child: isStretched ? buildButton() : smallButton(isDone), + ); + } + + Widget buildButton() => ElevatedButton( + onPressed: () async { + setState(() => state = ButtonState.loading); + await Future.delayed(const Duration(seconds: 3)); + setState(() => state = ButtonState.done); + await Future.delayed(const Duration(seconds: 3)); + setState(() => state = ButtonState.init); + }, + style: ElevatedButton.styleFrom( + backgroundColor: const Color.fromARGB(255, 0, 194, 203), + fixedSize: const Size(100, 60), + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(50))), + child: Text(widget.title, + style: const TextStyle( + fontSize: 20, + fontWeight: FontWeight.w600, + color: Color.fromARGB(255, 255, 255, 255))), + ); + Widget smallButton(bool isDone) { + final color = + isDone ? Colors.green : const Color.fromARGB(255, 0, 194, 203); + return Container( + height: 55, + decoration: BoxDecoration(color: color, shape: BoxShape.circle), + child: Center( + child: isDone + ? const Icon( + Icons.done, + color: Colors.white, + size: 45, + ) + : const CircularProgressIndicator( + color: Colors.white, + )), + ); + } +} diff --git a/pubspec.lock b/pubspec.lock index 24f5ce3..af40b04 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -13,10 +13,10 @@ packages: dependency: transitive description: name: async - sha256: "947bfcf187f74dbc5e146c9eb9c0f10c9f8b30743e341481c1e2ed3ecc18c20c" + sha256: bfe67ef28df125b7dddcea62755991f807aa39a2492a23e1550161692950bbe0 url: "https://pub.dev" source: hosted - version: "2.11.0" + version: "2.10.0" boolean_selector: dependency: transitive description: @@ -29,10 +29,10 @@ packages: dependency: transitive description: name: characters - sha256: "04a925763edad70e8443c99234dc3328f442e811f1d8fd1a72f1c8ad0f69a605" + sha256: e6a326c8af69605aec75ed6c187d06b349707a27fbff8222ca9cc2cff167975c url: "https://pub.dev" source: hosted - version: "1.3.0" + version: "1.2.1" clipboard: dependency: "direct main" description: @@ -53,10 +53,10 @@ packages: dependency: transitive description: name: collection - sha256: "4a07be6cb69c84d677a6c3096fcf960cc3285a8330b4603e0d463d15d9bd934c" + sha256: cfc915e6923fe5ce6e153b0723c753045de46de1b4d63771530504004a45fae0 url: "https://pub.dev" source: hosted - version: "1.17.1" + version: "1.17.0" crypto: dependency: transitive description: @@ -188,10 +188,10 @@ packages: dependency: transitive description: name: js - sha256: f2c445dce49627136094980615a031419f7f3eb393237e4ecd97ac15dea343f3 + sha256: "5528c2f391ededb7775ec1daa69e65a2d61276f7552de2b5f7b8d34ee9fd4ab7" url: "https://pub.dev" source: hosted - version: "0.6.7" + version: "0.6.5" lints: dependency: transitive description: @@ -204,10 +204,10 @@ packages: dependency: transitive description: name: matcher - sha256: "6501fbd55da300384b768785b83e5ce66991266cec21af89ab9ae7f5ce1c4cbb" + sha256: "16db949ceee371e9b99d22f88fa3a73c4e59fd0afed0bd25fc336eb76c198b72" url: "https://pub.dev" source: hosted - version: "0.12.15" + version: "0.12.13" material_color_utilities: dependency: transitive description: @@ -220,10 +220,10 @@ packages: dependency: transitive description: name: meta - sha256: "3c74dbf8763d36539f114c799d8a2d87343b5067e9d796ca22b5eb8437090ee3" + sha256: "6c268b42ed578a53088d834796959e4a1814b5e9e164f147f580a386e5decf42" url: "https://pub.dev" source: hosted - version: "1.9.1" + version: "1.8.0" nested: dependency: transitive description: @@ -244,10 +244,10 @@ packages: dependency: transitive description: name: path - sha256: "8829d8a55c13fc0e37127c29fedf290c102f4e40ae94ada574091fe0ff96c917" + sha256: db9d4f58c908a4ba5953fcee2ae317c94889433e5024c27ce74a37f94267945b url: "https://pub.dev" source: hosted - version: "1.8.3" + version: "1.8.2" path_provider: dependency: transitive description: @@ -377,10 +377,10 @@ packages: dependency: transitive description: name: test_api - sha256: eb6ac1540b26de412b3403a163d919ba86f6a973fe6cc50ae3541b80092fdcfb + sha256: ad540f65f92caa91bf21dfc8ffb8c589d6e4dc0c2267818b4cc2792857706206 url: "https://pub.dev" source: hosted - version: "0.5.1" + version: "0.4.16" typed_data: dependency: transitive description: @@ -478,5 +478,5 @@ packages: source: hosted version: "1.0.0" sdks: - dart: ">=3.0.0-0 <4.0.0" + dart: ">=2.19.0 <3.0.0" flutter: ">=3.3.0" From 7a3683cc84a99d48affc207c5229bdf24c630a60 Mon Sep 17 00:00:00 2001 From: kaushal1717 Date: Tue, 6 Jun 2023 10:44:50 +0530 Subject: [PATCH 2/6] [buttons added] animated buttons --- lib/ui_components/buttons/buttons.dart | 67 +++++++++++++++++++++++++- 1 file changed, 66 insertions(+), 1 deletion(-) diff --git a/lib/ui_components/buttons/buttons.dart b/lib/ui_components/buttons/buttons.dart index cac3697..b5ca49e 100644 --- a/lib/ui_components/buttons/buttons.dart +++ b/lib/ui_components/buttons/buttons.dart @@ -10,8 +10,9 @@ import 'package:flutter_component_ui/ui_components/buttons/all_buttons/elevated_ import 'package:flutter_component_ui/ui_components/buttons/all_buttons/elevated_button/button5.dart'; import 'package:flutter_component_ui/ui_components/buttons/all_buttons/text_button/button6.dart'; import 'package:provider/provider.dart'; - import '../../theme/theme.dart'; +import 'all_buttons/animated_button/button11.dart'; +import 'all_buttons/animated_button/button12.dart'; import 'all_buttons/elevated_button/button7.dart'; import 'all_buttons/outline_button/button10.dart'; import 'all_buttons/outline_button/button2.dart'; @@ -50,6 +51,13 @@ class _ButtonScreenState extends State { List customTextButtonColor = [null]; List customTextButtonIndex = [9]; + final List customAnimatedButton = [ + const Button11("button"), + const Button12("button"), + ]; + + List customAnimatedButtonColor = [null, null]; + @override Widget build(BuildContext context) { return Scaffold( @@ -231,6 +239,63 @@ class _ButtonScreenState extends State { ), ), ), + Align( + alignment: Alignment.centerLeft, + child: Padding( + padding: const EdgeInsets.all(8.0), + child: Text("Animated Buttons", + style: TextStyle( + fontSize: 20, + fontWeight: FontWeight.bold, + color: MyTheme.lightBluishColor)), + ), + ), + Wrap( + direction: Axis.horizontal, + children: List.generate( + customAnimatedButton.length, + (index) => Consumer( + builder: (context, favProviderModel, child) => Column( + children: [ + Container( + padding: const EdgeInsets.symmetric( + horizontal: 12, + vertical: 8, + ), + width: double.infinity, + child: customAnimatedButton[index], + ), + Padding( + padding: const EdgeInsets.fromLTRB(0, 3, 20, 3), + child: Row( + mainAxisAlignment: MainAxisAlignment.end, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + const Text('Add to favorite'), + const SizedBox( + width: 5, + ), + GestureDetector( + onTap: () { + favProviderModel + .add(customTextButtonIndex[index]); + setState(() { + customTextButtonColor[index] = Colors.amber; + }); + }, + child: Icon( + Icons.star_border_outlined, + color: customAnimatedButtonColor[index], + ), + ), + ], + ), + ), + ], + ), + ), + ), + ), // SizedBox( // width: (MediaQuery.of(context).size.width / 2 - 20), // child: ListView.builder( From ead019e8e033cf7f3efce528016e57b844499401 Mon Sep 17 00:00:00 2001 From: Uttkarsh-raj Date: Wed, 7 Jun 2023 14:38:16 +0530 Subject: [PATCH 3/6] refactor and new star logic --- lib/data/export.dart | 2 +- lib/provider/favorite_provider.dart | 4 + lib/ui_components/alerts/alerts.dart | 31 +- lib/ui_components/buttons/buttons.dart | 32 +- lib/ui_components/cards/cards.dart | 42 ++- .../input_fields/input_fields.dart | 20 +- lib/ui_components/messages/messages.dart | 20 +- .../pricing_cards/pricing_cards.dart | 10 +- .../segmented_controls.dart | 0 .../segmented_control_screen.dart | 290 ++++++++---------- lib/ui_components/sliders/sliders.dart | 20 +- 11 files changed, 215 insertions(+), 256 deletions(-) rename lib/ui_components/segmented_controls/{ => all_segmented_controls}/segmented_controls.dart (100%) diff --git a/lib/data/export.dart b/lib/data/export.dart index 5861af1..6390682 100644 --- a/lib/data/export.dart +++ b/lib/data/export.dart @@ -50,7 +50,7 @@ export '../../ui_components/paginations/all_paginations/page3.dart'; export '../../ui_components/paginations/all_paginations/page4.dart'; export '../../ui_components/paginations/all_paginations/page5.dart'; export '../../ui_components/pricing_cards/All Pricing Cards/pricing_card/pricing_cards1.dart'; -export '../../ui_components/segmented_controls/segmented_controls.dart'; +export '../ui_components/segmented_controls/all_segmented_controls/segmented_controls.dart'; export '../../ui_components/sliders/all_sliders/dual_pointer_slider/slider4.dart'; export '../../ui_components/sliders/all_sliders/single_pointer_slider/slider1.dart'; export '../../ui_components/sliders/all_sliders/single_pointer_slider/slider2.dart'; diff --git a/lib/provider/favorite_provider.dart b/lib/provider/favorite_provider.dart index 0f5a1aa..81ca85e 100644 --- a/lib/provider/favorite_provider.dart +++ b/lib/provider/favorite_provider.dart @@ -527,4 +527,8 @@ class FavoritesProvider extends ChangeNotifier { db.saveData(favs); notifyListeners(); } + + bool starred(int index) { + return favs.contains(index); + } } diff --git a/lib/ui_components/alerts/alerts.dart b/lib/ui_components/alerts/alerts.dart index 4d9952a..2100eba 100644 --- a/lib/ui_components/alerts/alerts.dart +++ b/lib/ui_components/alerts/alerts.dart @@ -32,7 +32,6 @@ class _AlertScreenState extends State { const Alert4("AMessage", "ADescriptions"), ]; - List coluredAlertsColor = [null, null, null, null]; List coluredAlertsIndex = [14, 15, 16, 17]; final List simpleAlerts = [ @@ -42,7 +41,6 @@ class _AlertScreenState extends State { const Alert8("AMessage", "ADescriptions"), ]; - List simpleAlertsColor = [null, null, null, null]; List simpleAlertsIndex = [18, 19, 20, 21]; final List simpleAlertsDarkMode = [ @@ -52,7 +50,6 @@ class _AlertScreenState extends State { const Alert12("AMessage", "ADescriptions"), ]; - List simpleAlertsDarkModeColor = [null, null, null, null]; List simpleAlertsDarkModeIndex = [22, 23, 24, 25]; @override @@ -98,13 +95,14 @@ class _AlertScreenState extends State { onTap: () { favProviderModel .add(coluredAlertsIndex[index]); - setState(() { - coluredAlertsColor[index] = Colors.amber; - }); + setState(() {}); }, child: Icon( Icons.star_border_outlined, - color: coluredAlertsColor[index], + color: (favProviderModel + .starred(coluredAlertsIndex[index])) + ? Colors.amber + : null, ), ), ], @@ -154,13 +152,14 @@ class _AlertScreenState extends State { onTap: () { favProviderModel .add(simpleAlertsIndex[index]); - setState(() { - simpleAlertsColor[index] = Colors.amber; - }); + setState(() {}); }, child: Icon( Icons.star_border_outlined, - color: simpleAlertsColor[index], + color: (favProviderModel + .starred(simpleAlertsIndex[index])) + ? Colors.amber + : null, ), ), ], @@ -210,14 +209,14 @@ class _AlertScreenState extends State { onTap: () { favProviderModel .add(simpleAlertsIndex[index]); - setState(() { - simpleAlertsDarkModeColor[index] = - Colors.amber; - }); + setState(() {}); }, child: Icon( Icons.star_border_outlined, - color: simpleAlertsDarkModeColor[index], + color: (favProviderModel + .starred(simpleAlertsIndex[index])) + ? Colors.amber + : null, ), ), ], diff --git a/lib/ui_components/buttons/buttons.dart b/lib/ui_components/buttons/buttons.dart index cac3697..b54c680 100644 --- a/lib/ui_components/buttons/buttons.dart +++ b/lib/ui_components/buttons/buttons.dart @@ -31,7 +31,6 @@ class _ButtonScreenState extends State { const Button10("button"), ]; - List customOutlineButtonColor = [null, null, null]; List customOutlineButtonIndex = [1, 2, 3]; final List customElevatedButton = [ @@ -41,13 +40,11 @@ class _ButtonScreenState extends State { const Button7("button"), const Button9("button") ]; - List customElevatedButtonColor = [null, null, null, null, null]; List customElevatedButtonIndex = [4, 5, 6, 7, 8]; final List customTextButton = [ const Button6("button"), ]; - List customTextButtonColor = [null]; List customTextButtonIndex = [9]; @override @@ -98,14 +95,14 @@ class _ButtonScreenState extends State { onTap: () { favProviderModel .add(customElevatedButtonIndex[index]); - setState(() { - customElevatedButtonColor[index] = - Colors.amber; - }); + setState(() {}); }, child: Icon( Icons.star_border_outlined, - color: customElevatedButtonColor[index], + color: (favProviderModel.starred( + customElevatedButtonIndex[index])) + ? Colors.amber + : null, ), ), ], @@ -156,14 +153,14 @@ class _ButtonScreenState extends State { onTap: () { favProviderModel .add(customOutlineButtonIndex[index]); - setState(() { - customOutlineButtonColor[index] = - Colors.amber; - }); + setState(() {}); }, child: Icon( Icons.star_border_outlined, - color: customOutlineButtonColor[index], + color: (favProviderModel.starred( + customOutlineButtonIndex[index])) + ? Colors.amber + : null, ), ), ], @@ -214,13 +211,14 @@ class _ButtonScreenState extends State { onTap: () { favProviderModel .add(customTextButtonIndex[index]); - setState(() { - customTextButtonColor[index] = Colors.amber; - }); + setState(() {}); }, child: Icon( Icons.star_border_outlined, - color: customTextButtonColor[index], + color: (favProviderModel.starred( + customTextButtonIndex[index])) + ? Colors.amber + : null, ), ), ], diff --git a/lib/ui_components/cards/cards.dart b/lib/ui_components/cards/cards.dart index 213a755..e7924ba 100644 --- a/lib/ui_components/cards/cards.dart +++ b/lib/ui_components/cards/cards.dart @@ -24,28 +24,24 @@ class _CardScreenState extends State { FirstCard(), SecondCard(), ]; - List blogCardListColor = [null, null]; List blogCardListIndex = [26, 27]; final socialCardList = const [ ThirdCard(), FourthCard(), ]; - List socialCardListColor = [null, null]; List socialCardListIndex = [28, 29]; final blogCardDarKModeList = const [ FifthCard(), SixthCard(), ]; - List blogCardDarKModeListColor = [null, null]; List blogCardDarKModeListIndex = [30, 31]; final socialCardDarkModeList = const [ SeventhCard(), EightCard(), ]; - List socialCardDarkModeListColor = [null, null]; List socialCardDarkModeListIndex = [32, 33]; @override @@ -94,13 +90,14 @@ class _CardScreenState extends State { GestureDetector( onTap: () { favProviderModel.add(blogCardListIndex[index]); - setState(() { - blogCardListColor[index] = Colors.amber; - }); + setState(() {}); }, child: Icon( Icons.star_border_outlined, - color: blogCardListColor[index], + color: (favProviderModel + .starred(blogCardListIndex[index])) + ? Colors.amber + : null, ), ), ], @@ -151,13 +148,14 @@ class _CardScreenState extends State { onTap: () { favProviderModel .add(socialCardListIndex[index]); - setState(() { - socialCardListColor[index] = Colors.amber; - }); + setState(() {}); }, child: Icon( Icons.star_border_outlined, - color: socialCardListColor[index], + color: (favProviderModel + .starred(socialCardListIndex[index])) + ? Colors.amber + : null, ), ), ], @@ -208,14 +206,14 @@ class _CardScreenState extends State { onTap: () { favProviderModel .add(blogCardDarKModeListIndex[index]); - setState(() { - blogCardDarKModeListColor[index] = - Colors.amber; - }); + setState(() {}); }, child: Icon( Icons.star_border_outlined, - color: blogCardDarKModeListColor[index], + color: (favProviderModel.starred( + blogCardDarKModeListIndex[index])) + ? Colors.amber + : null, ), ), ], @@ -266,14 +264,14 @@ class _CardScreenState extends State { onTap: () { favProviderModel .add(socialCardDarkModeListIndex[index]); - setState(() { - socialCardDarkModeListColor[index] = - Colors.amber; - }); + setState(() {}); }, child: Icon( Icons.star_border_outlined, - color: socialCardDarkModeListColor[index], + color: (favProviderModel.starred( + socialCardDarkModeListIndex[index])) + ? Colors.amber + : null, ), ), ], diff --git a/lib/ui_components/input_fields/input_fields.dart b/lib/ui_components/input_fields/input_fields.dart index 3c289a9..12a8eff 100644 --- a/lib/ui_components/input_fields/input_fields.dart +++ b/lib/ui_components/input_fields/input_fields.dart @@ -39,7 +39,6 @@ class _InputFieldScreenState extends State { hinttext: "Write Description", ) ]; - List textareasColor = [null, null, null, null]; List textareasIndex = [37, 38, 39, 40]; final List inputfields = [ @@ -64,7 +63,6 @@ class _InputFieldScreenState extends State { hinttext: "Input Title", ), ]; - List inputfieldsColor = [null, null, null, null, null]; List inputfieldsIndex = [41, 42, 43, 44, 45]; @override @@ -112,13 +110,14 @@ class _InputFieldScreenState extends State { GestureDetector( onTap: () { favProviderModel.add(inputfieldsIndex[index]); - setState(() { - inputfieldsColor[index] = Colors.amber; - }); + setState(() {}); }, child: Icon( Icons.star_border_outlined, - color: inputfieldsColor[index], + color: (favProviderModel + .starred(inputfieldsIndex[index])) + ? Colors.amber + : null, ), ), ], @@ -167,13 +166,14 @@ class _InputFieldScreenState extends State { GestureDetector( onTap: () { favProviderModel.add(textareasIndex[index]); - setState(() { - textareasColor[index] = Colors.amber; - }); + setState(() {}); }, child: Icon( Icons.star_border_outlined, - color: textareasColor[index], + color: (favProviderModel + .starred(textareasIndex[index])) + ? Colors.amber + : null, ), ), ], diff --git a/lib/ui_components/messages/messages.dart b/lib/ui_components/messages/messages.dart index 4bc27e0..a9d4fa0 100644 --- a/lib/ui_components/messages/messages.dart +++ b/lib/ui_components/messages/messages.dart @@ -48,7 +48,6 @@ class _MessageScreenState extends State { ), ]; - List inboxMessagesColor = [null, null, null, null]; List inboxMessagesIndex = [52, 53, 54, 55]; final List bubbleChat = [ @@ -66,7 +65,6 @@ class _MessageScreenState extends State { ), ]; - List bubbleChatColor = [null, null, null, null]; List bubbleChatIndex = [56, 57, 58, 59]; @override @@ -113,13 +111,14 @@ class _MessageScreenState extends State { GestureDetector( onTap: () { favProviderModel.add(bubbleChatIndex[index]); - setState(() { - bubbleChatColor[index] = Colors.amber; - }); + setState(() {}); }, child: Icon( Icons.star_border_outlined, - color: bubbleChatColor[index], + color: (favProviderModel + .starred(bubbleChatIndex[index])) + ? Colors.amber + : null, ), ), ], @@ -167,13 +166,14 @@ class _MessageScreenState extends State { GestureDetector( onTap: () { favProviderModel.add(inboxMessagesIndex[index]); - setState(() { - inboxMessagesColor[index] = Colors.amber; - }); + setState(() {}); }, child: Icon( Icons.star_border_outlined, - color: inboxMessagesColor[index], + color: (favProviderModel + .starred(inboxMessagesIndex[index])) + ? Colors.amber + : null, ), ), ], diff --git a/lib/ui_components/pricing_cards/pricing_cards.dart b/lib/ui_components/pricing_cards/pricing_cards.dart index a0c8754..1ce8a8d 100644 --- a/lib/ui_components/pricing_cards/pricing_cards.dart +++ b/lib/ui_components/pricing_cards/pricing_cards.dart @@ -30,7 +30,6 @@ class _PricingCardScreenState extends State { buttonTextColor: Color(0xff0f172a), ), ]; - List pricingCardsColor = [null]; List pricingCardsIndex = [60]; @override @@ -77,13 +76,14 @@ class _PricingCardScreenState extends State { onTap: () { favProviderModel .add(pricingCardsIndex[index]); - setState(() { - pricingCardsColor[index] = Colors.amber; - }); + setState(() {}); }, child: Icon( Icons.star_border_outlined, - color: pricingCardsColor[index], + color: (favProviderModel + .starred(pricingCardsIndex[index])) + ? Colors.amber + : null, ), ), ], diff --git a/lib/ui_components/segmented_controls/segmented_controls.dart b/lib/ui_components/segmented_controls/all_segmented_controls/segmented_controls.dart similarity index 100% rename from lib/ui_components/segmented_controls/segmented_controls.dart rename to lib/ui_components/segmented_controls/all_segmented_controls/segmented_controls.dart diff --git a/lib/ui_components/segmented_controls/segmented_control_screen.dart b/lib/ui_components/segmented_controls/segmented_control_screen.dart index 511cfa9..07637b8 100644 --- a/lib/ui_components/segmented_controls/segmented_control_screen.dart +++ b/lib/ui_components/segmented_controls/segmented_control_screen.dart @@ -2,7 +2,7 @@ import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; import '../../provider/favorite_provider.dart'; import '../../theme/theme.dart'; -import 'segmented_controls.dart'; +import 'all_segmented_controls/segmented_controls.dart'; class SegmentedControlScreen extends StatefulWidget { const SegmentedControlScreen({super.key}); @@ -25,184 +25,144 @@ class _SegmentedControlScreenState extends State { 1: buildSegment("Text", color), 2: buildSegment("Text", color), }; - List segmentedControlFavColor = [null, null, null, null]; - List segmentedControlFavIndex = [61, 62, 63, 64]; + List segmentedLightControl = [ + Center( + child: RectangularSelections( + values: const ['Text', 'Text', 'Text'], + onSelected: (index) {}, + ), + ), + Center( + child: RadioChips( + values: const ['Text', 'Text', 'Text'], + onSelected: (index) {}, + ), + ), + ]; + List segmentedControlDark = [ + Center( + child: SegmentedControlWidget( + choices: choices1, + ), + ), + Center( + child: SegmentedControlWidget( + choices: choices, + ), + ), + ]; + List segmentedControlLightFavIndex = [61, 62]; + List segmentedControlDarkFavIndex = [63, 64]; return Scaffold( body: Column( mainAxisAlignment: MainAxisAlignment.center, children: [ - Consumer( - builder: (context, favProviderModel, child) => Column( - children: [ - Align( - alignment: Alignment.centerLeft, - child: Padding( - padding: const EdgeInsets.all(8.0), - child: Text("Segment Control Light Mode", - style: TextStyle( - fontSize: 20, - fontWeight: FontWeight.bold, - color: MyTheme.lightBluishColor)), - ), - ), - Center( - child: RectangularSelections( - values: const ['Text', 'Text', 'Text'], - onSelected: (index) {}, - ), - ), - Padding( - padding: const EdgeInsets.fromLTRB(0, 3, 20, 3), - child: Row( - mainAxisAlignment: MainAxisAlignment.end, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - const Text('Add to favorite'), - const SizedBox( - width: 5, - ), - GestureDetector( - onTap: () { - favProviderModel.add(segmentedControlFavIndex[0]); - }, - child: Icon( - Icons.star_border_outlined, - color: segmentedControlFavColor[3], - ), - ), - ], - ), - ), - ], + Align( + alignment: Alignment.centerLeft, + child: Text( + "Segment Control Light Mode", + style: TextStyle( + fontSize: 20, + fontWeight: FontWeight.bold, + color: MyTheme.lightBluishColor), ), ), - const SizedBox( - height: 20, - ), - Consumer( - builder: (context, favProviderModel, child) => Column( - children: [ - Center( - child: RadioChips( - values: const ['Text', 'Text', 'Text'], - onSelected: (index) {}, - ), - ), - Padding( - padding: const EdgeInsets.fromLTRB(0, 3, 20, 3), - child: Row( - mainAxisAlignment: MainAxisAlignment.end, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - const Text('Add to favorite'), - const SizedBox( - width: 5, + const SizedBox(height: 10), + Wrap( + direction: Axis.horizontal, + children: List.generate( + segmentedLightControl.length, + (index) => Consumer( + builder: (context, favProviderModel, child) => Column( + children: [ + Padding( + padding: const EdgeInsets.all(8.0), + child: segmentedLightControl[index], + ), + Padding( + padding: const EdgeInsets.fromLTRB(0, 3, 20, 3), + child: Row( + mainAxisAlignment: MainAxisAlignment.end, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + const Text('Add to favorite'), + const SizedBox( + width: 5, + ), + GestureDetector( + onTap: () { + favProviderModel + .add(segmentedControlLightFavIndex[index]); + setState(() {}); + }, + child: Icon( + Icons.star_border_outlined, + color: (favProviderModel.starred( + segmentedControlLightFavIndex[index])) + ? Colors.amber + : null, + ), + ), + ], ), - GestureDetector( - onTap: () { - favProviderModel.add(segmentedControlFavIndex[1]); - setState(() { - segmentedControlFavColor[2] = Colors.amber; - }); - }, - child: Icon( - Icons.star_border_outlined, - color: segmentedControlFavColor[2], - ), - ), - ], - ), + ), + ], ), - ], + ), ), ), - const SizedBox( - height: 20, - ), - Consumer( - builder: (context, favProviderModel, child) => Column( - children: [ - Align( - alignment: Alignment.centerLeft, - child: Padding( - padding: const EdgeInsets.all(8.0), - child: Text("Segment Control Dark Mode", - style: TextStyle( - fontSize: 20, - fontWeight: FontWeight.bold, - color: MyTheme.lightBluishColor)), - ), - ), - Center( - child: SegmentedControlWidget( - choices: choices1, - ), - ), - Padding( - padding: const EdgeInsets.fromLTRB(0, 3, 20, 3), - child: Row( - mainAxisAlignment: MainAxisAlignment.end, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - const Text('Add to favorite'), - const SizedBox( - width: 5, - ), - GestureDetector( - onTap: () { - favProviderModel.add(segmentedControlFavIndex[2]); - setState(() { - segmentedControlFavColor[0] = Colors.amber; - }); - }, - child: Icon( - Icons.star_border_outlined, - color: segmentedControlFavColor[0], - ), - ), - ], - ), - ), - ], + Align( + alignment: Alignment.centerLeft, + child: Text( + "Segment Control Dark Mode", + style: TextStyle( + fontSize: 20, + fontWeight: FontWeight.bold, + color: MyTheme.lightBluishColor), ), ), - const SizedBox( - height: 20, - ), - Consumer( - builder: (context, favProviderModel, child) => Column( - children: [ - Center( - child: SegmentedControlWidget( - choices: choices, - ), - ), - Padding( - padding: const EdgeInsets.fromLTRB(0, 3, 20, 3), - child: Row( - mainAxisAlignment: MainAxisAlignment.end, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - const Text('Add to favorite'), - const SizedBox( - width: 5, - ), - GestureDetector( - onTap: () { - favProviderModel.add(segmentedControlFavIndex[3]); - setState(() { - segmentedControlFavColor[1] = Colors.amber; - }); - }, - child: Icon( - Icons.star_border_outlined, - color: segmentedControlFavColor[1], - ), + const SizedBox(height: 10), + Wrap( + direction: Axis.horizontal, + children: List.generate( + segmentedControlDark.length, + (index) => Consumer( + builder: (context, favProviderModel, child) => Column( + children: [ + Padding( + padding: const EdgeInsets.all(8.0), + child: segmentedControlDark[index], + ), + Padding( + padding: const EdgeInsets.fromLTRB(0, 3, 20, 3), + child: Row( + mainAxisAlignment: MainAxisAlignment.end, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + const Text('Add to favorite'), + const SizedBox( + width: 5, + ), + GestureDetector( + onTap: () { + favProviderModel + .add(segmentedControlDarkFavIndex[index]); + setState(() {}); + }, + child: Icon( + Icons.star_border_outlined, + color: (favProviderModel.starred( + segmentedControlDarkFavIndex[index])) + ? Colors.amber + : null, + ), + ), + ], ), - ], - ), + ), + ], ), - ], + ), ), ), ], diff --git a/lib/ui_components/sliders/sliders.dart b/lib/ui_components/sliders/sliders.dart index fcd6638..bdaab61 100644 --- a/lib/ui_components/sliders/sliders.dart +++ b/lib/ui_components/sliders/sliders.dart @@ -23,7 +23,6 @@ class _SliderScreenState extends State { maxRange: 100, ), ]; - List dualPointSliderColor = [null]; List dualPointSliderIndex = [46]; final List singlePointSlider = [ @@ -43,7 +42,6 @@ class _SliderScreenState extends State { maxRange: 100, ), ]; - List singlePointSliderColor = [null, null, null, null, null]; List singlePointSliderIndex = [47, 48, 49, 50, 51]; @override @@ -86,13 +84,14 @@ class _SliderScreenState extends State { onTap: () { favProviderModel .add(singlePointSliderIndex[index]); - setState(() { - singlePointSliderColor[index] = Colors.amber; - }); + setState(() {}); }, child: Icon( Icons.star_border_outlined, - color: singlePointSliderColor[index], + color: (favProviderModel + .starred(singlePointSliderIndex[index])) + ? Colors.amber + : null, ), ), ], @@ -135,13 +134,14 @@ class _SliderScreenState extends State { onTap: () { favProviderModel .add(dualPointSliderIndex[index]); - setState(() { - dualPointSliderColor[index] = Colors.amber; - }); + setState(() {}); }, child: Icon( Icons.star_border_outlined, - color: dualPointSliderColor[index], + color: (favProviderModel + .starred(dualPointSliderIndex[index])) + ? Colors.amber + : null, ), ), ], From cb53aaec2f4eaa48dcfbbe5b72d16b7291376719 Mon Sep 17 00:00:00 2001 From: Uttkarsh-raj Date: Wed, 7 Jun 2023 14:46:19 +0530 Subject: [PATCH 4/6] added new stepper widgets to be able to favs --- lib/data/widget_category.dart | 2 +- .../bottom_navbars/bottom_navbars.dart | 582 +++++++++--------- lib/ui_components/radios/radios.dart | 64 +- lib/ui_components/steppers/steppers.dart | 74 ++- 4 files changed, 407 insertions(+), 315 deletions(-) diff --git a/lib/data/widget_category.dart b/lib/data/widget_category.dart index e0babbd..cd784d1 100644 --- a/lib/data/widget_category.dart +++ b/lib/data/widget_category.dart @@ -28,7 +28,7 @@ final List> widgetCategoryData = [ }, { 'categoryName': 'Bottom Navigation Bars', - 'categoryScreen': const BottomNavBarScreen(), + // 'categoryScreen': const BottomNavBarScreen(), }, { 'categoryName': 'Avatars', diff --git a/lib/ui_components/bottom_navbars/bottom_navbars.dart b/lib/ui_components/bottom_navbars/bottom_navbars.dart index 30b2888..4d726e9 100644 --- a/lib/ui_components/bottom_navbars/bottom_navbars.dart +++ b/lib/ui_components/bottom_navbars/bottom_navbars.dart @@ -1,297 +1,297 @@ -import 'package:flutter/material.dart'; -import 'package:flutter_component_ui/provider/favorite_provider.dart'; -import 'package:provider/provider.dart'; -import '../../theme/theme.dart'; -import 'allBottomNavigationBars/animated_navbar/bottom_navbar4.dart'; -import 'allBottomNavigationBars/basic_navbars/bottom_navbar1.dart'; -import 'allBottomNavigationBars/basic_navbars/bottom_navbar2.dart'; -import 'allBottomNavigationBars/fab_navbars/bottom_navbar3.dart'; -import 'allBottomNavigationBars/fab_navbars/bottom_navbar5.dart'; -import 'allBottomNavigationBars/fab_navbars/bottom_navbar6.dart'; +// import 'package:flutter/material.dart'; +// import 'package:flutter_component_ui/provider/favorite_provider.dart'; +// import 'package:provider/provider.dart'; +// import '../../theme/theme.dart'; +// import 'allBottomNavigationBars/animated_navbar/bottom_navbar4.dart'; +// import 'allBottomNavigationBars/basic_navbars/bottom_navbar1.dart'; +// import 'allBottomNavigationBars/basic_navbars/bottom_navbar2.dart'; +// import 'allBottomNavigationBars/fab_navbars/bottom_navbar3.dart'; +// import 'allBottomNavigationBars/fab_navbars/bottom_navbar5.dart'; +// import 'allBottomNavigationBars/fab_navbars/bottom_navbar6.dart'; -class BottomNavBarScreen extends StatefulWidget { - const BottomNavBarScreen({super.key}); +// class BottomNavBarScreen extends StatefulWidget { +// const BottomNavBarScreen({super.key}); - @override - State createState() => BottomNavBarScreenState(); -} +// @override +// State createState() => BottomNavBarScreenState(); +// } -class BottomNavBarScreenState extends State { - final basicbottomNavbar = [ - const Bottom_Navbar1(), - const Bottom_Navbar2(), - ]; - List basicbottomNavbarColor = [null, null]; +// class BottomNavBarScreenState extends State { +// final basicbottomNavbar = [ +// const Bottom_Navbar1(), +// const Bottom_Navbar2(), +// ]; +// List basicbottomNavbarIndex = [null, null]; - final fabbottomNavbar = [ - const Bottom_Navbar3(), - const Bottom_Navbar5(), - const Bottom_Navbar6(), - ]; - List fabbottomNavbarColor = [null, null, null]; +// final fabbottomNavbar = [ +// const Bottom_Navbar3(), +// const Bottom_Navbar5(), +// const Bottom_Navbar6(), +// ]; +// List fabbottomNavbarIndex = [null, null, null]; - final animatedbottomNavbar = [ - const Bottom_Navbar4(), - ]; - List animatedbottomNavbarColor = [null]; +// final animatedbottomNavbar = [ +// const Bottom_Navbar4(), +// ]; +// List animatedbottomNavbarIndex = [null]; - @override - Widget build(BuildContext context) { - return Scaffold( - body: SafeArea( - child: SingleChildScrollView( - child: Column( - // mainAxisAlignment: MainAxisAlignment.spaceEvenly, - children: [ - Align( - alignment: Alignment.centerLeft, - child: Padding( - padding: const EdgeInsets.all(8.0), - child: Text("Basic Bottom Nav-Bars", - style: TextStyle( - fontSize: 20, - fontWeight: FontWeight.bold, - color: MyTheme.lightBluishColor)), - ), - ), - Wrap( - direction: Axis.horizontal, - children: List.generate( - basicbottomNavbar.length, - (index) => Consumer( - builder: (context, favProviderModel, child) => Column( - children: [ - Container( - padding: const EdgeInsets.symmetric( - horizontal: 12, - vertical: 8, - ), - constraints: const BoxConstraints( - minWidth: 400.0, // Set the minimum width constraint - maxWidth: 500.0, // Set the maximum width constraint - minHeight: - 50.0, // Set the minimum height constraint - maxHeight: - 100.0, // Set the maximum height constraint - ), - child: basicbottomNavbar[index], - ), - Padding( - padding: const EdgeInsets.fromLTRB(0, 3, 20, 3), - child: Row( - mainAxisAlignment: MainAxisAlignment.end, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - const Text('Add to favorite'), - const SizedBox( - width: 5, - ), - GestureDetector( - onTap: () { - favProviderModel.add( - Container( - padding: const EdgeInsets.symmetric( - horizontal: 12, - vertical: 8, - ), - constraints: const BoxConstraints( - minWidth: - 400.0, // Set the minimum width constraint - maxWidth: - 500.0, // Set the maximum width constraint - minHeight: - 50.0, // Set the minimum height constraint - maxHeight: - 100.0, // Set the maximum height constraint - ), - child: basicbottomNavbar[index], - ), - ); - setState(() { - basicbottomNavbarColor[index] = - Colors.amber; - }); - }, - child: Icon( - Icons.star_border_outlined, - color: basicbottomNavbarColor[index], - ), - ), - ], - ), - ), - ], - ), - ), - ), - ), - Align( - alignment: Alignment.centerLeft, - child: Padding( - padding: const EdgeInsets.all(8.0), - child: Text("Animated Bottom Nav-Bars", - style: TextStyle( - fontSize: 20, - fontWeight: FontWeight.bold, - color: MyTheme.lightBluishColor)), - ), - ), - Wrap( - direction: Axis.horizontal, - children: List.generate( - animatedbottomNavbar.length, - (index) => Consumer( - builder: (context, favProviderModel, child) => Column( - children: [ - Container( - padding: const EdgeInsets.symmetric( - horizontal: 12, - vertical: 8, - ), - constraints: const BoxConstraints( - minWidth: 400.0, // Set the minimum width constraint - maxWidth: 500.0, // Set the maximum width constraint - minHeight: - 50.0, // Set the minimum height constraint - maxHeight: - 100.0, // Set the maximum height constraint - ), - child: animatedbottomNavbar[index], - ), - Padding( - padding: const EdgeInsets.fromLTRB(0, 3, 20, 3), - child: Row( - mainAxisAlignment: MainAxisAlignment.end, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - const Text('Add to favorite'), - const SizedBox( - width: 5, - ), - GestureDetector( - onTap: () { - favProviderModel.add( - Container( - padding: const EdgeInsets.symmetric( - horizontal: 12, - vertical: 8, - ), - constraints: const BoxConstraints( - minWidth: - 400.0, // Set the minimum width constraint - maxWidth: - 500.0, // Set the maximum width constraint - minHeight: - 50.0, // Set the minimum height constraint - maxHeight: - 100.0, // Set the maximum height constraint - ), - child: animatedbottomNavbar[index], - ), - ); - setState(() { - animatedbottomNavbarColor[index] = - Colors.amber; - }); - }, - child: Icon( - Icons.star_border_outlined, - color: animatedbottomNavbarColor[index], - ), - ), - ], - ), - ), - ], - ), - ), - ), - ), - Align( - alignment: Alignment.centerLeft, - child: Padding( - padding: const EdgeInsets.all(8.0), - child: Text("FAB Bottom Nav-Bars", - style: TextStyle( - fontSize: 20, - fontWeight: FontWeight.bold, - color: MyTheme.lightBluishColor)), - ), - ), - Wrap( - direction: Axis.horizontal, - children: List.generate( - fabbottomNavbar.length, - (index) => Consumer( - builder: (context, favProviderModel, child) => Column( - children: [ - Container( - padding: const EdgeInsets.symmetric( - horizontal: 12, - vertical: 8, - ), - constraints: const BoxConstraints( - minWidth: 400.0, // Set the minimum width constraint - maxWidth: 500.0, // Set the maximum width constraint - minHeight: - 50.0, // Set the minimum height constraint - maxHeight: - 100.0, // Set the maximum height constraint - ), - child: fabbottomNavbar[index], - ), - Padding( - padding: const EdgeInsets.fromLTRB(0, 3, 20, 3), - child: Row( - mainAxisAlignment: MainAxisAlignment.end, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - const Text('Add to favorite'), - const SizedBox( - width: 5, - ), - GestureDetector( - onTap: () { - favProviderModel.add( - Container( - padding: const EdgeInsets.symmetric( - horizontal: 12, - vertical: 8, - ), - constraints: const BoxConstraints( - minWidth: - 400.0, // Set the minimum width constraint - maxWidth: - 500.0, // Set the maximum width constraint - minHeight: - 50.0, // Set the minimum height constraint - maxHeight: - 100.0, // Set the maximum height constraint - ), - child: fabbottomNavbar[index], - ), - ); - setState(() { - fabbottomNavbarColor[index] = Colors.amber; - }); - }, - child: Icon( - Icons.star_border_outlined, - color: fabbottomNavbarColor[index], - ), - ), - ], - ), - ), - ], - ), - ), - ), - ), - ], - ), - ), - ), - ); - } -} +// @override +// Widget build(BuildContext context) { +// return Scaffold( +// body: SafeArea( +// child: SingleChildScrollView( +// child: Column( +// // mainAxisAlignment: MainAxisAlignment.spaceEvenly, +// children: [ +// Align( +// alignment: Alignment.centerLeft, +// child: Padding( +// padding: const EdgeInsets.all(8.0), +// child: Text("Basic Bottom Nav-Bars", +// style: TextStyle( +// fontSize: 20, +// fontWeight: FontWeight.bold, +// color: MyTheme.lightBluishColor)), +// ), +// ), +// Wrap( +// direction: Axis.horizontal, +// children: List.generate( +// basicbottomNavbar.length, +// (index) => Consumer( +// builder: (context, favProviderModel, child) => Column( +// children: [ +// Container( +// padding: const EdgeInsets.symmetric( +// horizontal: 12, +// vertical: 8, +// ), +// constraints: const BoxConstraints( +// minWidth: 400.0, // Set the minimum width constraint +// maxWidth: 500.0, // Set the maximum width constraint +// minHeight: +// 50.0, // Set the minimum height constraint +// maxHeight: +// 100.0, // Set the maximum height constraint +// ), +// child: basicbottomNavbar[index], +// ), +// Padding( +// padding: const EdgeInsets.fromLTRB(0, 3, 20, 3), +// child: Row( +// mainAxisAlignment: MainAxisAlignment.end, +// crossAxisAlignment: CrossAxisAlignment.start, +// children: [ +// const Text('Add to favorite'), +// const SizedBox( +// width: 5, +// ), +// GestureDetector( +// onTap: () { +// favProviderModel.add( +// Container( +// padding: const EdgeInsets.symmetric( +// horizontal: 12, +// vertical: 8, +// ), +// constraints: const BoxConstraints( +// minWidth: +// 400.0, // Set the minimum width constraint +// maxWidth: +// 500.0, // Set the maximum width constraint +// minHeight: +// 50.0, // Set the minimum height constraint +// maxHeight: +// 100.0, // Set the maximum height constraint +// ), +// child: basicbottomNavbar[index], +// ), +// ); +// setState(() { +// basicbottomNavbarColor[index] = +// Colors.amber; +// }); +// }, +// child: Icon( +// Icons.star_border_outlined, +// color: basicbottomNavbarColor[index], +// ), +// ), +// ], +// ), +// ), +// ], +// ), +// ), +// ), +// ), +// Align( +// alignment: Alignment.centerLeft, +// child: Padding( +// padding: const EdgeInsets.all(8.0), +// child: Text("Animated Bottom Nav-Bars", +// style: TextStyle( +// fontSize: 20, +// fontWeight: FontWeight.bold, +// color: MyTheme.lightBluishColor)), +// ), +// ), +// Wrap( +// direction: Axis.horizontal, +// children: List.generate( +// animatedbottomNavbar.length, +// (index) => Consumer( +// builder: (context, favProviderModel, child) => Column( +// children: [ +// Container( +// padding: const EdgeInsets.symmetric( +// horizontal: 12, +// vertical: 8, +// ), +// constraints: const BoxConstraints( +// minWidth: 400.0, // Set the minimum width constraint +// maxWidth: 500.0, // Set the maximum width constraint +// minHeight: +// 50.0, // Set the minimum height constraint +// maxHeight: +// 100.0, // Set the maximum height constraint +// ), +// child: animatedbottomNavbar[index], +// ), +// Padding( +// padding: const EdgeInsets.fromLTRB(0, 3, 20, 3), +// child: Row( +// mainAxisAlignment: MainAxisAlignment.end, +// crossAxisAlignment: CrossAxisAlignment.start, +// children: [ +// const Text('Add to favorite'), +// const SizedBox( +// width: 5, +// ), +// GestureDetector( +// onTap: () { +// favProviderModel.add( +// Container( +// padding: const EdgeInsets.symmetric( +// horizontal: 12, +// vertical: 8, +// ), +// constraints: const BoxConstraints( +// minWidth: +// 400.0, // Set the minimum width constraint +// maxWidth: +// 500.0, // Set the maximum width constraint +// minHeight: +// 50.0, // Set the minimum height constraint +// maxHeight: +// 100.0, // Set the maximum height constraint +// ), +// child: animatedbottomNavbar[index], +// ), +// ); +// setState(() { +// animatedbottomNavbarColor[index] = +// Colors.amber; +// }); +// }, +// child: Icon( +// Icons.star_border_outlined, +// color: animatedbottomNavbarColor[index], +// ), +// ), +// ], +// ), +// ), +// ], +// ), +// ), +// ), +// ), +// Align( +// alignment: Alignment.centerLeft, +// child: Padding( +// padding: const EdgeInsets.all(8.0), +// child: Text("FAB Bottom Nav-Bars", +// style: TextStyle( +// fontSize: 20, +// fontWeight: FontWeight.bold, +// color: MyTheme.lightBluishColor)), +// ), +// ), +// Wrap( +// direction: Axis.horizontal, +// children: List.generate( +// fabbottomNavbar.length, +// (index) => Consumer( +// builder: (context, favProviderModel, child) => Column( +// children: [ +// Container( +// padding: const EdgeInsets.symmetric( +// horizontal: 12, +// vertical: 8, +// ), +// constraints: const BoxConstraints( +// minWidth: 400.0, // Set the minimum width constraint +// maxWidth: 500.0, // Set the maximum width constraint +// minHeight: +// 50.0, // Set the minimum height constraint +// maxHeight: +// 100.0, // Set the maximum height constraint +// ), +// child: fabbottomNavbar[index], +// ), +// Padding( +// padding: const EdgeInsets.fromLTRB(0, 3, 20, 3), +// child: Row( +// mainAxisAlignment: MainAxisAlignment.end, +// crossAxisAlignment: CrossAxisAlignment.start, +// children: [ +// const Text('Add to favorite'), +// const SizedBox( +// width: 5, +// ), +// GestureDetector( +// onTap: () { +// favProviderModel.add( +// Container( +// padding: const EdgeInsets.symmetric( +// horizontal: 12, +// vertical: 8, +// ), +// constraints: const BoxConstraints( +// minWidth: +// 400.0, // Set the minimum width constraint +// maxWidth: +// 500.0, // Set the maximum width constraint +// minHeight: +// 50.0, // Set the minimum height constraint +// maxHeight: +// 100.0, // Set the maximum height constraint +// ), +// child: fabbottomNavbar[index], +// ), +// ); +// setState(() { +// fabbottomNavbarColor[index] = Colors.amber; +// }); +// }, +// child: Icon( +// Icons.star_border_outlined, +// color: fabbottomNavbarColor[index], +// ), +// ), +// ], +// ), +// ), +// ], +// ), +// ), +// ), +// ), +// ], +// ), +// ), +// ), +// ); +// } +// } diff --git a/lib/ui_components/radios/radios.dart b/lib/ui_components/radios/radios.dart index 87bb95f..cef141b 100644 --- a/lib/ui_components/radios/radios.dart +++ b/lib/ui_components/radios/radios.dart @@ -3,6 +3,9 @@ import 'package:flutter_component_ui/ui_components/radios/radio_widgets/basic_ra import 'package:flutter_component_ui/ui_components/radios/radio_widgets/radio_button_with_custom_color.dart'; import 'package:flutter_component_ui/ui_components/radios/radio_widgets/radio_button_with_horizontal_layout.dart'; import 'package:flutter_component_ui/ui_components/radios/radio_widgets/radio_button_with_text_and_styles.dart'; +import 'package:provider/provider.dart'; + +import '../../provider/favorite_provider.dart'; class RadioScreen extends StatefulWidget { const RadioScreen({super.key}); @@ -26,17 +29,56 @@ class _RadioScreenState extends State { return Scaffold( body: SingleChildScrollView( child: SafeArea( - child: Column(children: [ - Wrap( - direction: Axis.horizontal, - children: List.generate( - radios.length, - (index) => Padding( - padding: const EdgeInsets.all(8.0), - child: radios[index], - )), - ), - ]), + child: Column( + children: [ + Wrap( + direction: Axis.horizontal, + children: List.generate( + radiosIndex.length, + (index) => Consumer( + builder: (context, favProviderModel, child) => Column( + children: [ + Container( + padding: const EdgeInsets.symmetric( + horizontal: 12, + vertical: 8, + ), + width: double.infinity, + child: radios[index], + ), + Padding( + padding: const EdgeInsets.fromLTRB(0, 3, 20, 3), + child: Row( + mainAxisAlignment: MainAxisAlignment.end, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + const Text('Add to favorite'), + const SizedBox( + width: 5, + ), + GestureDetector( + onTap: () { + favProviderModel.add(radiosIndex[index]); + setState(() {}); + }, + child: Icon( + Icons.star_border_outlined, + color: (favProviderModel + .starred(radiosIndex[index])) + ? Colors.amber + : null, + ), + ), + ], + ), + ), + ], + ), + ), + ), + ), + ], + ), ), ), ); diff --git a/lib/ui_components/steppers/steppers.dart b/lib/ui_components/steppers/steppers.dart index 85bf43b..d3830b6 100644 --- a/lib/ui_components/steppers/steppers.dart +++ b/lib/ui_components/steppers/steppers.dart @@ -3,32 +3,82 @@ import 'package:flutter_component_ui/ui_components/steppers/steppers_widgets/bas import 'package:flutter_component_ui/ui_components/steppers/steppers_widgets/stepper_with_custom_color.dart'; import 'package:flutter_component_ui/ui_components/steppers/steppers_widgets/stepper_with_custom_icon.dart'; import 'package:flutter_component_ui/ui_components/steppers/steppers_widgets/stepper_with_validation.dart'; +import 'package:provider/provider.dart'; +import '../../provider/favorite_provider.dart'; -class StepperScreen extends StatelessWidget { +class StepperScreen extends StatefulWidget { StepperScreen({super.key}); + + @override + State createState() => _StepperScreenState(); +} + +class _StepperScreenState extends State { final List steppers = [ const BasicStepper(), const StepperwihCustomIcon(), const StepperwithValidation(), const StepperwithCustomColor(), ]; + + List stepperIndex = [70, 71, 72, 73]; + @override Widget build(BuildContext context) { return Scaffold( body: SingleChildScrollView( child: SafeArea( - child: Column(children: [ - Wrap( - direction: Axis.horizontal, - children: List.generate( - steppers.length, - (index) => Padding( - padding: const EdgeInsets.all(8.0), - child: steppers[index], - )), - ), - ]), + child: Column( + children: [ + Wrap( + direction: Axis.horizontal, + children: List.generate( + stepperIndex.length, + (index) => Consumer( + builder: (context, favProviderModel, child) => Column( + children: [ + Container( + padding: const EdgeInsets.symmetric( + horizontal: 12, + vertical: 8, + ), + width: double.infinity, + child: steppers[index], + ), + Padding( + padding: const EdgeInsets.fromLTRB(0, 3, 20, 3), + child: Row( + mainAxisAlignment: MainAxisAlignment.end, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + const Text('Add to favorite'), + const SizedBox( + width: 5, + ), + GestureDetector( + onTap: () { + favProviderModel.add(stepperIndex[index]); + setState(() {}); + }, + child: Icon( + Icons.star_border_outlined, + color: (favProviderModel + .starred(stepperIndex[index])) + ? Colors.amber + : null, + ), + ), + ], + ), + ), + ], + ), + ), + ), + ), + ], + ), ), ), ); From 0767614197aab33827ff6b467834c2531fce88b1 Mon Sep 17 00:00:00 2001 From: Uttkarsh-raj Date: Wed, 7 Jun 2023 15:03:14 +0530 Subject: [PATCH 5/6] added new bottom nav to fav and new function to the provider --- lib/data/export.dart | 11 + lib/data/widget_category.dart | 2 +- lib/provider/favorite_provider.dart | 138 ++++- .../bottom_navbars/bottom_navbars.dart | 532 ++++++++---------- 4 files changed, 390 insertions(+), 293 deletions(-) diff --git a/lib/data/export.dart b/lib/data/export.dart index 6390682..f5ddfd6 100644 --- a/lib/data/export.dart +++ b/lib/data/export.dart @@ -59,3 +59,14 @@ export '../../ui_components/radios/radio_widgets/basic_radio_button.dart'; export '../../ui_components/radios/radio_widgets/radio_button_with_custom_color.dart'; export '../../ui_components/radios/radio_widgets/radio_button_with_horizontal_layout.dart'; export '../../ui_components/radios/radio_widgets/radio_button_with_text_and_styles.dart'; +export '../ui_components/steppers/steppers_widgets/basic_stepper.dart'; +export '../ui_components/steppers/steppers_widgets/stepper_with_custom_color.dart'; +export '../ui_components/steppers/steppers_widgets/stepper_with_custom_icon.dart'; +export '../ui_components/steppers/steppers_widgets/stepper_with_validation.dart'; +export '../ui_components/alerts/all_alerts/dark_mode_alert/alert12.dart'; +export '../ui_components/bottom_navbars/allBottomNavigationBars/animated_navbar/bottom_navbar4.dart'; +export '../ui_components/bottom_navbars/allBottomNavigationBars/basic_navbars/bottom_navbar1.dart'; +export '../ui_components/bottom_navbars/allBottomNavigationBars/basic_navbars/bottom_navbar2.dart'; +export '../ui_components/bottom_navbars/allBottomNavigationBars/fab_navbars/bottom_navbar3.dart'; +export '../ui_components/bottom_navbars/allBottomNavigationBars/fab_navbars/bottom_navbar5.dart'; +export '../ui_components/bottom_navbars/allBottomNavigationBars/fab_navbars/bottom_navbar6.dart'; diff --git a/lib/data/widget_category.dart b/lib/data/widget_category.dart index cd784d1..e0babbd 100644 --- a/lib/data/widget_category.dart +++ b/lib/data/widget_category.dart @@ -28,7 +28,7 @@ final List> widgetCategoryData = [ }, { 'categoryName': 'Bottom Navigation Bars', - // 'categoryScreen': const BottomNavBarScreen(), + 'categoryScreen': const BottomNavBarScreen(), }, { 'categoryName': 'Avatars', diff --git a/lib/provider/favorite_provider.dart b/lib/provider/favorite_provider.dart index 81ca85e..84b317f 100644 --- a/lib/provider/favorite_provider.dart +++ b/lib/provider/favorite_provider.dart @@ -2,7 +2,6 @@ import 'package:flutter/material.dart'; import 'package:flutter_component_ui/data/hive_database.dart'; import '../data/export.dart'; -import '../ui_components/alerts/all_alerts/dark_mode_alert/alert12.dart'; import '../ui_components/messages/all_messages/bubble_message/message_2.dart'; import '../ui_components/messages/all_messages/bubble_message/message_3.dart'; import '../ui_components/messages/all_messages/bubble_message/message_4.dart'; @@ -507,6 +506,143 @@ class FavoritesProvider extends ChangeNotifier { hightlightColor: Color(0xFF00C2CB), ), ), + 70: Padding( + padding: const EdgeInsets.symmetric(horizontal: 10, vertical: 8), + child: Container( + padding: const EdgeInsets.symmetric( + horizontal: 12, + vertical: 8, + ), + width: double.infinity, + child: const BasicStepper(), + ), + ), + 71: Padding( + padding: const EdgeInsets.symmetric(horizontal: 10, vertical: 8), + child: Container( + padding: const EdgeInsets.symmetric( + horizontal: 12, + vertical: 8, + ), + width: double.infinity, + child: const StepperwihCustomIcon(), + ), + ), + 72: Padding( + padding: const EdgeInsets.symmetric(horizontal: 10, vertical: 8), + child: Container( + padding: const EdgeInsets.symmetric( + horizontal: 12, + vertical: 8, + ), + width: double.infinity, + child: const StepperwithValidation(), + ), + ), + 73: Padding( + padding: const EdgeInsets.symmetric(horizontal: 10, vertical: 8), + child: Container( + padding: const EdgeInsets.symmetric( + horizontal: 12, + vertical: 8, + ), + width: double.infinity, + child: const StepperwithCustomColor(), + ), + ), + 74: Padding( + padding: const EdgeInsets.symmetric(horizontal: 10, vertical: 8), + child: Container( + padding: const EdgeInsets.symmetric( + horizontal: 12, + vertical: 8, + ), + constraints: const BoxConstraints( + minWidth: 400.0, + maxWidth: 500.0, + minHeight: 50.0, + maxHeight: 100.0, + ), + child: const Bottom_Navbar1(), + ), + ), + 75: Padding( + padding: const EdgeInsets.symmetric(horizontal: 10, vertical: 8), + child: Container( + padding: const EdgeInsets.symmetric( + horizontal: 12, + vertical: 8, + ), + constraints: const BoxConstraints( + minWidth: 400.0, + maxWidth: 500.0, + minHeight: 50.0, + maxHeight: 100.0, + ), + child: const Bottom_Navbar2(), + ), + ), + 76: Padding( + padding: const EdgeInsets.symmetric(horizontal: 10, vertical: 8), + child: Container( + padding: const EdgeInsets.symmetric( + horizontal: 12, + vertical: 8, + ), + constraints: const BoxConstraints( + minWidth: 400.0, + maxWidth: 500.0, + minHeight: 50.0, + maxHeight: 100.0, + ), + child: const Bottom_Navbar3(), + ), + ), + 77: Padding( + padding: const EdgeInsets.symmetric(horizontal: 10, vertical: 8), + child: Container( + padding: const EdgeInsets.symmetric( + horizontal: 12, + vertical: 8, + ), + constraints: const BoxConstraints( + minWidth: 400.0, + maxWidth: 500.0, + minHeight: 50.0, + maxHeight: 100.0, + ), + child: const Bottom_Navbar5(), + ), + ), + 78: Padding( + padding: const EdgeInsets.symmetric(horizontal: 10, vertical: 8), + child: Container( + padding: const EdgeInsets.symmetric( + horizontal: 12, + vertical: 8, + ), + constraints: const BoxConstraints( + minWidth: 400.0, + maxWidth: 500.0, + minHeight: 50.0, + maxHeight: 100.0, + ), + child: const Bottom_Navbar6(), + ), + ), + 79: Container( + padding: const EdgeInsets.symmetric( + horizontal: 12, + vertical: 8, + ), + constraints: const BoxConstraints( + minWidth: 400.0, + maxWidth: 500.0, + minHeight: 50.0, + maxHeight: 100.0, + ), + child: const Bottom_Navbar4(), + ), }; final db = HiveDatabase(); diff --git a/lib/ui_components/bottom_navbars/bottom_navbars.dart b/lib/ui_components/bottom_navbars/bottom_navbars.dart index 4d726e9..3bd08dd 100644 --- a/lib/ui_components/bottom_navbars/bottom_navbars.dart +++ b/lib/ui_components/bottom_navbars/bottom_navbars.dart @@ -1,297 +1,247 @@ -// import 'package:flutter/material.dart'; -// import 'package:flutter_component_ui/provider/favorite_provider.dart'; -// import 'package:provider/provider.dart'; -// import '../../theme/theme.dart'; -// import 'allBottomNavigationBars/animated_navbar/bottom_navbar4.dart'; -// import 'allBottomNavigationBars/basic_navbars/bottom_navbar1.dart'; -// import 'allBottomNavigationBars/basic_navbars/bottom_navbar2.dart'; -// import 'allBottomNavigationBars/fab_navbars/bottom_navbar3.dart'; -// import 'allBottomNavigationBars/fab_navbars/bottom_navbar5.dart'; -// import 'allBottomNavigationBars/fab_navbars/bottom_navbar6.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_component_ui/provider/favorite_provider.dart'; +import 'package:provider/provider.dart'; +import '../../theme/theme.dart'; +import 'allBottomNavigationBars/animated_navbar/bottom_navbar4.dart'; +import 'allBottomNavigationBars/basic_navbars/bottom_navbar1.dart'; +import 'allBottomNavigationBars/basic_navbars/bottom_navbar2.dart'; +import 'allBottomNavigationBars/fab_navbars/bottom_navbar3.dart'; +import 'allBottomNavigationBars/fab_navbars/bottom_navbar5.dart'; +import 'allBottomNavigationBars/fab_navbars/bottom_navbar6.dart'; -// class BottomNavBarScreen extends StatefulWidget { -// const BottomNavBarScreen({super.key}); +class BottomNavBarScreen extends StatefulWidget { + const BottomNavBarScreen({super.key}); -// @override -// State createState() => BottomNavBarScreenState(); -// } + @override + State createState() => BottomNavBarScreenState(); +} -// class BottomNavBarScreenState extends State { -// final basicbottomNavbar = [ -// const Bottom_Navbar1(), -// const Bottom_Navbar2(), -// ]; -// List basicbottomNavbarIndex = [null, null]; +class BottomNavBarScreenState extends State { + final basicbottomNavbar = [ + const Bottom_Navbar1(), + const Bottom_Navbar2(), + ]; + List basicbottomNavbarIndex = [74, 75]; -// final fabbottomNavbar = [ -// const Bottom_Navbar3(), -// const Bottom_Navbar5(), -// const Bottom_Navbar6(), -// ]; -// List fabbottomNavbarIndex = [null, null, null]; + final fabbottomNavbar = [ + const Bottom_Navbar3(), + const Bottom_Navbar5(), + const Bottom_Navbar6(), + ]; + List fabbottomNavbarIndex = [76, 77, 78]; -// final animatedbottomNavbar = [ -// const Bottom_Navbar4(), -// ]; -// List animatedbottomNavbarIndex = [null]; + final animatedbottomNavbar = [ + const Bottom_Navbar4(), + ]; + List animatedbottomNavbarIndex = [79]; -// @override -// Widget build(BuildContext context) { -// return Scaffold( -// body: SafeArea( -// child: SingleChildScrollView( -// child: Column( -// // mainAxisAlignment: MainAxisAlignment.spaceEvenly, -// children: [ -// Align( -// alignment: Alignment.centerLeft, -// child: Padding( -// padding: const EdgeInsets.all(8.0), -// child: Text("Basic Bottom Nav-Bars", -// style: TextStyle( -// fontSize: 20, -// fontWeight: FontWeight.bold, -// color: MyTheme.lightBluishColor)), -// ), -// ), -// Wrap( -// direction: Axis.horizontal, -// children: List.generate( -// basicbottomNavbar.length, -// (index) => Consumer( -// builder: (context, favProviderModel, child) => Column( -// children: [ -// Container( -// padding: const EdgeInsets.symmetric( -// horizontal: 12, -// vertical: 8, -// ), -// constraints: const BoxConstraints( -// minWidth: 400.0, // Set the minimum width constraint -// maxWidth: 500.0, // Set the maximum width constraint -// minHeight: -// 50.0, // Set the minimum height constraint -// maxHeight: -// 100.0, // Set the maximum height constraint -// ), -// child: basicbottomNavbar[index], -// ), -// Padding( -// padding: const EdgeInsets.fromLTRB(0, 3, 20, 3), -// child: Row( -// mainAxisAlignment: MainAxisAlignment.end, -// crossAxisAlignment: CrossAxisAlignment.start, -// children: [ -// const Text('Add to favorite'), -// const SizedBox( -// width: 5, -// ), -// GestureDetector( -// onTap: () { -// favProviderModel.add( -// Container( -// padding: const EdgeInsets.symmetric( -// horizontal: 12, -// vertical: 8, -// ), -// constraints: const BoxConstraints( -// minWidth: -// 400.0, // Set the minimum width constraint -// maxWidth: -// 500.0, // Set the maximum width constraint -// minHeight: -// 50.0, // Set the minimum height constraint -// maxHeight: -// 100.0, // Set the maximum height constraint -// ), -// child: basicbottomNavbar[index], -// ), -// ); -// setState(() { -// basicbottomNavbarColor[index] = -// Colors.amber; -// }); -// }, -// child: Icon( -// Icons.star_border_outlined, -// color: basicbottomNavbarColor[index], -// ), -// ), -// ], -// ), -// ), -// ], -// ), -// ), -// ), -// ), -// Align( -// alignment: Alignment.centerLeft, -// child: Padding( -// padding: const EdgeInsets.all(8.0), -// child: Text("Animated Bottom Nav-Bars", -// style: TextStyle( -// fontSize: 20, -// fontWeight: FontWeight.bold, -// color: MyTheme.lightBluishColor)), -// ), -// ), -// Wrap( -// direction: Axis.horizontal, -// children: List.generate( -// animatedbottomNavbar.length, -// (index) => Consumer( -// builder: (context, favProviderModel, child) => Column( -// children: [ -// Container( -// padding: const EdgeInsets.symmetric( -// horizontal: 12, -// vertical: 8, -// ), -// constraints: const BoxConstraints( -// minWidth: 400.0, // Set the minimum width constraint -// maxWidth: 500.0, // Set the maximum width constraint -// minHeight: -// 50.0, // Set the minimum height constraint -// maxHeight: -// 100.0, // Set the maximum height constraint -// ), -// child: animatedbottomNavbar[index], -// ), -// Padding( -// padding: const EdgeInsets.fromLTRB(0, 3, 20, 3), -// child: Row( -// mainAxisAlignment: MainAxisAlignment.end, -// crossAxisAlignment: CrossAxisAlignment.start, -// children: [ -// const Text('Add to favorite'), -// const SizedBox( -// width: 5, -// ), -// GestureDetector( -// onTap: () { -// favProviderModel.add( -// Container( -// padding: const EdgeInsets.symmetric( -// horizontal: 12, -// vertical: 8, -// ), -// constraints: const BoxConstraints( -// minWidth: -// 400.0, // Set the minimum width constraint -// maxWidth: -// 500.0, // Set the maximum width constraint -// minHeight: -// 50.0, // Set the minimum height constraint -// maxHeight: -// 100.0, // Set the maximum height constraint -// ), -// child: animatedbottomNavbar[index], -// ), -// ); -// setState(() { -// animatedbottomNavbarColor[index] = -// Colors.amber; -// }); -// }, -// child: Icon( -// Icons.star_border_outlined, -// color: animatedbottomNavbarColor[index], -// ), -// ), -// ], -// ), -// ), -// ], -// ), -// ), -// ), -// ), -// Align( -// alignment: Alignment.centerLeft, -// child: Padding( -// padding: const EdgeInsets.all(8.0), -// child: Text("FAB Bottom Nav-Bars", -// style: TextStyle( -// fontSize: 20, -// fontWeight: FontWeight.bold, -// color: MyTheme.lightBluishColor)), -// ), -// ), -// Wrap( -// direction: Axis.horizontal, -// children: List.generate( -// fabbottomNavbar.length, -// (index) => Consumer( -// builder: (context, favProviderModel, child) => Column( -// children: [ -// Container( -// padding: const EdgeInsets.symmetric( -// horizontal: 12, -// vertical: 8, -// ), -// constraints: const BoxConstraints( -// minWidth: 400.0, // Set the minimum width constraint -// maxWidth: 500.0, // Set the maximum width constraint -// minHeight: -// 50.0, // Set the minimum height constraint -// maxHeight: -// 100.0, // Set the maximum height constraint -// ), -// child: fabbottomNavbar[index], -// ), -// Padding( -// padding: const EdgeInsets.fromLTRB(0, 3, 20, 3), -// child: Row( -// mainAxisAlignment: MainAxisAlignment.end, -// crossAxisAlignment: CrossAxisAlignment.start, -// children: [ -// const Text('Add to favorite'), -// const SizedBox( -// width: 5, -// ), -// GestureDetector( -// onTap: () { -// favProviderModel.add( -// Container( -// padding: const EdgeInsets.symmetric( -// horizontal: 12, -// vertical: 8, -// ), -// constraints: const BoxConstraints( -// minWidth: -// 400.0, // Set the minimum width constraint -// maxWidth: -// 500.0, // Set the maximum width constraint -// minHeight: -// 50.0, // Set the minimum height constraint -// maxHeight: -// 100.0, // Set the maximum height constraint -// ), -// child: fabbottomNavbar[index], -// ), -// ); -// setState(() { -// fabbottomNavbarColor[index] = Colors.amber; -// }); -// }, -// child: Icon( -// Icons.star_border_outlined, -// color: fabbottomNavbarColor[index], -// ), -// ), -// ], -// ), -// ), -// ], -// ), -// ), -// ), -// ), -// ], -// ), -// ), -// ), -// ); -// } -// } + @override + Widget build(BuildContext context) { + return Scaffold( + body: SafeArea( + child: SingleChildScrollView( + child: Column( + // mainAxisAlignment: MainAxisAlignment.spaceEvenly, + children: [ + Align( + alignment: Alignment.centerLeft, + child: Padding( + padding: const EdgeInsets.all(8.0), + child: Text("Basic Bottom Nav-Bars", + style: TextStyle( + fontSize: 20, + fontWeight: FontWeight.bold, + color: MyTheme.lightBluishColor)), + ), + ), + Wrap( + direction: Axis.horizontal, + children: List.generate( + basicbottomNavbarIndex.length, + (index) => Consumer( + builder: (context, favProviderModel, child) => Column( + children: [ + Container( + padding: const EdgeInsets.symmetric( + horizontal: 12, + vertical: 8, + ), + constraints: const BoxConstraints( + minWidth: 400.0, // Set the minimum width constraint + maxWidth: 500.0, // Set the maximum width constraint + minHeight: + 50.0, // Set the minimum height constraint + maxHeight: + 100.0, // Set the maximum height constraint + ), + child: basicbottomNavbar[index], + ), + Padding( + padding: const EdgeInsets.fromLTRB(0, 3, 20, 3), + child: Row( + mainAxisAlignment: MainAxisAlignment.end, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + const Text('Add to favorite'), + const SizedBox( + width: 5, + ), + GestureDetector( + onTap: () { + favProviderModel + .add(basicbottomNavbarIndex[index]); + setState(() {}); + }, + child: Icon( + Icons.star_border_outlined, + color: (favProviderModel.starred( + basicbottomNavbarIndex[index])) + ? Colors.amber + : null, + ), + ), + ], + ), + ), + ], + ), + ), + ), + ), + Align( + alignment: Alignment.centerLeft, + child: Padding( + padding: const EdgeInsets.all(8.0), + child: Text("Animated Bottom Nav-Bars", + style: TextStyle( + fontSize: 20, + fontWeight: FontWeight.bold, + color: MyTheme.lightBluishColor)), + ), + ), + Wrap( + direction: Axis.horizontal, + children: List.generate( + animatedbottomNavbarIndex.length, + (index) => Consumer( + builder: (context, favProviderModel, child) => Column( + children: [ + Container( + padding: const EdgeInsets.symmetric( + horizontal: 12, + vertical: 8, + ), + constraints: const BoxConstraints( + minWidth: 400.0, // Set the minimum width constraint + maxWidth: 500.0, // Set the maximum width constraint + minHeight: + 50.0, // Set the minimum height constraint + maxHeight: + 100.0, // Set the maximum height constraint + ), + child: animatedbottomNavbar[index], + ), + Padding( + padding: const EdgeInsets.fromLTRB(0, 3, 20, 3), + child: Row( + mainAxisAlignment: MainAxisAlignment.end, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + const Text('Add to favorite'), + const SizedBox( + width: 5, + ), + GestureDetector( + onTap: () { + favProviderModel + .add(animatedbottomNavbarIndex[index]); + setState(() {}); + }, + child: Icon( + Icons.star_border_outlined, + color: (favProviderModel.starred( + animatedbottomNavbarIndex[index])) + ? Colors.amber + : null, + ), + ), + ], + ), + ), + ], + ), + ), + ), + ), + Align( + alignment: Alignment.centerLeft, + child: Padding( + padding: const EdgeInsets.all(8.0), + child: Text("FAB Bottom Nav-Bars", + style: TextStyle( + fontSize: 20, + fontWeight: FontWeight.bold, + color: MyTheme.lightBluishColor)), + ), + ), + Wrap( + direction: Axis.horizontal, + children: List.generate( + fabbottomNavbarIndex.length, + (index) => Consumer( + builder: (context, favProviderModel, child) => Column( + children: [ + Container( + padding: const EdgeInsets.symmetric( + horizontal: 12, + vertical: 8, + ), + constraints: const BoxConstraints( + minWidth: 400.0, // Set the minimum width constraint + maxWidth: 500.0, // Set the maximum width constraint + minHeight: + 50.0, // Set the minimum height constraint + maxHeight: + 100.0, // Set the maximum height constraint + ), + child: fabbottomNavbar[index], + ), + Padding( + padding: const EdgeInsets.fromLTRB(0, 3, 20, 3), + child: Row( + mainAxisAlignment: MainAxisAlignment.end, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + const Text('Add to favorite'), + const SizedBox( + width: 5, + ), + GestureDetector( + onTap: () { + favProviderModel + .add(fabbottomNavbarIndex[index]); + setState(() {}); + }, + child: Icon( + Icons.star_border_outlined, + color: (favProviderModel + .starred(fabbottomNavbarIndex[index])) + ? Colors.amber + : null, + ), + ), + ], + ), + ), + ], + ), + ), + ), + ), + ], + ), + ), + ), + ); + } +} From 82b370f8c799b9a0fb915c412410a3453d23a886 Mon Sep 17 00:00:00 2001 From: Uttkarsh-raj Date: Wed, 7 Jun 2023 15:06:37 +0530 Subject: [PATCH 6/6] some minor problems solved --- .../animated_navbar/bottom_navbar4.dart | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/lib/ui_components/bottom_navbars/allBottomNavigationBars/animated_navbar/bottom_navbar4.dart b/lib/ui_components/bottom_navbars/allBottomNavigationBars/animated_navbar/bottom_navbar4.dart index 494b505..b9df01c 100644 --- a/lib/ui_components/bottom_navbars/allBottomNavigationBars/animated_navbar/bottom_navbar4.dart +++ b/lib/ui_components/bottom_navbars/allBottomNavigationBars/animated_navbar/bottom_navbar4.dart @@ -26,7 +26,7 @@ class Bottom_Navbar4State extends State { BoxShadow( color: Colors.black.withOpacity(.1), blurRadius: 30, - offset: Offset(0, 10), + offset: const Offset(0, 10), ), ], borderRadius: BorderRadius.circular(50), @@ -47,14 +47,14 @@ class Bottom_Navbar4State extends State { child: Stack( children: [ AnimatedContainer( - duration: Duration(seconds: 1), + duration: const Duration(seconds: 1), curve: Curves.fastLinearToSlowEaseIn, width: index == currentIndex ? displayWidth * .32 : displayWidth * .18, alignment: Alignment.center, child: AnimatedContainer( - duration: Duration(seconds: 1), + duration: const Duration(seconds: 1), curve: Curves.fastLinearToSlowEaseIn, height: index == currentIndex ? displayWidth * .12 : 0, width: index == currentIndex ? displayWidth * .32 : 0, @@ -78,19 +78,17 @@ class Bottom_Navbar4State extends State { Row( children: [ AnimatedContainer( - duration: Duration(seconds: 1), + duration: const Duration(seconds: 1), curve: Curves.fastLinearToSlowEaseIn, width: index == currentIndex ? displayWidth * .13 : 0, ), AnimatedOpacity( opacity: index == currentIndex ? 1 : 0, - duration: Duration(seconds: 1), + duration: const Duration(seconds: 1), curve: Curves.fastLinearToSlowEaseIn, child: Text( - index == currentIndex - ? '${listOfStrings[index]}' - : '', + index == currentIndex ? listOfStrings[index] : '', style: TextStyle( color: isDarkMode ? Colors.amberAccent @@ -105,7 +103,7 @@ class Bottom_Navbar4State extends State { Row( children: [ AnimatedContainer( - duration: Duration(seconds: 1), + duration: const Duration(seconds: 1), curve: Curves.fastLinearToSlowEaseIn, width: index == currentIndex ? displayWidth * .03 : 20,