From ea568321e1f81d108ad7f8a36517d4e6e210e4eb Mon Sep 17 00:00:00 2001 From: Bhavani Saranga <117339714+BhavaniSaranga12@users.noreply.github.com> Date: Wed, 31 May 2023 12:00:31 +0530 Subject: [PATCH 01/11] Update theme.dart --- lib/theme/theme.dart | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lib/theme/theme.dart b/lib/theme/theme.dart index 5e2cc3d..b21bee0 100644 --- a/lib/theme/theme.dart +++ b/lib/theme/theme.dart @@ -10,6 +10,9 @@ class MyTheme { secondary: Colors.white, brightness: Brightness.light, ), + snackBarTheme: const SnackBarThemeData( + backgroundColor: Colors.black, + contentTextStyle: TextStyle(color: Colors.white)), textTheme: GoogleFonts.poppinsTextTheme(ThemeData.light().textTheme), appBarTheme: const AppBarTheme( color: Colors.white, @@ -26,6 +29,9 @@ class MyTheme { secondary: Colors.white, brightness: Brightness.dark, ), + snackBarTheme: const SnackBarThemeData( + backgroundColor: Colors.white, + contentTextStyle: TextStyle(color: Colors.black)), textTheme: GoogleFonts.poppinsTextTheme(ThemeData.dark().textTheme), appBarTheme: const AppBarTheme( color: Colors.white, From d683fa9966c275e57b09b06e5eb3f1f686e7c8a4 Mon Sep 17 00:00:00 2001 From: Uttkarsh-raj Date: Wed, 31 May 2023 16:19:48 +0530 Subject: [PATCH 02/11] Prepare to store to local database --- lib/data/widget_category.dart | 5 + lib/provider/favorite_provider.dart | 246 +++++++++++++++++- lib/screens/main_app_widgets/fav_page.dart | 6 +- .../cards/All Cards/blog_card/card_1.dart | 2 +- .../cards/All Cards/blog_card/card_2.dart | 2 +- .../All Cards/blog_card_dark_mode/card_5.dart | 2 +- .../All Cards/blog_card_dark_mode/card_6.dart | 2 +- .../cards/All Cards/social_card/card_3.dart | 4 +- .../cards/All Cards/social_card/card_4.dart | 16 +- .../social_card_dark_mode/card_7.dart | 4 +- .../social_card_dark_mode/card_8.dart | 16 +- .../progress_bars/progress_bars.dart | 15 ++ lib/ui_components/steppers/steppers.dart | 1 - .../stepper_with_custom_color.dart | 14 +- .../stepper_with_custom_icon.dart | 12 +- .../stepper_with_validation.dart | 14 +- pubspec.lock | 51 ++-- pubspec.yaml | 1 + 18 files changed, 335 insertions(+), 78 deletions(-) diff --git a/lib/data/widget_category.dart b/lib/data/widget_category.dart index 1351db6..7a70317 100644 --- a/lib/data/widget_category.dart +++ b/lib/data/widget_category.dart @@ -9,6 +9,7 @@ import 'package:flutter_component_ui/ui_components/pricing_cards/pricing_cards.d import 'package:flutter_component_ui/ui_components/segmented_controls/segmented_control_screen.dart'; import 'package:flutter_component_ui/ui_components/steppers/steppers.dart'; +import '../ui_components/progress_bars/progress_bars.dart'; import '../ui_components/radios/radios.dart'; import '../ui_components/sliders/sliders.dart'; @@ -69,4 +70,8 @@ final List> widgetCategoryData = [ 'categoryName': 'Stepper', 'categoryScreen': StepperScreen(), }, + { + 'categoryName': 'Progress Bars', + 'categoryScreen': const ProgressBar(), + }, ]; diff --git a/lib/provider/favorite_provider.dart b/lib/provider/favorite_provider.dart index deceb3d..a6100e1 100644 --- a/lib/provider/favorite_provider.dart +++ b/lib/provider/favorite_provider.dart @@ -1,14 +1,254 @@ import 'package:flutter/material.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'; + +Color? color; + class FavoritesProvider extends ChangeNotifier { - List favs = []; + List favs = []; + Map widget_map = { + 1: const Button2("button"), + 2: const Button4("button"), + 3: const Button10("button"), + 4: const Button1("button"), + 5: const Button3("button"), + 6: const Button5("button"), + 7: const Button7("button"), + 8: const Button9("button"), + 9: const Button6("button"), + 10: const BasicRadioButton(), + 11: const RadioButtonwithTextandStyles(), + 12: const RadioButtonwithCustomColor(), + 13: const RadioButtonwithHorizontalLayout(), + 14: const Alert1("AMessage", "ADescriptions"), + 15: const Alert2("AMessage", "ADescriptions"), + 16: const Alert3("AMessage", "ADescriptions"), + 17: const Alert4("AMessage", "ADescriptions"), + 18: const Alert5("AMessage", "ADescriptions"), + 19: const Alert6("AMessage", "ADescriptions"), + 20: const Alert7("AMessage", "ADescriptions"), + 21: const Alert8("AMessage", "ADescriptions"), + 22: const Alert9("AMessage", "ADescriptions"), + 23: const Alert10("AMessage", "ADescriptions"), + 24: const Alert11("AMessage", "ADescriptions"), + 25: const Alert12("AMessage", "ADescriptions"), + 26: const FirstCard(), + 27: const SecondCard(), + 28: const ThirdCard(), + 29: const FourthCard(), + 30: const FifthCard(), + 31: const SixthCard(), + 32: const SeventhCard(), + 33: const EightCard(), + 34: const Avatar2( + size: 100, + text: Text( + 'AZ', + style: TextStyle( + color: Colors.white, + fontSize: 30, + ), + ), + backgroundColor: Colors.black, + ), + 35: const Avatar1(size: 100, imagePath: 'assets/bored.png'), + 36: const Avatar3( + size: 100, + icon: Icon( + Icons.person_2_outlined, + color: Colors.white, + size: 50, + ), + backgroundColor: Colors.black, + ), + 37: const TextArea1( + label: "TextArea1", + hinttext: "Write Message", + ), + 38: const TextArea2( + label: "TextArea2", + hinttext: "Write Description", + ), + 39: const TextArea3( + label: "TextArea3", + hinttext: "Write Description", + ), + 40: const TextArea4( + label: "TextArea4", + hinttext: "Write Description", + ), + 41: const InputField1( + label: "Title", + hinttext: "Input Title", + ), + 42: const InputField2( + label: "Title Lite", + hinttext: "Input Title", + ), + 43: const InputField3( + label: "Title Highlighted", + hinttext: "Input Title", + ), + 44: const InputField4( + label: "Title Lite-X", + hinttext: "Input Title", + ), + 45: const InputField5( + label: "Title Type B", + hinttext: "Input Title", + ), + 46: const Slider4( + activeColor: Colors.white, + inactiveColor: Colors.black, + maxRange: 100, + ), + 47: const Slider1( + activeColor: Colors.cyan, + inactiveColor: Colors.black, + maxRange: 100.0, + ), + 48: const Slider3( + activeColor: Colors.red, + inactiveColor: Colors.white, + maxRange: 100, + ), + 49: const Slider5( + activeColor: Colors.pink, + inactiveColor: Colors.amberAccent, + maxRange: 100, + ), + 50: const Slider6( + activeColor: Colors.lightBlueAccent, + inactiveColor: Color(0xFF005F99), + maxRange: 60, + ), + 51: Slider2( + activeColor: const Color(0xFF005F99), + inactiveColor: Colors.purple.shade600, + maxRange: 100, + ), + 52: const InboxMessage1( + name: "ClueLess", + username: "clueless@gmail.com", + msg: "Hey let's start", + imgUrl: 'https://picsum.photos/seed/407/600', + ), + 53: const InboxMessage2( + name: "ClueLess", + username: "clueless@gmail.com", + msg: "Hey let's start", + imgUrl: 'https://picsum.photos/seed/407/600', + ), + 54: const InboxMessage3( + name: "ClueLess", + username: "clueless@gmail.com", + msg: "Hey let's start", + imgUrl: 'https://picsum.photos/seed/407/600', + ), + 55: const InboxMessage4( + name: "ClueLess", + username: "clueless@gmail.com", + msg: "Hey let's start ", + imgUrl: 'https://picsum.photos/seed/407/600', + ), + 56: const Message1( + message: "Hello boy", + ), + 57: const Message2( + message: "Hello broo", + ), + 58: const Message3( + message: "Hey whats up man", + ), + 59: const Message4( + message: "Hello broo", + ), + 60: const PricingCard1( + tier: 'FREE', + supportingText: + 'For those who want to try our services with no commitment', + price: '\$0', + period: 'month', + details: [ + 'Easily receive new glasses on a regular basis', + 'More cost-effective than buying glasses individually', + ], + cardColor: Color(0xff0f172a), + textColor: Colors.white, + buttonColor: Color(0xff00c2cb), + buttonTextColor: Color(0xff0f172a), + ), + 61: Center( + child: SegmentedControlWidget( + choices: { + 0: buildSegment("week", color), + 1: buildSegment("Month", color), + 2: buildSegment("Year", color), + }, + ), + ), + 62: Center( + child: SegmentedControlWidget( + choices: { + 0: buildSegment("week", color), + 1: buildSegment("Month", color), + 2: buildSegment("Year", color), + }, + ), + ), + 63: Center( + child: RadioChips( + values: const ['Text', 'Text', 'Text'], + onSelected: (index) {}, + ), + ), + 64: Center( + child: RectangularSelections( + values: const ['Text', 'Text', 'Text'], + onSelected: (index) {}, + ), + ), + 65: const Page1( + iconColor: Colors.black, + containerColor: Colors.white, + textColor: Colors.black, + hightlightColor: Color(0xFF005F99), + ), + 66: const Page2( + iconColor: Colors.black, + textColor: Colors.black, + // highlightedColor: Colors.blue, + ), + 67: const Page3( + iconColor: Colors.white, + containerColor: Colors.black, + textColor: Colors.white, + ), + 68: const Page4( + iconColor: Colors.black, + containerColor: Colors.white, + textColor: Colors.black, + ), + 69: const Page5( + iconColor: Colors.black, + containerColor: Colors.white, + textColor: Colors.black, + hightlightColor: Color(0xFF00C2CB), + ), + }; void add(Widget item) { - favs.add(item); + var index = widget_map.keys.firstWhere((k) => widget_map[k] == item); + favs.add(index); notifyListeners(); } void remove(Widget item) { - favs.remove(item); + var index = widget_map.keys.firstWhere((k) => widget_map[k] == item); + favs.remove(index); notifyListeners(); } } diff --git a/lib/screens/main_app_widgets/fav_page.dart b/lib/screens/main_app_widgets/fav_page.dart index bbedba8..7f73f26 100644 --- a/lib/screens/main_app_widgets/fav_page.dart +++ b/lib/screens/main_app_widgets/fav_page.dart @@ -17,7 +17,7 @@ class FavPage extends StatelessWidget { return Consumer( builder: (context, favProviderModel, child) => AlertDialog( title: const Text('Remove'), - content: SingleChildScrollView( + content: const SingleChildScrollView( child: ListBody( children: [ Text( @@ -72,7 +72,7 @@ class FavPage extends StatelessWidget { children: [ GestureDetector( onTap: () { - _showMyDialog(favProviderModel.favs[index]); + _showMyDialog(favProviderModel.widgetMap[index]!); }, child: const Padding( padding: EdgeInsets.fromLTRB(0, 0, 20, 0), @@ -83,7 +83,7 @@ class FavPage extends StatelessWidget { ), ), Center( - child: favProviderModel.favs[index], + child: favProviderModel.widgetMap[index], ), ], ); diff --git a/lib/ui_components/cards/All Cards/blog_card/card_1.dart b/lib/ui_components/cards/All Cards/blog_card/card_1.dart index 16c73df..3d736d8 100644 --- a/lib/ui_components/cards/All Cards/blog_card/card_1.dart +++ b/lib/ui_components/cards/All Cards/blog_card/card_1.dart @@ -14,7 +14,7 @@ class FirstCard extends StatelessWidget { ), Container( padding: const EdgeInsets.only(left: 10, right: 10, bottom: 20), - child: Column( + child: const Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Text( diff --git a/lib/ui_components/cards/All Cards/blog_card/card_2.dart b/lib/ui_components/cards/All Cards/blog_card/card_2.dart index ca8ad3d..9f10a70 100644 --- a/lib/ui_components/cards/All Cards/blog_card/card_2.dart +++ b/lib/ui_components/cards/All Cards/blog_card/card_2.dart @@ -18,7 +18,7 @@ class SecondCard extends StatelessWidget { width: MediaQuery.of(context).size.width - MediaQuery.of(context).size.width / 2.4 - 8, - child: Column( + child: const Column( crossAxisAlignment: CrossAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ diff --git a/lib/ui_components/cards/All Cards/blog_card_dark_mode/card_5.dart b/lib/ui_components/cards/All Cards/blog_card_dark_mode/card_5.dart index 85524ed..6af1a1a 100644 --- a/lib/ui_components/cards/All Cards/blog_card_dark_mode/card_5.dart +++ b/lib/ui_components/cards/All Cards/blog_card_dark_mode/card_5.dart @@ -16,7 +16,7 @@ class FifthCard extends StatelessWidget { ), Container( padding: const EdgeInsets.all(15), - child: Column( + child: const Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Text( diff --git a/lib/ui_components/cards/All Cards/blog_card_dark_mode/card_6.dart b/lib/ui_components/cards/All Cards/blog_card_dark_mode/card_6.dart index a653b7d..b0a0f24 100644 --- a/lib/ui_components/cards/All Cards/blog_card_dark_mode/card_6.dart +++ b/lib/ui_components/cards/All Cards/blog_card_dark_mode/card_6.dart @@ -15,7 +15,7 @@ class SixthCard extends StatelessWidget { width: MediaQuery.of(context).size.width - MediaQuery.of(context).size.width / 2.4 - 8, - child: Column( + child: const Column( crossAxisAlignment: CrossAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ diff --git a/lib/ui_components/cards/All Cards/social_card/card_3.dart b/lib/ui_components/cards/All Cards/social_card/card_3.dart index 235e54b..4425d79 100644 --- a/lib/ui_components/cards/All Cards/social_card/card_3.dart +++ b/lib/ui_components/cards/All Cards/social_card/card_3.dart @@ -12,7 +12,7 @@ class ThirdCard extends StatelessWidget { child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - Row( + const Row( children: [ Icon( Icons.star_outline, @@ -62,7 +62,7 @@ class ThirdCard extends StatelessWidget { const SizedBox( height: 10, ), - Row( + const Row( children: [ CircleAvatar(), SizedBox( diff --git a/lib/ui_components/cards/All Cards/social_card/card_4.dart b/lib/ui_components/cards/All Cards/social_card/card_4.dart index 56e9001..2897171 100644 --- a/lib/ui_components/cards/All Cards/social_card/card_4.dart +++ b/lib/ui_components/cards/All Cards/social_card/card_4.dart @@ -15,7 +15,7 @@ class FourthCard extends StatelessWidget { const EdgeInsets.only(left: 5, top: 10, bottom: 10, right: 5), child: Column( children: [ - Row( + const Row( children: [ CircleAvatar(), SizedBox( @@ -83,7 +83,7 @@ class FourthCard extends StatelessWidget { ], ), const SizedBox(height: 10), - Row( + const Row( children: [ Text( "Roshan Kumar", @@ -102,7 +102,7 @@ class FourthCard extends StatelessWidget { ], ), - Row( + const Row( children: [ Text( "@HSmith78", @@ -113,7 +113,7 @@ class FourthCard extends StatelessWidget { const SizedBox( height: 15, ), - Row( + const Row( children: [ Text( "Hey I'm Henry", @@ -132,7 +132,7 @@ class FourthCard extends StatelessWidget { ) ], ), - Row( + const Row( children: [ Icon( Icons.color_lens, @@ -150,7 +150,7 @@ class FourthCard extends StatelessWidget { ), ], ), - Row( + const Row( children: [ Icon( Icons.baby_changing_station, @@ -169,7 +169,7 @@ class FourthCard extends StatelessWidget { ), ], ), - Row( + const Row( children: [ Icon( Icons.circle, @@ -190,7 +190,7 @@ class FourthCard extends StatelessWidget { const SizedBox( height: 20, ), - Row( + const Row( children: [ SizedBox( // width: double.infinity, diff --git a/lib/ui_components/cards/All Cards/social_card_dark_mode/card_7.dart b/lib/ui_components/cards/All Cards/social_card_dark_mode/card_7.dart index 530234c..2132be2 100644 --- a/lib/ui_components/cards/All Cards/social_card_dark_mode/card_7.dart +++ b/lib/ui_components/cards/All Cards/social_card_dark_mode/card_7.dart @@ -14,7 +14,7 @@ class SeventhCard extends StatelessWidget { child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - Row( + const Row( children: [ Icon( Icons.star, @@ -59,7 +59,7 @@ class SeventhCard extends StatelessWidget { const SizedBox( height: 10, ), - Row( + const Row( children: [ CircleAvatar(), SizedBox( diff --git a/lib/ui_components/cards/All Cards/social_card_dark_mode/card_8.dart b/lib/ui_components/cards/All Cards/social_card_dark_mode/card_8.dart index 235e2ab..9c2eb5f 100644 --- a/lib/ui_components/cards/All Cards/social_card_dark_mode/card_8.dart +++ b/lib/ui_components/cards/All Cards/social_card_dark_mode/card_8.dart @@ -14,7 +14,7 @@ class EightCard extends StatelessWidget { padding: const EdgeInsets.only(left: 10, top: 10, bottom: 10), child: Column( children: [ - Row( + const Row( children: [ CircleAvatar(), SizedBox( @@ -82,7 +82,7 @@ class EightCard extends StatelessWidget { ], ), const SizedBox(height: 10), - Row( + const Row( children: [ Text( "Roshan Kumar", @@ -101,7 +101,7 @@ class EightCard extends StatelessWidget { const SizedBox( height: 3, ), - Row( + const Row( children: [ Text( "@HSmith78", @@ -112,7 +112,7 @@ class EightCard extends StatelessWidget { const SizedBox( height: 20, ), - Row( + const Row( children: [ Text( "Hey I'm Henry", @@ -131,7 +131,7 @@ class EightCard extends StatelessWidget { ) ], ), - Row( + const Row( children: [ Icon( Icons.color_lens, @@ -146,7 +146,7 @@ class EightCard extends StatelessWidget { ), ], ), - Row( + const Row( children: [ Icon( Icons.baby_changing_station, @@ -164,7 +164,7 @@ class EightCard extends StatelessWidget { ), ], ), - Row( + const Row( children: [ Icon( Icons.circle, @@ -183,7 +183,7 @@ class EightCard extends StatelessWidget { height: 10, ), - Row( + const Row( children: [ SizedBox( // width: double.infinity, diff --git a/lib/ui_components/progress_bars/progress_bars.dart b/lib/ui_components/progress_bars/progress_bars.dart index e69de29..7011b5f 100644 --- a/lib/ui_components/progress_bars/progress_bars.dart +++ b/lib/ui_components/progress_bars/progress_bars.dart @@ -0,0 +1,15 @@ +import 'package:flutter/material.dart'; + +class ProgressBar extends StatefulWidget { + const ProgressBar({super.key}); + + @override + State createState() => _ProgressBarState(); +} + +class _ProgressBarState extends State { + @override + Widget build(BuildContext context) { + return const Placeholder(); + } +} diff --git a/lib/ui_components/steppers/steppers.dart b/lib/ui_components/steppers/steppers.dart index 7736665..85bf43b 100644 --- a/lib/ui_components/steppers/steppers.dart +++ b/lib/ui_components/steppers/steppers.dart @@ -4,7 +4,6 @@ import 'package:flutter_component_ui/ui_components/steppers/steppers_widgets/ste 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 '../../theme/theme.dart'; class StepperScreen extends StatelessWidget { StepperScreen({super.key}); diff --git a/lib/ui_components/steppers/steppers_widgets/stepper_with_custom_color.dart b/lib/ui_components/steppers/steppers_widgets/stepper_with_custom_color.dart index 0b4c88b..c2d1be0 100644 --- a/lib/ui_components/steppers/steppers_widgets/stepper_with_custom_color.dart +++ b/lib/ui_components/steppers/steppers_widgets/stepper_with_custom_color.dart @@ -38,7 +38,7 @@ class _StepperwithCustomColorState extends State { backgroundColor: Colors.red, ), onPressed: details.onStepCancel, - child: Text( + child: const Text( 'Cancel', style: TextStyle(color: Colors.white), ), @@ -72,18 +72,18 @@ class _StepperwithCustomColorState extends State { }, steps: [ Step( - title: Text('Step 1'), - content: Text('This is the content for Step 1'), + title: const Text('Step 1'), + content: const Text('This is the content for Step 1'), isActive: _currentStep == 0, ), Step( - title: Text('Step 2'), - content: Text('This is the content for Step 2'), + title: const Text('Step 2'), + content: const Text('This is the content for Step 2'), isActive: _currentStep == 1, ), Step( - title: Text('Step 3'), - content: Text('This is the content for Step 3'), + title: const Text('Step 3'), + content: const Text('This is the content for Step 3'), isActive: _currentStep == 2, ), ], diff --git a/lib/ui_components/steppers/steppers_widgets/stepper_with_custom_icon.dart b/lib/ui_components/steppers/steppers_widgets/stepper_with_custom_icon.dart index ee1ea64..9fea4bb 100644 --- a/lib/ui_components/steppers/steppers_widgets/stepper_with_custom_icon.dart +++ b/lib/ui_components/steppers/steppers_widgets/stepper_with_custom_icon.dart @@ -47,22 +47,22 @@ class _StepperwihCustomIconState extends State { }, steps: [ Step( - title: Text('Step 1'), - content: Text('This is the content of Step 1.'), + title: const Text('Step 1'), + content: const Text('This is the content of Step 1.'), isActive: _currentStep >= 0, state: _currentStep >= 0 ? StepState.complete : StepState.disabled, ), Step( - title: Text('Step 2'), - content: Text('This is the content of Step 2.'), + title: const Text('Step 2'), + content: const Text('This is the content of Step 2.'), isActive: _currentStep >= 1, state: _currentStep >= 1 ? StepState.complete : StepState.disabled, ), Step( - title: Text('Step 3'), - content: Text('This is the content of Step 3.'), + title: const Text('Step 3'), + content: const Text('This is the content of Step 3.'), isActive: _currentStep >= 2, state: _currentStep >= 2 ? StepState.complete : StepState.disabled, diff --git a/lib/ui_components/steppers/steppers_widgets/stepper_with_validation.dart b/lib/ui_components/steppers/steppers_widgets/stepper_with_validation.dart index 68a06a7..976ef95 100644 --- a/lib/ui_components/steppers/steppers_widgets/stepper_with_validation.dart +++ b/lib/ui_components/steppers/steppers_widgets/stepper_with_validation.dart @@ -11,7 +11,7 @@ class StepperwithValidation extends StatefulWidget { class _StepperwithValidationState extends State { int _currentStep = 0; - List _isStepValid = [false, false, false]; + final List _isStepValid = [false, false, false]; @override Widget build(BuildContext context) { @@ -47,11 +47,11 @@ class _StepperwithValidationState extends State { }, steps: [ Step( - title: Text('Step 1'), + title: const Text('Step 1'), content: Column( children: [ TextFormField( - decoration: InputDecoration(labelText: 'Name'), + decoration: const InputDecoration(labelText: 'Name'), onChanged: (value) { setState(() { _isStepValid[0] = value.isNotEmpty; @@ -64,11 +64,11 @@ class _StepperwithValidationState extends State { state: _isStepValid[0] ? StepState.complete : StepState.error, ), Step( - title: Text('Step 2'), + title: const Text('Step 2'), content: Column( children: [ TextFormField( - decoration: InputDecoration(labelText: 'Email'), + decoration: const InputDecoration(labelText: 'Email'), onChanged: (value) { setState(() { _isStepValid[1] = value.isNotEmpty; @@ -81,11 +81,11 @@ class _StepperwithValidationState extends State { state: _isStepValid[1] ? StepState.complete : StepState.error, ), Step( - title: Text('Step 3'), + title: const Text('Step 3'), content: Column( children: [ TextFormField( - decoration: InputDecoration(labelText: 'Address'), + decoration: const InputDecoration(labelText: 'Address'), onChanged: (value) { setState(() { _isStepValid[2] = value.isNotEmpty; diff --git a/pubspec.lock b/pubspec.lock index 0547c56..996fe65 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -13,10 +13,10 @@ packages: dependency: transitive description: name: async - sha256: bfe67ef28df125b7dddcea62755991f807aa39a2492a23e1550161692950bbe0 + sha256: "947bfcf187f74dbc5e146c9eb9c0f10c9f8b30743e341481c1e2ed3ecc18c20c" url: "https://pub.dev" source: hosted - version: "2.10.0" + version: "2.11.0" boolean_selector: dependency: transitive description: @@ -29,10 +29,10 @@ packages: dependency: transitive description: name: characters - sha256: e6a326c8af69605aec75ed6c187d06b349707a27fbff8222ca9cc2cff167975c + sha256: "04a925763edad70e8443c99234dc3328f442e811f1d8fd1a72f1c8ad0f69a605" url: "https://pub.dev" source: hosted - version: "1.2.1" + version: "1.3.0" clipboard: dependency: "direct main" description: @@ -53,10 +53,10 @@ packages: dependency: transitive description: name: collection - sha256: cfc915e6923fe5ce6e153b0723c753045de46de1b4d63771530504004a45fae0 + sha256: "4a07be6cb69c84d677a6c3096fcf960cc3285a8330b4603e0d463d15d9bd934c" url: "https://pub.dev" source: hosted - version: "1.17.0" + version: "1.17.1" crypto: dependency: transitive description: @@ -118,6 +118,14 @@ packages: url: "https://pub.dev" source: hosted version: "2.0.1" + flutter_spinkit: + dependency: "direct main" + description: + name: flutter_spinkit + sha256: b39c753e909d4796906c5696a14daf33639a76e017136c8d82bf3e620ce5bb8e + url: "https://pub.dev" + source: hosted + version: "5.2.0" flutter_staggered_grid_view: dependency: "direct main" description: @@ -172,10 +180,10 @@ packages: dependency: transitive description: name: js - sha256: "5528c2f391ededb7775ec1daa69e65a2d61276f7552de2b5f7b8d34ee9fd4ab7" + sha256: f2c445dce49627136094980615a031419f7f3eb393237e4ecd97ac15dea343f3 url: "https://pub.dev" source: hosted - version: "0.6.5" + version: "0.6.7" lints: dependency: transitive description: @@ -188,10 +196,10 @@ packages: dependency: transitive description: name: matcher - sha256: "16db949ceee371e9b99d22f88fa3a73c4e59fd0afed0bd25fc336eb76c198b72" + sha256: "6501fbd55da300384b768785b83e5ce66991266cec21af89ab9ae7f5ce1c4cbb" url: "https://pub.dev" source: hosted - version: "0.12.13" + version: "0.12.15" material_color_utilities: dependency: transitive description: @@ -204,10 +212,10 @@ packages: dependency: transitive description: name: meta - sha256: "6c268b42ed578a53088d834796959e4a1814b5e9e164f147f580a386e5decf42" + sha256: "3c74dbf8763d36539f114c799d8a2d87343b5067e9d796ca22b5eb8437090ee3" url: "https://pub.dev" source: hosted - version: "1.8.0" + version: "1.9.1" nested: dependency: transitive description: @@ -228,10 +236,10 @@ packages: dependency: transitive description: name: path - sha256: db9d4f58c908a4ba5953fcee2ae317c94889433e5024c27ce74a37f94267945b + sha256: "8829d8a55c13fc0e37127c29fedf290c102f4e40ae94ada574091fe0ff96c917" url: "https://pub.dev" source: hosted - version: "1.8.2" + version: "1.8.3" path_provider: dependency: transitive description: @@ -377,10 +385,10 @@ packages: dependency: transitive description: name: test_api - sha256: ad540f65f92caa91bf21dfc8ffb8c589d6e4dc0c2267818b4cc2792857706206 + sha256: eb6ac1540b26de412b3403a163d919ba86f6a973fe6cc50ae3541b80092fdcfb url: "https://pub.dev" source: hosted - version: "0.4.16" + version: "0.5.1" typed_data: dependency: transitive description: @@ -401,17 +409,10 @@ packages: dependency: transitive description: name: url_launcher_android -<<<<<<< HEAD - sha256: "1a5848f598acc5b7d8f7c18b8cb834ab667e59a13edc3c93e9d09cf38cc6bc87" - url: "https://pub.dev" - source: hosted - version: "6.0.34" -======= sha256: eed4e6a1164aa9794409325c3b707ff424d4d1c2a785e7db67f8bbda00e36e51 url: "https://pub.dev" source: hosted version: "6.0.35" ->>>>>>> d618e5449a0c7e6dae8adcbddad72e6382530053 url_launcher_ios: dependency: transitive description: @@ -485,9 +486,5 @@ packages: source: hosted version: "1.0.0" sdks: -<<<<<<< HEAD dart: ">=3.0.0-0 <4.0.0" -======= - dart: ">=2.19.0 <3.0.0" ->>>>>>> d618e5449a0c7e6dae8adcbddad72e6382530053 flutter: ">=3.3.0" diff --git a/pubspec.yaml b/pubspec.yaml index 4f7027c..41758de 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -43,6 +43,7 @@ dependencies: url_launcher: ^6.1.11 clipboard: ^0.1.3 provider: ^6.0.5 + flutter_spinkit: ^5.2.0 dev_dependencies: flutter_test: From 36c6649203e91409df3941507e09b84b90b0c91e Mon Sep 17 00:00:00 2001 From: Uttkarsh-raj Date: Wed, 31 May 2023 16:20:28 +0530 Subject: [PATCH 03/11] widget Map --- lib/provider/favorite_provider.dart | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/provider/favorite_provider.dart b/lib/provider/favorite_provider.dart index a6100e1..f68ed8e 100644 --- a/lib/provider/favorite_provider.dart +++ b/lib/provider/favorite_provider.dart @@ -10,7 +10,7 @@ Color? color; class FavoritesProvider extends ChangeNotifier { List favs = []; - Map widget_map = { + Map widgetMap = { 1: const Button2("button"), 2: const Button4("button"), 3: const Button10("button"), @@ -241,13 +241,13 @@ class FavoritesProvider extends ChangeNotifier { ), }; void add(Widget item) { - var index = widget_map.keys.firstWhere((k) => widget_map[k] == item); + var index = widgetMap.keys.firstWhere((k) => widgetMap[k] == item); favs.add(index); notifyListeners(); } void remove(Widget item) { - var index = widget_map.keys.firstWhere((k) => widget_map[k] == item); + var index = widgetMap.keys.firstWhere((k) => widgetMap[k] == item); favs.remove(index); notifyListeners(); } From 0da671db0d075ac0eef6e211d9498f2e5f66721d Mon Sep 17 00:00:00 2001 From: Rhishikesh12 Date: Thu, 1 Jun 2023 09:30:40 +0530 Subject: [PATCH 04/11] bottom NavbarAdded --- lib/data/widget_category.dart | 3 +- .../animated_navbar/bottom_navbar4.dart | 146 +++++++++ .../basic_navbars/bottom_navbar1.dart | 65 ++++ .../basic_navbars/bottom_navbar2.dart | 76 +++++ .../fab_navbars/bottom_navbar3.dart | 145 +++++++++ .../fab_navbars/bottom_navbar5.dart | 138 +++++++++ .../fab_navbars/bottom_navbar6.dart | 140 +++++++++ .../bottom_navbars/bottom_navbars.dart | 293 +++++++++++++++++- 8 files changed, 1002 insertions(+), 4 deletions(-) create mode 100644 lib/ui_components/bottom_navbars/allBottomNavigationBars/animated_navbar/bottom_navbar4.dart create mode 100644 lib/ui_components/bottom_navbars/allBottomNavigationBars/basic_navbars/bottom_navbar1.dart create mode 100644 lib/ui_components/bottom_navbars/allBottomNavigationBars/basic_navbars/bottom_navbar2.dart create mode 100644 lib/ui_components/bottom_navbars/allBottomNavigationBars/fab_navbars/bottom_navbar3.dart create mode 100644 lib/ui_components/bottom_navbars/allBottomNavigationBars/fab_navbars/bottom_navbar5.dart create mode 100644 lib/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 1351db6..38b3957 100644 --- a/lib/data/widget_category.dart +++ b/lib/data/widget_category.dart @@ -9,6 +9,7 @@ import 'package:flutter_component_ui/ui_components/pricing_cards/pricing_cards.d import 'package:flutter_component_ui/ui_components/segmented_controls/segmented_control_screen.dart'; import 'package:flutter_component_ui/ui_components/steppers/steppers.dart'; +import '../ui_components/bottom_navbars/bottom_navbars.dart'; import '../ui_components/radios/radios.dart'; import '../ui_components/sliders/sliders.dart'; @@ -27,7 +28,7 @@ final List> widgetCategoryData = [ }, { 'categoryName': 'Bottom Navigation Bars', - 'categoryScreen': const AlertScreen(), + 'categoryScreen': const BottomNavBarScreen(), }, { 'categoryName': 'Avatars', 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 new file mode 100644 index 0000000..494b505 --- /dev/null +++ b/lib/ui_components/bottom_navbars/allBottomNavigationBars/animated_navbar/bottom_navbar4.dart @@ -0,0 +1,146 @@ +import 'package:flutter/material.dart'; +import 'package:flutter/services.dart'; + +class Bottom_Navbar4 extends StatefulWidget { + const Bottom_Navbar4({super.key}); + + @override + Bottom_Navbar4State createState() => Bottom_Navbar4State(); +} + +class Bottom_Navbar4State extends State { + var currentIndex = 0; + + @override + Widget build(BuildContext context) { + final isDarkMode = Theme.of(context).brightness == Brightness.dark; + double displayWidth = MediaQuery.of(context).size.width; + return Scaffold( + bottomNavigationBar: Container( + padding: const EdgeInsets.all(5), + margin: EdgeInsets.all(displayWidth * .02), + height: displayWidth * 0.2, + decoration: BoxDecoration( + color: isDarkMode ? Colors.grey[900] : Colors.white, + boxShadow: [ + BoxShadow( + color: Colors.black.withOpacity(.1), + blurRadius: 30, + offset: Offset(0, 10), + ), + ], + borderRadius: BorderRadius.circular(50), + ), + child: ListView.builder( + itemCount: 4, + scrollDirection: Axis.horizontal, + padding: EdgeInsets.symmetric(horizontal: displayWidth * .02), + itemBuilder: (context, index) => InkWell( + onTap: () { + setState(() { + currentIndex = index; + HapticFeedback.lightImpact(); + }); + }, + splashColor: Colors.transparent, + highlightColor: Colors.transparent, + child: Stack( + children: [ + AnimatedContainer( + duration: Duration(seconds: 1), + curve: Curves.fastLinearToSlowEaseIn, + width: index == currentIndex + ? displayWidth * .32 + : displayWidth * .18, + alignment: Alignment.center, + child: AnimatedContainer( + duration: Duration(seconds: 1), + curve: Curves.fastLinearToSlowEaseIn, + height: index == currentIndex ? displayWidth * .12 : 0, + width: index == currentIndex ? displayWidth * .32 : 0, + decoration: BoxDecoration( + color: index == currentIndex + ? Colors.blueAccent.withOpacity(.2) + : Colors.transparent, + borderRadius: BorderRadius.circular(50), + ), + ), + ), + AnimatedContainer( + duration: Duration(seconds: 1), + curve: Curves.fastLinearToSlowEaseIn, + width: index == currentIndex + ? displayWidth * .31 + : displayWidth * .18, + alignment: Alignment.center, + child: Stack( + children: [ + Row( + children: [ + AnimatedContainer( + duration: Duration(seconds: 1), + curve: Curves.fastLinearToSlowEaseIn, + width: + index == currentIndex ? displayWidth * .13 : 0, + ), + AnimatedOpacity( + opacity: index == currentIndex ? 1 : 0, + duration: Duration(seconds: 1), + curve: Curves.fastLinearToSlowEaseIn, + child: Text( + index == currentIndex + ? '${listOfStrings[index]}' + : '', + style: TextStyle( + color: isDarkMode + ? Colors.amberAccent + : Colors.blueAccent, + fontWeight: FontWeight.w600, + fontSize: 15, + ), + ), + ), + ], + ), + Row( + children: [ + AnimatedContainer( + duration: Duration(seconds: 1), + curve: Curves.fastLinearToSlowEaseIn, + width: + index == currentIndex ? displayWidth * .03 : 20, + ), + Icon( + listOfIcons[index], + size: displayWidth * .076, + color: isDarkMode + ? Colors.amberAccent + : Colors.blueAccent, + ), + ], + ), + ], + ), + ), + ], + ), + ), + ), + ), + ); + } + + List listOfIcons = [ + Icons.home_rounded, + Icons.favorite_rounded, + Icons.settings_rounded, + Icons.person_rounded, + ]; + + List listOfStrings = [ + 'Home', + 'Favorite', + 'Settings', + 'Account', + ]; +} diff --git a/lib/ui_components/bottom_navbars/allBottomNavigationBars/basic_navbars/bottom_navbar1.dart b/lib/ui_components/bottom_navbars/allBottomNavigationBars/basic_navbars/bottom_navbar1.dart new file mode 100644 index 0000000..3c3f910 --- /dev/null +++ b/lib/ui_components/bottom_navbars/allBottomNavigationBars/basic_navbars/bottom_navbar1.dart @@ -0,0 +1,65 @@ +import 'package:flutter/material.dart'; + +// ignore: camel_case_types +class Bottom_Navbar1 extends StatefulWidget { + const Bottom_Navbar1({super.key}); + + @override + State createState() => _Bottom_Navbar1State(); +} + +class _Bottom_Navbar1State extends State { + int _currentIndex = 0; + + @override + Widget build(BuildContext context) { + final isDarkMode = Theme.of(context).brightness == Brightness.dark; + + return Scaffold( + bottomNavigationBar: Theme( + data: Theme.of(context).copyWith( + // Sets the background color of the `BottomNavigationBar` + canvasColor: isDarkMode ? Colors.grey[900] : Colors.white, + // Sets the active color of the `BottomNavigationBar` + primaryColor: isDarkMode ? Colors.amberAccent : Colors.red, + unselectedWidgetColor: isDarkMode ? Colors.grey[400] : Colors.grey, + // Sets the inactive color of the `BottomNavigationBar` + textTheme: Theme.of(context).textTheme.copyWith( + // ignore: deprecated_member_use + caption: TextStyle( + color: isDarkMode ? Colors.amberAccent : Colors.yellow, + ), + ), + ), + child: BottomNavigationBar( + unselectedIconTheme: IconThemeData( + color: isDarkMode ? Colors.grey[400] : Colors.grey[500], + ), + selectedFontSize: 14, + selectedItemColor: + isDarkMode ? Colors.amberAccent : Colors.blueAccent, + currentIndex: _currentIndex, + onTap: (int index) { + setState(() { + _currentIndex = index; + }); + }, + items: const [ + BottomNavigationBarItem( + icon: Icon(Icons.home), + label: 'Home', + ), + BottomNavigationBarItem( + icon: Icon(Icons.search), + label: 'Search', + ), + BottomNavigationBarItem( + icon: Icon(Icons.person), + label: 'Profile', + ), + ], + ), + ), + ); + } +} diff --git a/lib/ui_components/bottom_navbars/allBottomNavigationBars/basic_navbars/bottom_navbar2.dart b/lib/ui_components/bottom_navbars/allBottomNavigationBars/basic_navbars/bottom_navbar2.dart new file mode 100644 index 0000000..36b37c7 --- /dev/null +++ b/lib/ui_components/bottom_navbars/allBottomNavigationBars/basic_navbars/bottom_navbar2.dart @@ -0,0 +1,76 @@ +import 'package:flutter/material.dart'; + +// ignore: camel_case_types +class Bottom_Navbar2 extends StatefulWidget { + const Bottom_Navbar2({Key? key}) : super(key: key); + + @override + State createState() => _Bottom_Navbar2State(); +} + +// ignore: camel_case_types +class _Bottom_Navbar2State extends State { + int _currentIndex = 0; + + @override + Widget build(BuildContext context) { + bool isDarkMode = Theme.of(context).brightness == Brightness.dark; + + return Theme( + data: Theme.of(context).copyWith( + // Sets the background color of the `BottomNavigationBar` + canvasColor: isDarkMode ? Colors.grey[900] : Colors.white, + // Sets the active color of the `BottomNavigationBar` if `Brightness` is light + primaryColor: isDarkMode ? Colors.amberAccent : Colors.red, + // Sets the inactive color of the `BottomNavigationBar` + unselectedWidgetColor: isDarkMode ? Colors.grey[400] : Colors.grey, + // Sets the text color of the `BottomNavigationBar` + textTheme: Theme.of(context).textTheme.copyWith( + // Sets the text color of the labels + // ignore: deprecated_member_use + caption: TextStyle( + color: isDarkMode ? Colors.amberAccent : Colors.yellow, + ), + ), + ), + child: Scaffold( + bottomNavigationBar: BottomNavigationBar( + unselectedIconTheme: IconThemeData( + color: isDarkMode ? Colors.grey[400] : Colors.grey[500], + ), + selectedFontSize: 16, + selectedItemColor: + isDarkMode ? Colors.amberAccent : Colors.blueAccent, + currentIndex: _currentIndex, + onTap: (int index) { + setState(() { + _currentIndex = index; + }); + }, + items: const [ + BottomNavigationBarItem( + icon: Icon(Icons.call), + label: 'Calls', + ), + BottomNavigationBarItem( + icon: Icon(Icons.camera), + label: 'Camera', + ), + BottomNavigationBarItem( + icon: Icon(Icons.chat), + label: 'Chats', + ), + BottomNavigationBarItem( + icon: Icon(Icons.star_rate), + label: 'Favorite', + ), + BottomNavigationBarItem( + icon: Icon(Icons.person), + label: 'Profile', + ), + ], + ), + ), + ); + } +} diff --git a/lib/ui_components/bottom_navbars/allBottomNavigationBars/fab_navbars/bottom_navbar3.dart b/lib/ui_components/bottom_navbars/allBottomNavigationBars/fab_navbars/bottom_navbar3.dart new file mode 100644 index 0000000..a47e043 --- /dev/null +++ b/lib/ui_components/bottom_navbars/allBottomNavigationBars/fab_navbars/bottom_navbar3.dart @@ -0,0 +1,145 @@ +import 'package:flutter/material.dart'; + +// ignore: camel_case_types +class Bottom_Navbar3 extends StatefulWidget { + const Bottom_Navbar3({super.key}); + + @override + State createState() => _Bottom_Navbar3State(); +} + +// ignore: camel_case_types +class _Bottom_Navbar3State extends State { + late int currentIndex = 0; + @override + Widget build(BuildContext context) { + return Scaffold( + floatingActionButton: FloatingActionButton( + heroTag: "btn1", + child: const Icon(Icons.add), + onPressed: () {}, + backgroundColor: Colors.blueAccent, + ), + floatingActionButtonLocation: FloatingActionButtonLocation.centerDocked, + bottomNavigationBar: BottomAppBar( + shape: const CircularNotchedRectangle(), + notchMargin: 10, + // ignore: sized_box_for_whitespace + child: Container( + height: 60, + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + MaterialButton( + minWidth: 40, + onPressed: () { + setState(() { + currentIndex = 0; + }); + }, + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Icon( + Icons.dashboard, + color: currentIndex == 0 ? Colors.blue : Colors.grey, + ), + Text( + 'Home', + style: TextStyle( + color: + currentIndex == 0 ? Colors.blue : Colors.grey, + ), + ), + ], + ), + ), + MaterialButton( + minWidth: 40, + onPressed: () { + setState(() { + currentIndex = 1; + }); + }, + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Icon( + Icons.mail, + color: currentIndex == 1 ? Colors.blue : Colors.grey, + ), + Text( + 'Mail', + style: TextStyle( + color: + currentIndex == 1 ? Colors.blue : Colors.grey, + ), + ), + ], + ), + ), + ], + ), + Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + MaterialButton( + minWidth: 40, + onPressed: () { + setState(() { + currentIndex = 2; + }); + }, + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Icon( + Icons.chat, + color: currentIndex == 2 ? Colors.blue : Colors.grey, + ), + Text( + 'Chat', + style: TextStyle( + color: + currentIndex == 2 ? Colors.blue : Colors.grey, + ), + ), + ], + ), + ), + MaterialButton( + minWidth: 40, + onPressed: () { + setState(() { + currentIndex = 3; + }); + }, + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Icon( + Icons.person, + color: currentIndex == 3 ? Colors.blue : Colors.grey, + ), + Text( + 'Profile', + style: TextStyle( + color: + currentIndex == 3 ? Colors.blue : Colors.grey, + ), + ), + ], + ), + ), + ], + ), + ], + ), + ), + ), + ); + } +} diff --git a/lib/ui_components/bottom_navbars/allBottomNavigationBars/fab_navbars/bottom_navbar5.dart b/lib/ui_components/bottom_navbars/allBottomNavigationBars/fab_navbars/bottom_navbar5.dart new file mode 100644 index 0000000..e9ae477 --- /dev/null +++ b/lib/ui_components/bottom_navbars/allBottomNavigationBars/fab_navbars/bottom_navbar5.dart @@ -0,0 +1,138 @@ +import 'package:flutter/material.dart'; + +class Bottom_Navbar5 extends StatefulWidget { + const Bottom_Navbar5({Key? key}) : super(key: key); + + @override + State createState() => _Bottom_Navbar5State(); +} + +class _Bottom_Navbar5State extends State { + int currentIndex = 0; // Remove the 'late' keyword here + + @override + Widget build(BuildContext context) { + return Scaffold( + floatingActionButton: FloatingActionButton( + heroTag: "btn2", + child: const Icon(Icons.add), + onPressed: () {}, + backgroundColor: Colors.blueAccent, + ), + floatingActionButtonLocation: FloatingActionButtonLocation.endDocked, + bottomNavigationBar: BottomAppBar( + shape: const CircularNotchedRectangle(), + notchMargin: 10, + child: Container( + height: 60, + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + MaterialButton( + minWidth: 40, + onPressed: () { + setState(() { + currentIndex = 0; + }); + }, + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Icon( + Icons.dashboard, + color: currentIndex == 0 ? Colors.blue : Colors.grey, + ), + Text( + 'Home', + style: TextStyle( + color: + currentIndex == 0 ? Colors.blue : Colors.grey, + ), + ), + ], + ), + ), + MaterialButton( + minWidth: 40, + onPressed: () { + setState(() { + currentIndex = 1; + }); + }, + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Icon( + Icons.mail, + color: currentIndex == 1 ? Colors.blue : Colors.grey, + ), + Text( + 'Mail', + style: TextStyle( + color: + currentIndex == 1 ? Colors.blue : Colors.grey, + ), + ), + ], + ), + ), + MaterialButton( + minWidth: 40, + onPressed: () { + setState(() { + currentIndex = 2; + }); + }, + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Icon( + Icons.chat, + color: currentIndex == 2 ? Colors.blue : Colors.grey, + ), + Text( + 'Chat', + style: TextStyle( + color: + currentIndex == 2 ? Colors.blue : Colors.grey, + ), + ), + ], + ), + ), + MaterialButton( + minWidth: 40, + onPressed: () { + setState(() { + currentIndex = 3; + }); + }, + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Icon( + Icons.person, + color: currentIndex == 3 ? Colors.blue : Colors.grey, + ), + Text( + 'Profile', + style: TextStyle( + color: + currentIndex == 3 ? Colors.blue : Colors.grey, + ), + ), + ], + ), + ), + ], + ), + ], + ), + ), + ), + ); + } +} diff --git a/lib/ui_components/bottom_navbars/allBottomNavigationBars/fab_navbars/bottom_navbar6.dart b/lib/ui_components/bottom_navbars/allBottomNavigationBars/fab_navbars/bottom_navbar6.dart new file mode 100644 index 0000000..dd45461 --- /dev/null +++ b/lib/ui_components/bottom_navbars/allBottomNavigationBars/fab_navbars/bottom_navbar6.dart @@ -0,0 +1,140 @@ +import 'package:flutter/material.dart'; + +// ignore: camel_case_types +class Bottom_Navbar6 extends StatefulWidget { + const Bottom_Navbar6({super.key}); + + @override + State createState() => _Bottom_Navbar6State(); +} + +// ignore: camel_case_types +class _Bottom_Navbar6State extends State { + late int currentIndex = 0; + @override + Widget build(BuildContext context) { + return Scaffold( + floatingActionButton: FloatingActionButton( + heroTag: "btn3", + child: const Icon(Icons.add), + onPressed: () {}, + backgroundColor: Colors.blueAccent, + ), + floatingActionButtonLocation: FloatingActionButtonLocation.startDocked, + bottomNavigationBar: BottomAppBar( + shape: const CircularNotchedRectangle(), + notchMargin: 10, + // ignore: sized_box_for_whitespace + child: Container( + height: 60, + child: Row( + mainAxisAlignment: MainAxisAlignment.end, + children: [ + Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + MaterialButton( + minWidth: 40, + onPressed: () { + setState(() { + currentIndex = 0; + }); + }, + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Icon( + Icons.dashboard, + color: currentIndex == 0 ? Colors.blue : Colors.grey, + ), + Text( + 'Home', + style: TextStyle( + color: + currentIndex == 0 ? Colors.blue : Colors.grey, + ), + ), + ], + ), + ), + MaterialButton( + minWidth: 40, + onPressed: () { + setState(() { + currentIndex = 1; + }); + }, + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Icon( + Icons.mail, + color: currentIndex == 1 ? Colors.blue : Colors.grey, + ), + Text( + 'Mail', + style: TextStyle( + color: + currentIndex == 1 ? Colors.blue : Colors.grey, + ), + ), + ], + ), + ), + MaterialButton( + minWidth: 40, + onPressed: () { + setState(() { + currentIndex = 2; + }); + }, + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Icon( + Icons.chat, + color: currentIndex == 2 ? Colors.blue : Colors.grey, + ), + Text( + 'Chat', + style: TextStyle( + color: + currentIndex == 2 ? Colors.blue : Colors.grey, + ), + ), + ], + ), + ), + MaterialButton( + minWidth: 40, + onPressed: () { + setState(() { + currentIndex = 3; + }); + }, + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Icon( + Icons.person, + color: currentIndex == 3 ? Colors.blue : Colors.grey, + ), + Text( + 'Profile', + style: TextStyle( + color: + currentIndex == 3 ? Colors.blue : Colors.grey, + ), + ), + ], + ), + ), + ], + ), + ], + ), + ), + ), + ); + } +} diff --git a/lib/ui_components/bottom_navbars/bottom_navbars.dart b/lib/ui_components/bottom_navbars/bottom_navbars.dart index c6c60b6..30b2888 100644 --- a/lib/ui_components/bottom_navbars/bottom_navbars.dart +++ b/lib/ui_components/bottom_navbars/bottom_navbars.dart @@ -1,10 +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'; -class BottomNavigationBars extends StatelessWidget { - const BottomNavigationBars({super.key}); +class BottomNavBarScreen extends StatefulWidget { + const BottomNavBarScreen({super.key}); + + @override + State createState() => BottomNavBarScreenState(); +} + +class BottomNavBarScreenState extends State { + final basicbottomNavbar = [ + const Bottom_Navbar1(), + const Bottom_Navbar2(), + ]; + List basicbottomNavbarColor = [null, null]; + + final fabbottomNavbar = [ + const Bottom_Navbar3(), + const Bottom_Navbar5(), + const Bottom_Navbar6(), + ]; + List fabbottomNavbarColor = [null, null, null]; + + final animatedbottomNavbar = [ + const Bottom_Navbar4(), + ]; + List animatedbottomNavbarColor = [null]; @override Widget build(BuildContext context) { - return const Placeholder(); + 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], + ), + ), + ], + ), + ), + ], + ), + ), + ), + ), + ], + ), + ), + ), + ); } } From 6015bd4c711fe2044895ff8992efabbcf4350eab Mon Sep 17 00:00:00 2001 From: Uttkarsh-raj Date: Thu, 1 Jun 2023 23:14:05 +0530 Subject: [PATCH 05/11] button map --- lib/provider/favorite_provider.dart | 86 +++++++++++++++++++++++++---- 1 file changed, 76 insertions(+), 10 deletions(-) diff --git a/lib/provider/favorite_provider.dart b/lib/provider/favorite_provider.dart index f68ed8e..4db7e7b 100644 --- a/lib/provider/favorite_provider.dart +++ b/lib/provider/favorite_provider.dart @@ -11,15 +11,78 @@ Color? color; class FavoritesProvider extends ChangeNotifier { List favs = []; Map widgetMap = { - 1: const Button2("button"), - 2: const Button4("button"), - 3: const Button10("button"), - 4: const Button1("button"), - 5: const Button3("button"), - 6: const Button5("button"), - 7: const Button7("button"), - 8: const Button9("button"), - 9: const Button6("button"), + 1: Container( + padding: const EdgeInsets.symmetric( + horizontal: 12, + vertical: 8, + ), + width: double.infinity, + child: const Button2("button"), + ), + 2: Container( + padding: const EdgeInsets.symmetric( + horizontal: 12, + vertical: 8, + ), + width: double.infinity, + child: const Button4("button"), + ), + 3: Container( + padding: const EdgeInsets.symmetric( + horizontal: 12, + vertical: 8, + ), + width: double.infinity, + child: const Button10("button"), + ), + 4: Container( + padding: const EdgeInsets.symmetric( + horizontal: 12, + vertical: 8, + ), + width: double.infinity, + child: const Button1("button"), + ), + 5: Container( + padding: const EdgeInsets.symmetric( + horizontal: 12, + vertical: 8, + ), + width: double.infinity, + child: const Button3("button"), + ), + 6: Container( + padding: const EdgeInsets.symmetric( + horizontal: 12, + vertical: 8, + ), + width: double.infinity, + child: const Button5("button"), + ), + 7: Container( + padding: const EdgeInsets.symmetric( + horizontal: 12, + vertical: 8, + ), + width: double.infinity, + child: const Button7("button"), + ), + 8: Container( + padding: const EdgeInsets.symmetric( + horizontal: 12, + vertical: 8, + ), + width: double.infinity, + child: const Button9("button"), + ), + 9: Container( + padding: const EdgeInsets.symmetric( + horizontal: 12, + vertical: 8, + ), + width: double.infinity, + child: const Button6("button"), + ), 10: const BasicRadioButton(), 11: const RadioButtonwithTextandStyles(), 12: const RadioButtonwithCustomColor(), @@ -241,7 +304,10 @@ class FavoritesProvider extends ChangeNotifier { ), }; void add(Widget item) { - var index = widgetMap.keys.firstWhere((k) => widgetMap[k] == item); + var index = + widgetMap.keys.firstWhere((k) => widgetMap[k] == item, orElse: () => 0); + print(index); + favs.add(index); notifyListeners(); } From e4c546015ec8fcc751489cdf6128fd5c18215608 Mon Sep 17 00:00:00 2001 From: Uttkarsh-raj Date: Sat, 3 Jun 2023 09:26:56 +0530 Subject: [PATCH 06/11] added indexes --- lib/provider/favorite_provider.dart | 2 +- lib/ui_components/alerts/alerts.dart | 3 +++ lib/ui_components/avatars/all_avatars/avatars.dart | 3 +++ lib/ui_components/buttons/buttons.dart | 3 +++ lib/ui_components/cards/cards.dart | 4 ++++ lib/ui_components/input_fields/input_fields.dart | 2 ++ lib/ui_components/messages/messages.dart | 2 ++ lib/ui_components/paginations/paginations.dart | 1 + lib/ui_components/pricing_cards/pricing_cards.dart | 1 + lib/ui_components/radios/radios.dart | 3 ++- .../segmented_controls/segmented_control_screen.dart | 4 +--- lib/ui_components/sliders/sliders.dart | 2 ++ 12 files changed, 25 insertions(+), 5 deletions(-) diff --git a/lib/provider/favorite_provider.dart b/lib/provider/favorite_provider.dart index 4db7e7b..45708cb 100644 --- a/lib/provider/favorite_provider.dart +++ b/lib/provider/favorite_provider.dart @@ -301,7 +301,7 @@ class FavoritesProvider extends ChangeNotifier { containerColor: Colors.white, textColor: Colors.black, hightlightColor: Color(0xFF00C2CB), - ), + ) }; void add(Widget item) { var index = diff --git a/lib/ui_components/alerts/alerts.dart b/lib/ui_components/alerts/alerts.dart index a973cb5..2cdbc08 100644 --- a/lib/ui_components/alerts/alerts.dart +++ b/lib/ui_components/alerts/alerts.dart @@ -33,6 +33,7 @@ class _AlertScreenState extends State { ]; List coluredAlertsColor = [null, null, null, null]; + List coluredAlertsIndex = [14, 15, 16, 17]; final List simpleAlerts = [ const Alert5("AMessage", "ADescriptions"), @@ -42,6 +43,7 @@ class _AlertScreenState extends State { ]; List simpleAlertsColor = [null, null, null, null]; + List simpleAlertsIndex = [18, 19, 20, 21]; final List simpleAlertsDarkMode = [ const Alert9("AMessage", "ADescriptions"), @@ -51,6 +53,7 @@ class _AlertScreenState extends State { ]; List simpleAlertsDarkModeColor = [null, null, null, null]; + List simpleAlertsDarkModeIndex = [22, 23, 24, 25]; @override Widget build(BuildContext context) { diff --git a/lib/ui_components/avatars/all_avatars/avatars.dart b/lib/ui_components/avatars/all_avatars/avatars.dart index 389a474..c1d992e 100644 --- a/lib/ui_components/avatars/all_avatars/avatars.dart +++ b/lib/ui_components/avatars/all_avatars/avatars.dart @@ -31,11 +31,13 @@ class _AvatarScreenState extends State { ]; List textAvatarsColor = [null]; + List textAvatarsIndex = [34]; final List imageAvatars = [ const Avatar1(size: 100, imagePath: 'assets/bored.png'), ]; List imageAvatarsColor = [null]; + List imageAvatarsIndex = [35]; final List iconAvatars = [ const Avatar3( @@ -50,6 +52,7 @@ class _AvatarScreenState extends State { ]; List iconAvatarsColor = [null]; + List iconAvatarsIndex = [36]; @override Widget build(BuildContext context) { diff --git a/lib/ui_components/buttons/buttons.dart b/lib/ui_components/buttons/buttons.dart index 2ea0791..b6814f8 100644 --- a/lib/ui_components/buttons/buttons.dart +++ b/lib/ui_components/buttons/buttons.dart @@ -32,6 +32,7 @@ class _ButtonScreenState extends State { ]; List customOutlineButtonColor = [null, null, null]; + List customOutlineButtonIndex = [1, 2, 3]; final List customElevatedButton = [ const Button1("button"), @@ -41,11 +42,13 @@ class _ButtonScreenState extends State { 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 Widget build(BuildContext context) { diff --git a/lib/ui_components/cards/cards.dart b/lib/ui_components/cards/cards.dart index cff7e69..876c917 100644 --- a/lib/ui_components/cards/cards.dart +++ b/lib/ui_components/cards/cards.dart @@ -25,24 +25,28 @@ class _CardScreenState extends State { 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 Widget build(BuildContext context) { diff --git a/lib/ui_components/input_fields/input_fields.dart b/lib/ui_components/input_fields/input_fields.dart index e5a1932..5a19523 100644 --- a/lib/ui_components/input_fields/input_fields.dart +++ b/lib/ui_components/input_fields/input_fields.dart @@ -40,6 +40,7 @@ class _InputFieldScreenState extends State { ) ]; List textareasColor = [null, null, null, null]; + List textareasIndex = [37, 38, 39, 40]; final List inputfields = [ const InputField1( @@ -64,6 +65,7 @@ class _InputFieldScreenState extends State { ), ]; List inputfieldsColor = [null, null, null, null, null]; + List inputfieldsIndex = [41, 42, 43, 44, 45]; @override Widget build(BuildContext context) { diff --git a/lib/ui_components/messages/messages.dart b/lib/ui_components/messages/messages.dart index 89d8eb0..3b9b9bc 100644 --- a/lib/ui_components/messages/messages.dart +++ b/lib/ui_components/messages/messages.dart @@ -49,6 +49,7 @@ class _MessageScreenState extends State { ]; List inboxMessagesColor = [null, null, null, null]; + List inboxMessagesIndex = [52, 53, 54, 55]; final List bubbleChat = [ const Message1( @@ -66,6 +67,7 @@ class _MessageScreenState extends State { ]; List bubbleChatColor = [null, null, null, null]; + List bubbleChatIndex = [56, 57, 58, 59]; @override Widget build(BuildContext context) { diff --git a/lib/ui_components/paginations/paginations.dart b/lib/ui_components/paginations/paginations.dart index 1c922b6..6ddae6e 100644 --- a/lib/ui_components/paginations/paginations.dart +++ b/lib/ui_components/paginations/paginations.dart @@ -45,6 +45,7 @@ class _PaginationScreenState extends State { ), ]; List pagesLikeButtonColor = [null, null, null, null, null]; + List pagesLikeButtonIndex = [65, 66, 67, 68, 69]; @override Widget build(BuildContext context) { diff --git a/lib/ui_components/pricing_cards/pricing_cards.dart b/lib/ui_components/pricing_cards/pricing_cards.dart index 1ee7445..ab1db56 100644 --- a/lib/ui_components/pricing_cards/pricing_cards.dart +++ b/lib/ui_components/pricing_cards/pricing_cards.dart @@ -31,6 +31,7 @@ class _PricingCardScreenState extends State { ), ]; List pricingCardsColor = [null]; + List pricingCardsIndex = [60]; @override Widget build(BuildContext context) { diff --git a/lib/ui_components/radios/radios.dart b/lib/ui_components/radios/radios.dart index 3c31499..9fc4df9 100644 --- a/lib/ui_components/radios/radios.dart +++ b/lib/ui_components/radios/radios.dart @@ -4,7 +4,6 @@ import 'package:flutter_component_ui/ui_components/radios/radio_widgets/radio_bu 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'; - class RadioScreen extends StatelessWidget { RadioScreen({super.key}); @@ -15,6 +14,8 @@ class RadioScreen extends StatelessWidget { const RadioButtonwithHorizontalLayout(), ]; + List radiosIndex = [10, 11, 12, 13]; + @override Widget build(BuildContext context) { return Scaffold( diff --git a/lib/ui_components/segmented_controls/segmented_control_screen.dart b/lib/ui_components/segmented_controls/segmented_control_screen.dart index c7df272..56b8348 100644 --- a/lib/ui_components/segmented_controls/segmented_control_screen.dart +++ b/lib/ui_components/segmented_controls/segmented_control_screen.dart @@ -26,6 +26,7 @@ class _SegmentedControlScreenState extends State { 2: buildSegment("Text", color), }; List segmentedControlFavColor = [null, null, null, null]; + List segmentedControlFavIndex = [61, 62, 63, 64]; return Scaffold( body: Column( mainAxisAlignment: MainAxisAlignment.center, @@ -88,7 +89,6 @@ class _SegmentedControlScreenState extends State { Consumer( builder: (context, favProviderModel, child) => Column( children: [ - Center( child: RadioChips( values: const ['Text', 'Text', 'Text'], @@ -133,7 +133,6 @@ class _SegmentedControlScreenState extends State { const SizedBox( height: 20, ), - Consumer( builder: (context, favProviderModel, child) => Column( children: [ @@ -232,7 +231,6 @@ class _SegmentedControlScreenState extends State { ], ), ), - ], ), ); diff --git a/lib/ui_components/sliders/sliders.dart b/lib/ui_components/sliders/sliders.dart index 63cf36f..050941f 100644 --- a/lib/ui_components/sliders/sliders.dart +++ b/lib/ui_components/sliders/sliders.dart @@ -27,6 +27,7 @@ class _SliderScreenState extends State { ), ]; List dualPointSliderColor = [null]; + List dualPointSliderIndex = [46]; final List singlePointSlider = [ const Slider1( @@ -56,6 +57,7 @@ class _SliderScreenState extends State { ), ]; List singlePointSliderColor = [null, null, null, null, null]; + List singlePointSliderIndex = [47, 48, 49, 50, 51]; @override Widget build(BuildContext context) { From 31e98aaa1411a44dca1591ab7df1eee374c2ad11 Mon Sep 17 00:00:00 2001 From: Uttkarsh-raj Date: Sat, 3 Jun 2023 10:10:39 +0530 Subject: [PATCH 07/11] both features working fine --- lib/provider/favorite_provider.dart | 8 +- lib/screens/main_app_widgets/fav_page.dart | 15 +- lib/screens/main_app_widgets/search_page.dart | 249 +++++++++--------- lib/ui_components/alerts/alerts.dart | 24 +- .../avatars/all_avatars/avatars.dart | 24 +- lib/ui_components/buttons/buttons.dart | 36 +-- lib/ui_components/cards/cards.dart | 47 +--- .../input_fields/input_fields.dart | 20 +- lib/ui_components/messages/messages.dart | 14 +- .../paginations/paginations.dart | 8 +- .../pricing_cards/pricing_cards.dart | 8 +- .../segmented_control_screen.dart | 34 +-- lib/ui_components/sliders/sliders.dart | 11 +- 13 files changed, 177 insertions(+), 321 deletions(-) diff --git a/lib/provider/favorite_provider.dart b/lib/provider/favorite_provider.dart index 45708cb..54f84ed 100644 --- a/lib/provider/favorite_provider.dart +++ b/lib/provider/favorite_provider.dart @@ -303,12 +303,10 @@ class FavoritesProvider extends ChangeNotifier { hightlightColor: Color(0xFF00C2CB), ) }; - void add(Widget item) { - var index = - widgetMap.keys.firstWhere((k) => widgetMap[k] == item, orElse: () => 0); - print(index); - + void add(int index) { favs.add(index); + print(index); + print(favs); notifyListeners(); } diff --git a/lib/screens/main_app_widgets/fav_page.dart b/lib/screens/main_app_widgets/fav_page.dart index 7f73f26..1d76b8f 100644 --- a/lib/screens/main_app_widgets/fav_page.dart +++ b/lib/screens/main_app_widgets/fav_page.dart @@ -4,9 +4,19 @@ import 'package:flutter_component_ui/theme/theme.dart'; import 'package:google_fonts/google_fonts.dart'; import 'package:provider/provider.dart'; -class FavPage extends StatelessWidget { +class FavPage extends StatefulWidget { const FavPage({super.key}); + @override + State createState() => _FavPageState(); +} + +class _FavPageState extends State { + @override + void initState() { + super.initState(); + } + @override Widget build(BuildContext context) { Future _showMyDialog(Widget item) async { @@ -83,7 +93,8 @@ class FavPage extends StatelessWidget { ), ), Center( - child: favProviderModel.widgetMap[index], + child: favProviderModel + .widgetMap[favProviderModel.favs[index]], ), ], ); diff --git a/lib/screens/main_app_widgets/search_page.dart b/lib/screens/main_app_widgets/search_page.dart index 52815ea..e2a9c72 100644 --- a/lib/screens/main_app_widgets/search_page.dart +++ b/lib/screens/main_app_widgets/search_page.dart @@ -12,63 +12,63 @@ import '../../ui_components/messages/all_messages/bubble_message/message_4.dart' Color? color; //add differnt categories of widgets as a form of List and the label you want to search of it as in the next list -List> allwidgets = [ - [ - const Button2("button"), - const Button4("button"), - const Button10("button"), - ], - [ - const Button1("button"), - const Button3("button"), - const Button5("button"), - const Button7("button"), - const Button9("button") - ], - [ - const Button6("button"), - ], - [ - const BasicRadioButton(), - const RadioButtonwithTextandStyles(), - const RadioButtonwithCustomColor(), - const RadioButtonwithHorizontalLayout(), - ], - [ - const Alert1("AMessage", "ADescriptions"), - const Alert2("AMessage", "ADescriptions"), - const Alert3("AMessage", "ADescriptions"), - const Alert4("AMessage", "ADescriptions"), - ], - [ - const Alert5("AMessage", "ADescriptions"), - const Alert6("AMessage", "ADescriptions"), - const Alert7("AMessage", "ADescriptions"), - const Alert8("AMessage", "ADescriptions"), - ], - [ - const Alert9("AMessage", "ADescriptions"), - const Alert10("AMessage", "ADescriptions"), - const Alert11("AMessage", "ADescriptions"), - const Alert12("AMessage", "ADescriptions"), - ], - [ - const FirstCard(), - const SecondCard(), - ], - const [ - ThirdCard(), - FourthCard(), - ], - const [ - FifthCard(), - SixthCard(), - ], - const [ - SeventhCard(), - EightCard(), - ], - [ +List> allwidgets = [ + { + const Button2("button"): 1, + const Button4("button"): 2, + const Button10("button"): 3, + }, + { + const Button1("button"): 4, + const Button3("button"): 5, + const Button5("button"): 6, + const Button7("button"): 7, + const Button9("button"): 8, + }, + { + const Button6("button"): 9, + }, + { + const BasicRadioButton(): 10, + const RadioButtonwithTextandStyles(): 11, + const RadioButtonwithCustomColor(): 12, + const RadioButtonwithHorizontalLayout(): 13, + }, + { + const Alert1("AMessage", "ADescriptions"): 14, + const Alert2("AMessage", "ADescriptions"): 15, + const Alert3("AMessage", "ADescriptions"): 16, + const Alert4("AMessage", "ADescriptions"): 17, + }, + { + const Alert5("AMessage", "ADescriptions"): 18, + const Alert6("AMessage", "ADescriptions"): 19, + const Alert7("AMessage", "ADescriptions"): 20, + const Alert8("AMessage", "ADescriptions"): 21, + }, + { + const Alert9("AMessage", "ADescriptions"): 22, + const Alert10("AMessage", "ADescriptions"): 23, + const Alert11("AMessage", "ADescriptions"): 24, + const Alert12("AMessage", "ADescriptions"): 25, + }, + { + const FirstCard(): 26, + const SecondCard(): 27, + }, + { + const ThirdCard(): 28, + const FourthCard(): 29, + }, + { + const FifthCard(): 30, + const SixthCard(): 31, + }, + { + const SeventhCard(): 32, + const EightCard(): 33, + }, + { const Avatar2( size: 100, text: Text( @@ -79,12 +79,12 @@ List> allwidgets = [ ), ), backgroundColor: Colors.black, - ), - ], - [ - const Avatar1(size: 100, imagePath: 'assets/bored.png'), - ], - [ + ): 34, + }, + { + const Avatar1(size: 100, imagePath: 'assets/bored.png'): 35, + }, + { const Avatar3( size: 100, icon: Icon( @@ -93,123 +93,123 @@ List> allwidgets = [ size: 50, ), backgroundColor: Colors.black, - ), - ], - [ + ): 36, + }, + { const TextArea1( label: "TextArea1", hinttext: "Write Message", - ), + ): 37, const TextArea2( label: "TextArea2", hinttext: "Write Description", - ), + ): 38, const TextArea3( label: "TextArea3", hinttext: "Write Description", - ), + ): 39, const TextArea4( label: "TextArea4", hinttext: "Write Description", - ) - ], - [ + ): 40 + }, + { const InputField1( label: "Title", hinttext: "Input Title", - ), + ): 41, const InputField2( label: "Title Lite", hinttext: "Input Title", - ), + ): 42, const InputField3( label: "Title Highlighted", hinttext: "Input Title", - ), + ): 43, const InputField4( label: "Title Lite-X", hinttext: "Input Title", - ), + ): 44, const InputField5( label: "Title Type B", hinttext: "Input Title", - ), - ], - [ + ): 45, + }, + { const Slider4( activeColor: Colors.white, inactiveColor: Colors.black, maxRange: 100, - ), - ], - [ + ): 46, + }, + { const Slider1( activeColor: Colors.cyan, inactiveColor: Colors.black, maxRange: 100.0, - ), + ): 47, const Slider3( activeColor: Colors.red, inactiveColor: Colors.white, maxRange: 100, - ), + ): 48, const Slider5( activeColor: Colors.pink, inactiveColor: Colors.amberAccent, maxRange: 100, - ), + ): 49, const Slider6( activeColor: Colors.lightBlueAccent, inactiveColor: Color(0xFF005F99), maxRange: 60, - ), + ): 50, Slider2( activeColor: const Color(0xFF005F99), inactiveColor: Colors.purple.shade600, maxRange: 100, - ), - ], - [ + ): 51, + }, + { const InboxMessage1( name: "ClueLess", username: "clueless@gmail.com", msg: "Hey let's start", imgUrl: 'https://picsum.photos/seed/407/600', - ), + ): 52, const InboxMessage2( name: "ClueLess", username: "clueless@gmail.com", msg: "Hey let's start", imgUrl: 'https://picsum.photos/seed/407/600', - ), + ): 53, const InboxMessage3( name: "ClueLess", username: "clueless@gmail.com", msg: "Hey let's start", imgUrl: 'https://picsum.photos/seed/407/600', - ), + ): 54, const InboxMessage4( name: "ClueLess", username: "clueless@gmail.com", msg: "Hey let's start ", imgUrl: 'https://picsum.photos/seed/407/600', - ), - ], - [ + ): 55, + }, + { const Message1( message: "Hello boy", - ), + ): 56, const Message2( message: "Hello broo", - ), + ): 57, const Message3( message: "Hey whats up man", - ), + ): 58, const Message4( message: "Hello broo", - ), - ], - [ + ): 59, + }, + { const PricingCard1( tier: 'FREE', supportingText: @@ -224,9 +224,9 @@ List> allwidgets = [ textColor: Colors.white, buttonColor: Color(0xff00c2cb), buttonTextColor: Color(0xff0f172a), - ), - ], - [ + ): 60, + }, + { Center( child: SegmentedControlWidget( choices: { @@ -235,7 +235,7 @@ List> allwidgets = [ 2: buildSegment("Year", color), }, ), - ), + ): 61, Center( child: SegmentedControlWidget( choices: { @@ -244,52 +244,53 @@ List> allwidgets = [ 2: buildSegment("Year", color), }, ), - ), + ): 62, Center( child: RadioChips( values: const ['Text', 'Text', 'Text'], onSelected: (index) {}, ), - ), + ): 63, Center( child: RectangularSelections( values: const ['Text', 'Text', 'Text'], onSelected: (index) {}, ), - ), - ], - [ + ): 64, + }, + { const Page1( iconColor: Colors.black, containerColor: Colors.white, textColor: Colors.black, hightlightColor: Color(0xFF005F99), - ), + ): 65, const Page2( iconColor: Colors.black, textColor: Colors.black, // highlightedColor: Colors.blue, - ), + ): 66, const Page3( iconColor: Colors.white, containerColor: Colors.black, textColor: Colors.white, - ), + ): 67, const Page4( iconColor: Colors.black, containerColor: Colors.white, textColor: Colors.black, - ), + ): 68, const Page5( iconColor: Colors.black, containerColor: Colors.white, textColor: Colors.black, hightlightColor: Color(0xFF00C2CB), - ), - ] + ): 69, + } ]; //results get added to this list List results = []; +List resultindex = []; //this list is for converting the stared icon to amber color. List resultStar = []; //the tags wil not search for exact name if it just contains the searched word it will add it @@ -392,8 +393,11 @@ class _SearchPageState extends State { if (tags[i] .toLowerCase() .contains(_controller.text.toLowerCase())) { + allwidgets[i].forEach((key, value) { + results.add(key); + resultindex.add(value); + }); for (int j = 0; j < allwidgets[i].length; j++) { - results.add(allwidgets[i][j]); resultStar.add(null); } } @@ -449,16 +453,7 @@ class _SearchPageState extends State { ), GestureDetector( onTap: () { - favProviderModel.add( - Container( - padding: const EdgeInsets.symmetric( - horizontal: 12, - vertical: 8, - ), - width: double.infinity, - child: results[index], - ), - ); + favProviderModel.add(resultindex[index]); setState(() { resultStar[index] = Colors.amber; }); diff --git a/lib/ui_components/alerts/alerts.dart b/lib/ui_components/alerts/alerts.dart index 2cdbc08..4d9952a 100644 --- a/lib/ui_components/alerts/alerts.dart +++ b/lib/ui_components/alerts/alerts.dart @@ -96,12 +96,8 @@ class _AlertScreenState extends State { ), GestureDetector( onTap: () { - favProviderModel.add( - Padding( - padding: const EdgeInsets.all(8.0), - child: coluredAlerts[index], - ), - ); + favProviderModel + .add(coluredAlertsIndex[index]); setState(() { coluredAlertsColor[index] = Colors.amber; }); @@ -156,12 +152,8 @@ class _AlertScreenState extends State { ), GestureDetector( onTap: () { - favProviderModel.add( - Padding( - padding: const EdgeInsets.all(8.0), - child: simpleAlerts[index], - ), - ); + favProviderModel + .add(simpleAlertsIndex[index]); setState(() { simpleAlertsColor[index] = Colors.amber; }); @@ -216,12 +208,8 @@ class _AlertScreenState extends State { ), GestureDetector( onTap: () { - favProviderModel.add( - Padding( - padding: const EdgeInsets.all(8.0), - child: simpleAlertsDarkMode[index], - ), - ); + favProviderModel + .add(simpleAlertsIndex[index]); setState(() { simpleAlertsDarkModeColor[index] = Colors.amber; diff --git a/lib/ui_components/avatars/all_avatars/avatars.dart b/lib/ui_components/avatars/all_avatars/avatars.dart index c1d992e..7b5b887 100644 --- a/lib/ui_components/avatars/all_avatars/avatars.dart +++ b/lib/ui_components/avatars/all_avatars/avatars.dart @@ -52,7 +52,7 @@ class _AvatarScreenState extends State { ]; List iconAvatarsColor = [null]; - List iconAvatarsIndex = [36]; + List iconAvatarsIndex = [36]; @override Widget build(BuildContext context) { @@ -94,12 +94,7 @@ class _AvatarScreenState extends State { ), GestureDetector( onTap: () { - favProviderModel.add( - Padding( - padding: const EdgeInsets.all(12.0), - child: textAvatars[index], - ), - ); + favProviderModel.add(textAvatarsIndex[index]); setState(() { textAvatarsColor[index] = Colors.amber; }); @@ -147,12 +142,8 @@ class _AvatarScreenState extends State { ), GestureDetector( onTap: () { - favProviderModel.add( - Padding( - padding: const EdgeInsets.all(12.0), - child: imageAvatars[index], - ), - ); + favProviderModel + .add(imageAvatarsIndex[index]); setState(() { imageAvatarsColor[index] = Colors.amber; }); @@ -200,12 +191,7 @@ class _AvatarScreenState extends State { ), GestureDetector( onTap: () { - favProviderModel.add( - Padding( - padding: const EdgeInsets.all(12.0), - child: iconAvatars[index], - ), - ); + favProviderModel.add(iconAvatarsIndex[index]); setState(() { iconAvatarsColor[index] = Colors.amber; }); diff --git a/lib/ui_components/buttons/buttons.dart b/lib/ui_components/buttons/buttons.dart index b6814f8..80f4895 100644 --- a/lib/ui_components/buttons/buttons.dart +++ b/lib/ui_components/buttons/buttons.dart @@ -96,16 +96,8 @@ class _ButtonScreenState extends State { ), GestureDetector( onTap: () { - favProviderModel.add( - Container( - padding: const EdgeInsets.symmetric( - horizontal: 12, - vertical: 8, - ), - width: double.infinity, - child: customElevatedButton[index], - ), - ); + favProviderModel + .add(customElevatedButtonIndex[index]); setState(() { customElevatedButtonColor[index] = Colors.amber; @@ -162,16 +154,8 @@ class _ButtonScreenState extends State { ), GestureDetector( onTap: () { - favProviderModel.add( - Container( - padding: const EdgeInsets.symmetric( - horizontal: 12, - vertical: 8, - ), - width: double.infinity, - child: customOutlineButton[index], - ), - ); + favProviderModel + .add(customElevatedButtonIndex[index]); setState(() { customOutlineButtonColor[index] = Colors.amber; @@ -228,16 +212,8 @@ class _ButtonScreenState extends State { ), GestureDetector( onTap: () { - favProviderModel.add( - Container( - padding: const EdgeInsets.symmetric( - horizontal: 12, - vertical: 8, - ), - width: double.infinity, - child: customTextButton[index], - ), - ); + favProviderModel + .add(customElevatedButtonIndex[index]); setState(() { customTextButtonColor[index] = Colors.amber; }); diff --git a/lib/ui_components/cards/cards.dart b/lib/ui_components/cards/cards.dart index 876c917..213a755 100644 --- a/lib/ui_components/cards/cards.dart +++ b/lib/ui_components/cards/cards.dart @@ -93,16 +93,7 @@ class _CardScreenState extends State { ), GestureDetector( onTap: () { - favProviderModel.add( - Container( - padding: const EdgeInsets.symmetric( - horizontal: 12, - vertical: 8, - ), - width: double.infinity, - child: blogCardList[index], - ), - ); + favProviderModel.add(blogCardListIndex[index]); setState(() { blogCardListColor[index] = Colors.amber; }); @@ -158,16 +149,8 @@ class _CardScreenState extends State { ), GestureDetector( onTap: () { - favProviderModel.add( - Container( - padding: const EdgeInsets.symmetric( - horizontal: 12, - vertical: 8, - ), - width: double.infinity, - child: socialCardList[index], - ), - ); + favProviderModel + .add(socialCardListIndex[index]); setState(() { socialCardListColor[index] = Colors.amber; }); @@ -223,16 +206,8 @@ class _CardScreenState extends State { ), GestureDetector( onTap: () { - favProviderModel.add( - Container( - padding: const EdgeInsets.symmetric( - horizontal: 12, - vertical: 8, - ), - width: double.infinity, - child: blogCardDarKModeList[index], - ), - ); + favProviderModel + .add(blogCardDarKModeListIndex[index]); setState(() { blogCardDarKModeListColor[index] = Colors.amber; @@ -289,16 +264,8 @@ class _CardScreenState extends State { ), GestureDetector( onTap: () { - favProviderModel.add( - Container( - padding: const EdgeInsets.symmetric( - horizontal: 12, - vertical: 8, - ), - width: double.infinity, - child: socialCardDarkModeList[index], - ), - ); + favProviderModel + .add(socialCardDarkModeListIndex[index]); setState(() { socialCardDarkModeListColor[index] = Colors.amber; diff --git a/lib/ui_components/input_fields/input_fields.dart b/lib/ui_components/input_fields/input_fields.dart index 5a19523..3c289a9 100644 --- a/lib/ui_components/input_fields/input_fields.dart +++ b/lib/ui_components/input_fields/input_fields.dart @@ -111,15 +111,7 @@ class _InputFieldScreenState extends State { ), GestureDetector( onTap: () { - favProviderModel.add( - Container( - padding: const EdgeInsets.symmetric( - horizontal: 12, - vertical: 8, - ), - child: inputfields[index], - ), - ); + favProviderModel.add(inputfieldsIndex[index]); setState(() { inputfieldsColor[index] = Colors.amber; }); @@ -174,15 +166,7 @@ class _InputFieldScreenState extends State { ), GestureDetector( onTap: () { - favProviderModel.add( - Container( - padding: const EdgeInsets.symmetric( - horizontal: 12, - vertical: 8, - ), - child: textareas[index], - ), - ); + favProviderModel.add(textareasIndex[index]); setState(() { textareasColor[index] = Colors.amber; }); diff --git a/lib/ui_components/messages/messages.dart b/lib/ui_components/messages/messages.dart index 3b9b9bc..935ddba 100644 --- a/lib/ui_components/messages/messages.dart +++ b/lib/ui_components/messages/messages.dart @@ -112,12 +112,7 @@ class _MessageScreenState extends State { ), GestureDetector( onTap: () { - favProviderModel.add( - Padding( - padding: const EdgeInsets.all(8.0), - child: bubbleChat[index], - ), - ); + favProviderModel.add(bubbleChatIndex[index]); setState(() { bubbleChatColor[index] = Colors.amber; }); @@ -171,12 +166,7 @@ class _MessageScreenState extends State { ), GestureDetector( onTap: () { - favProviderModel.add( - Padding( - padding: const EdgeInsets.all(12.0), - child: inboxMessages[index], - ), - ); + favProviderModel.add(bubbleChatIndex[index]); setState(() { inboxMessagesColor[index] = Colors.amber; }); diff --git a/lib/ui_components/paginations/paginations.dart b/lib/ui_components/paginations/paginations.dart index 6ddae6e..f53f545 100644 --- a/lib/ui_components/paginations/paginations.dart +++ b/lib/ui_components/paginations/paginations.dart @@ -74,13 +74,7 @@ class _PaginationScreenState extends State { ), GestureDetector( onTap: () { - favProviderModel.add( - Padding( - padding: const EdgeInsets.symmetric( - horizontal: 10, vertical: 8), - child: pages[index], - ), - ); + favProviderModel.add(pagesLikeButtonIndex[index]); setState(() { pagesLikeButtonColor[index] = Colors.amber; }); diff --git a/lib/ui_components/pricing_cards/pricing_cards.dart b/lib/ui_components/pricing_cards/pricing_cards.dart index ab1db56..a0c8754 100644 --- a/lib/ui_components/pricing_cards/pricing_cards.dart +++ b/lib/ui_components/pricing_cards/pricing_cards.dart @@ -75,12 +75,8 @@ class _PricingCardScreenState extends State { ), GestureDetector( onTap: () { - favProviderModel.add( - Padding( - padding: const EdgeInsets.all(8.0), - child: pricingCards[index], - ), - ); + favProviderModel + .add(pricingCardsIndex[index]); setState(() { pricingCardsColor[index] = Colors.amber; }); diff --git a/lib/ui_components/segmented_controls/segmented_control_screen.dart b/lib/ui_components/segmented_controls/segmented_control_screen.dart index 56b8348..511cfa9 100644 --- a/lib/ui_components/segmented_controls/segmented_control_screen.dart +++ b/lib/ui_components/segmented_controls/segmented_control_screen.dart @@ -63,14 +63,7 @@ class _SegmentedControlScreenState extends State { ), GestureDetector( onTap: () { - favProviderModel.add( - Center( - child: RectangularSelections( - values: const ['Text', 'Text', 'Text'], - onSelected: (index) {}, - ), - ), - ); + favProviderModel.add(segmentedControlFavIndex[0]); }, child: Icon( Icons.star_border_outlined, @@ -107,14 +100,7 @@ class _SegmentedControlScreenState extends State { ), GestureDetector( onTap: () { - favProviderModel.add( - Center( - child: RadioChips( - values: const ['Text', 'Text', 'Text'], - onSelected: (index) {}, - ), - ), - ); + favProviderModel.add(segmentedControlFavIndex[1]); setState(() { segmentedControlFavColor[2] = Colors.amber; }); @@ -164,13 +150,7 @@ class _SegmentedControlScreenState extends State { ), GestureDetector( onTap: () { - favProviderModel.add( - Center( - child: SegmentedControlWidget( - choices: choices1, - ), - ), - ); + favProviderModel.add(segmentedControlFavIndex[2]); setState(() { segmentedControlFavColor[0] = Colors.amber; }); @@ -209,13 +189,7 @@ class _SegmentedControlScreenState extends State { ), GestureDetector( onTap: () { - favProviderModel.add( - Center( - child: SegmentedControlWidget( - choices: choices, - ), - ), - ); + favProviderModel.add(segmentedControlFavIndex[3]); setState(() { segmentedControlFavColor[1] = Colors.amber; }); diff --git a/lib/ui_components/sliders/sliders.dart b/lib/ui_components/sliders/sliders.dart index 050941f..eb68433 100644 --- a/lib/ui_components/sliders/sliders.dart +++ b/lib/ui_components/sliders/sliders.dart @@ -97,7 +97,8 @@ class _SliderScreenState extends State { ), GestureDetector( onTap: () { - favProviderModel.add(singlePointSlider[index]); + favProviderModel + .add(singlePointSliderIndex[index]); setState(() { singlePointSliderColor[index] = Colors.amber; }); @@ -145,12 +146,8 @@ class _SliderScreenState extends State { ), GestureDetector( onTap: () { - favProviderModel.add( - Padding( - padding: const EdgeInsets.all(12.0), - child: dualPointSlider[index], - ), - ); + favProviderModel + .add(dualPointSliderIndex[index]); setState(() { dualPointSliderColor[index] = Colors.amber; }); From 23483b20367f826e076991dc5a83215da789302e Mon Sep 17 00:00:00 2001 From: Uttkarsh-raj Date: Sat, 3 Jun 2023 10:37:39 +0530 Subject: [PATCH 08/11] all buggs cleared in fav feature.. --- lib/provider/favorite_provider.dart | 5 +++-- lib/screens/main_app_widgets/fav_page.dart | 4 ++-- lib/ui_components/buttons/buttons.dart | 4 ++-- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/lib/provider/favorite_provider.dart b/lib/provider/favorite_provider.dart index 54f84ed..9a886b8 100644 --- a/lib/provider/favorite_provider.dart +++ b/lib/provider/favorite_provider.dart @@ -310,9 +310,10 @@ class FavoritesProvider extends ChangeNotifier { notifyListeners(); } - void remove(Widget item) { - var index = widgetMap.keys.firstWhere((k) => widgetMap[k] == item); + void remove(int index) { favs.remove(index); + print(index); + print(favs); notifyListeners(); } } diff --git a/lib/screens/main_app_widgets/fav_page.dart b/lib/screens/main_app_widgets/fav_page.dart index 1d76b8f..cf2aa45 100644 --- a/lib/screens/main_app_widgets/fav_page.dart +++ b/lib/screens/main_app_widgets/fav_page.dart @@ -19,7 +19,7 @@ class _FavPageState extends State { @override Widget build(BuildContext context) { - Future _showMyDialog(Widget item) async { + Future _showMyDialog(int item) async { return showDialog( context: context, barrierDismissible: false, // user must tap button! @@ -82,7 +82,7 @@ class _FavPageState extends State { children: [ GestureDetector( onTap: () { - _showMyDialog(favProviderModel.widgetMap[index]!); + _showMyDialog(favProviderModel.favs[index]); }, child: const Padding( padding: EdgeInsets.fromLTRB(0, 0, 20, 0), diff --git a/lib/ui_components/buttons/buttons.dart b/lib/ui_components/buttons/buttons.dart index 80f4895..cac3697 100644 --- a/lib/ui_components/buttons/buttons.dart +++ b/lib/ui_components/buttons/buttons.dart @@ -155,7 +155,7 @@ class _ButtonScreenState extends State { GestureDetector( onTap: () { favProviderModel - .add(customElevatedButtonIndex[index]); + .add(customOutlineButtonIndex[index]); setState(() { customOutlineButtonColor[index] = Colors.amber; @@ -213,7 +213,7 @@ class _ButtonScreenState extends State { GestureDetector( onTap: () { favProviderModel - .add(customElevatedButtonIndex[index]); + .add(customTextButtonIndex[index]); setState(() { customTextButtonColor[index] = Colors.amber; }); From 62443f27d5988caa6dd9fe565fe7434e7c46d68a Mon Sep 17 00:00:00 2001 From: Uttkarsh-raj Date: Sat, 3 Jun 2023 19:16:12 +0530 Subject: [PATCH 09/11] save data locally --- lib/data/hive_database.dart | 12 ++++++++++++ lib/main.dart | 5 ++++- lib/provider/favorite_provider.dart | 15 +++++++++++++++ lib/screens/main_app_widgets/home_page.dart | 8 ++++++++ pubspec.lock | 16 ++++++++++++++++ pubspec.yaml | 2 ++ 6 files changed, 57 insertions(+), 1 deletion(-) create mode 100644 lib/data/hive_database.dart diff --git a/lib/data/hive_database.dart b/lib/data/hive_database.dart new file mode 100644 index 0000000..7daf88c --- /dev/null +++ b/lib/data/hive_database.dart @@ -0,0 +1,12 @@ +import 'package:hive/hive.dart'; + +class HiveDatabase { + final _myDatabase = Hive.box("favorites_database"); + void saveData(List favs) { + _myDatabase.put("Favs", favs); + } + + List readData() { + return _myDatabase.get("Favs") ?? []; + } +} diff --git a/lib/main.dart b/lib/main.dart index 2e6928c..9a798a8 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -4,11 +4,14 @@ import 'package:flutter/material.dart'; import 'package:flutter_component_ui/provider/favorite_provider.dart'; import 'package:flutter_component_ui/screens/splash_screen.dart'; import 'package:flutter_component_ui/theme/theme.dart'; +import 'package:hive_flutter/adapters.dart'; import 'package:provider/provider.dart'; import 'screens/main_page.dart'; -void main() { +void main() async { + await Hive.initFlutter(); + await Hive.openBox("favorites_database"); runApp(const MyApp()); } diff --git a/lib/provider/favorite_provider.dart b/lib/provider/favorite_provider.dart index 9a886b8..a624b36 100644 --- a/lib/provider/favorite_provider.dart +++ b/lib/provider/favorite_provider.dart @@ -1,4 +1,5 @@ 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'; @@ -303,10 +304,22 @@ class FavoritesProvider extends ChangeNotifier { hightlightColor: Color(0xFF00C2CB), ) }; + + final db = HiveDatabase(); + void prepareData() { + if (db.readData().isNotEmpty) { + print(db.readData()); + favs = db.readData(); + print(favs); + } + } + void add(int index) { favs.add(index); print(index); print(favs); + db.saveData(favs); + print(db.readData()); notifyListeners(); } @@ -314,6 +327,8 @@ class FavoritesProvider extends ChangeNotifier { favs.remove(index); print(index); print(favs); + db.saveData(favs); + print(db.readData()); notifyListeners(); } } diff --git a/lib/screens/main_app_widgets/home_page.dart b/lib/screens/main_app_widgets/home_page.dart index f757e2c..43aeefb 100644 --- a/lib/screens/main_app_widgets/home_page.dart +++ b/lib/screens/main_app_widgets/home_page.dart @@ -1,8 +1,10 @@ import 'package:flutter/material.dart'; +import 'package:flutter_component_ui/data/export.dart'; import 'package:google_fonts/google_fonts.dart'; import 'package:flutter_staggered_grid_view/flutter_staggered_grid_view.dart'; import 'package:flutter_component_ui/data/widget_category.dart'; import 'package:flutter_component_ui/screens/main_app_widgets/components_card.dart'; +import 'package:provider/provider.dart'; class Home extends StatefulWidget { const Home({super.key}); @@ -12,6 +14,12 @@ class Home extends StatefulWidget { } class _HomeState extends State { + @override + void initState() { + Provider.of(context, listen: false).prepareData(); + super.initState(); + } + @override Widget build(BuildContext context) { return Scaffold( diff --git a/pubspec.lock b/pubspec.lock index 996fe65..0565c46 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -152,6 +152,22 @@ packages: url: "https://pub.dev" source: hosted version: "4.0.3" + hive: + dependency: "direct main" + description: + name: hive + sha256: "8dcf6db979d7933da8217edcec84e9df1bdb4e4edc7fc77dbd5aa74356d6d941" + url: "https://pub.dev" + source: hosted + version: "2.2.3" + hive_flutter: + dependency: "direct main" + description: + name: hive_flutter + sha256: dca1da446b1d808a51689fb5d0c6c9510c0a2ba01e22805d492c73b68e33eecc + url: "https://pub.dev" + source: hosted + version: "1.1.0" http: dependency: "direct main" description: diff --git a/pubspec.yaml b/pubspec.yaml index 41758de..339d08c 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -44,6 +44,8 @@ dependencies: clipboard: ^0.1.3 provider: ^6.0.5 flutter_spinkit: ^5.2.0 + hive: ^2.2.3 + hive_flutter: ^1.1.0 dev_dependencies: flutter_test: From f9fb9dc729cdba2bcb59740b9a596eb311534175 Mon Sep 17 00:00:00 2001 From: Uttkarsh-raj Date: Sat, 3 Jun 2023 19:18:22 +0530 Subject: [PATCH 10/11] solved all problems --- lib/data/widget_category.dart | 2 +- lib/provider/favorite_provider.dart | 8 -------- lib/screens/main_app_widgets/fav_page.dart | 4 ++-- lib/ui_components/radios/radios.dart | 9 +++++++-- 4 files changed, 10 insertions(+), 13 deletions(-) diff --git a/lib/data/widget_category.dart b/lib/data/widget_category.dart index 7a70317..6222e9b 100644 --- a/lib/data/widget_category.dart +++ b/lib/data/widget_category.dart @@ -64,7 +64,7 @@ final List> widgetCategoryData = [ }, { 'categoryName': 'Radio', - 'categoryScreen': RadioScreen(), + 'categoryScreen': const RadioScreen(), }, { 'categoryName': 'Stepper', diff --git a/lib/provider/favorite_provider.dart b/lib/provider/favorite_provider.dart index a624b36..dc28330 100644 --- a/lib/provider/favorite_provider.dart +++ b/lib/provider/favorite_provider.dart @@ -308,27 +308,19 @@ class FavoritesProvider extends ChangeNotifier { final db = HiveDatabase(); void prepareData() { if (db.readData().isNotEmpty) { - print(db.readData()); favs = db.readData(); - print(favs); } } void add(int index) { favs.add(index); - print(index); - print(favs); db.saveData(favs); - print(db.readData()); notifyListeners(); } void remove(int index) { favs.remove(index); - print(index); - print(favs); db.saveData(favs); - print(db.readData()); notifyListeners(); } } diff --git a/lib/screens/main_app_widgets/fav_page.dart b/lib/screens/main_app_widgets/fav_page.dart index cf2aa45..f1f22ed 100644 --- a/lib/screens/main_app_widgets/fav_page.dart +++ b/lib/screens/main_app_widgets/fav_page.dart @@ -19,7 +19,7 @@ class _FavPageState extends State { @override Widget build(BuildContext context) { - Future _showMyDialog(int item) async { + Future showMyDialog(int item) async { return showDialog( context: context, barrierDismissible: false, // user must tap button! @@ -82,7 +82,7 @@ class _FavPageState extends State { children: [ GestureDetector( onTap: () { - _showMyDialog(favProviderModel.favs[index]); + showMyDialog(favProviderModel.favs[index]); }, child: const Padding( padding: EdgeInsets.fromLTRB(0, 0, 20, 0), diff --git a/lib/ui_components/radios/radios.dart b/lib/ui_components/radios/radios.dart index 9fc4df9..87bb95f 100644 --- a/lib/ui_components/radios/radios.dart +++ b/lib/ui_components/radios/radios.dart @@ -4,9 +4,14 @@ import 'package:flutter_component_ui/ui_components/radios/radio_widgets/radio_bu 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'; -class RadioScreen extends StatelessWidget { - RadioScreen({super.key}); +class RadioScreen extends StatefulWidget { + const RadioScreen({super.key}); + @override + State createState() => _RadioScreenState(); +} + +class _RadioScreenState extends State { final List radios = [ const BasicRadioButton(), const RadioButtonwithTextandStyles(), From 09f96e6eb558be722a35667a69dd415ea45114d2 Mon Sep 17 00:00:00 2001 From: Uttkarsh-raj Date: Sun, 4 Jun 2023 10:46:37 +0530 Subject: [PATCH 11/11] mapped widgets improvement --- lib/data/widget_category.dart | 10 +- lib/provider/favorite_provider.dart | 512 ++++++++++++++++------- lib/ui_components/messages/messages.dart | 2 +- pubspec.lock | 26 +- 4 files changed, 365 insertions(+), 185 deletions(-) diff --git a/lib/data/widget_category.dart b/lib/data/widget_category.dart index 6222e9b..fe322e0 100644 --- a/lib/data/widget_category.dart +++ b/lib/data/widget_category.dart @@ -9,7 +9,7 @@ import 'package:flutter_component_ui/ui_components/pricing_cards/pricing_cards.d import 'package:flutter_component_ui/ui_components/segmented_controls/segmented_control_screen.dart'; import 'package:flutter_component_ui/ui_components/steppers/steppers.dart'; -import '../ui_components/progress_bars/progress_bars.dart'; +// import '../ui_components/progress_bars/progress_bars.dart'; import '../ui_components/radios/radios.dart'; import '../ui_components/sliders/sliders.dart'; @@ -70,8 +70,8 @@ final List> widgetCategoryData = [ 'categoryName': 'Stepper', 'categoryScreen': StepperScreen(), }, - { - 'categoryName': 'Progress Bars', - 'categoryScreen': const ProgressBar(), - }, + // { + // 'categoryName': 'Progress Bars', + // 'categoryScreen': const ProgressBar(), + // }, ]; diff --git a/lib/provider/favorite_provider.dart b/lib/provider/favorite_provider.dart index a41db41..0f5a1aa 100644 --- a/lib/provider/favorite_provider.dart +++ b/lib/provider/favorite_provider.dart @@ -11,6 +11,7 @@ Color? color; class FavoritesProvider extends ChangeNotifier { List favs = []; + Map widgetMap = { 1: Container( padding: const EdgeInsets.symmetric( @@ -88,97 +89,255 @@ class FavoritesProvider extends ChangeNotifier { 11: const RadioButtonwithTextandStyles(), 12: const RadioButtonwithCustomColor(), 13: const RadioButtonwithHorizontalLayout(), - 14: const Alert1("AMessage", "ADescriptions"), - 15: const Alert2("AMessage", "ADescriptions"), - 16: const Alert3("AMessage", "ADescriptions"), - 17: const Alert4("AMessage", "ADescriptions"), - 18: const Alert5("AMessage", "ADescriptions"), - 19: const Alert6("AMessage", "ADescriptions"), - 20: const Alert7("AMessage", "ADescriptions"), - 21: const Alert8("AMessage", "ADescriptions"), - 22: const Alert9("AMessage", "ADescriptions"), - 23: const Alert10("AMessage", "ADescriptions"), - 24: const Alert11("AMessage", "ADescriptions"), - 25: const Alert12("AMessage", "ADescriptions"), - 26: const FirstCard(), - 27: const SecondCard(), - 28: const ThirdCard(), - 29: const FourthCard(), - 30: const FifthCard(), - 31: const SixthCard(), - 32: const SeventhCard(), - 33: const EightCard(), - 34: const Avatar2( - size: 100, - text: Text( - 'AZ', - style: TextStyle( - color: Colors.white, - fontSize: 30, + 14: const Padding( + padding: EdgeInsets.all(8.0), + child: Alert1("AMessage", "ADescriptions"), + ), + 15: const Padding( + padding: EdgeInsets.all(8.0), + child: Alert2("AMessage", "ADescriptions"), + ), + 16: const Padding( + padding: EdgeInsets.all(8.0), + child: Alert3("AMessage", "ADescriptions"), + ), + 17: const Padding( + padding: EdgeInsets.all(8.0), + child: Alert4("AMessage", "ADescriptions"), + ), + 18: const Padding( + padding: EdgeInsets.all(8.0), + child: Alert5("AMessage", "ADescriptions"), + ), + 19: const Padding( + padding: EdgeInsets.all(8.0), + child: Alert6("AMessage", "ADescriptions"), + ), + 20: const Padding( + padding: EdgeInsets.all(8.0), + child: Alert7("AMessage", "ADescriptions"), + ), + 21: const Padding( + padding: EdgeInsets.all(8.0), + child: Alert8("AMessage", "ADescriptions"), + ), + 22: const Padding( + padding: EdgeInsets.all(8.0), + child: Alert9("AMessage", "ADescriptions"), + ), + 23: const Padding( + padding: EdgeInsets.all(8.0), + child: Alert10("AMessage", "ADescriptions"), + ), + 24: const Padding( + padding: EdgeInsets.all(8.0), + child: Alert11("AMessage", "ADescriptions"), + ), + 25: const Padding( + padding: EdgeInsets.all(8.0), + child: Alert12("AMessage", "ADescriptions"), + ), + 26: Container( + padding: const EdgeInsets.symmetric( + horizontal: 12, + vertical: 8, + ), + width: double.infinity, + child: const FirstCard(), + ), + 27: Container( + padding: const EdgeInsets.symmetric( + horizontal: 12, + vertical: 8, + ), + width: double.infinity, + child: const SecondCard(), + ), + 28: Container( + padding: const EdgeInsets.symmetric( + horizontal: 12, + vertical: 8, + ), + width: double.infinity, + child: const ThirdCard(), + ), + 29: Container( + padding: const EdgeInsets.symmetric( + horizontal: 12, + vertical: 8, + ), + width: double.infinity, + child: const FourthCard(), + ), + 30: Container( + padding: const EdgeInsets.symmetric( + horizontal: 12, + vertical: 8, + ), + width: double.infinity, + child: const FifthCard(), + ), + 31: Container( + padding: const EdgeInsets.symmetric( + horizontal: 12, + vertical: 8, + ), + width: double.infinity, + child: const SixthCard(), + ), + 32: Container( + padding: const EdgeInsets.symmetric( + horizontal: 12, + vertical: 8, + ), + width: double.infinity, + child: const SeventhCard(), + ), + 33: Container( + padding: const EdgeInsets.symmetric( + horizontal: 12, + vertical: 8, + ), + width: double.infinity, + child: const EightCard(), + ), + 34: const Padding( + padding: EdgeInsets.all(12.0), + child: Avatar2( + size: 100, + text: Text( + 'AZ', + style: TextStyle( + color: Colors.white, + fontSize: 30, + ), ), + backgroundColor: Colors.black, ), - backgroundColor: Colors.black, ), - 35: const Avatar1(size: 100, imagePath: 'assets/bored.png'), - 36: const Avatar3( - size: 100, - icon: Icon( - Icons.person_2_outlined, - color: Colors.white, - size: 50, + 35: const Padding( + padding: EdgeInsets.all(12.0), + child: Avatar1(size: 100, imagePath: 'assets/bored.png'), + ), + 36: const Padding( + padding: EdgeInsets.all(12.0), + child: Avatar3( + size: 100, + icon: Icon( + Icons.person_2_outlined, + color: Colors.white, + size: 50, + ), + backgroundColor: Colors.black, ), - backgroundColor: Colors.black, ), - 37: const TextArea1( - label: "TextArea1", - hinttext: "Write Message", + 37: Container( + padding: const EdgeInsets.symmetric( + horizontal: 12, + vertical: 8, + ), + child: const TextArea1( + label: "TextArea1", + hinttext: "Write Message", + ), ), - 38: const TextArea2( - label: "TextArea2", - hinttext: "Write Description", + 38: Container( + padding: const EdgeInsets.symmetric( + horizontal: 12, + vertical: 8, + ), + child: const TextArea2( + label: "TextArea2", + hinttext: "Write Description", + ), ), - 39: const TextArea3( - label: "TextArea3", - hinttext: "Write Description", + 39: Container( + padding: const EdgeInsets.symmetric( + horizontal: 12, + vertical: 8, + ), + child: const TextArea3( + label: "TextArea3", + hinttext: "Write Description", + ), ), - 40: const TextArea4( - label: "TextArea4", - hinttext: "Write Description", + 40: Container( + padding: const EdgeInsets.symmetric( + horizontal: 12, + vertical: 8, + ), + child: const TextArea4( + label: "TextArea4", + hinttext: "Write Description", + ), ), - 41: const InputField1( - label: "Title", - hinttext: "Input Title", + 41: Container( + padding: const EdgeInsets.symmetric( + horizontal: 12, + vertical: 8, + ), + child: const InputField1( + label: "Title", + hinttext: "Input Title", + ), ), - 42: const InputField2( - label: "Title Lite", - hinttext: "Input Title", + 42: Container( + padding: const EdgeInsets.symmetric( + horizontal: 12, + vertical: 8, + ), + child: const InputField2( + label: "Title Lite", + hinttext: "Input Title", + ), ), 43: const InputField3( label: "Title Highlighted", hinttext: "Input Title", ), - 44: const InputField4( - label: "Title Lite-X", - hinttext: "Input Title", + 44: Container( + padding: const EdgeInsets.symmetric( + horizontal: 12, + vertical: 8, + ), + child: const InputField4( + label: "Title Lite-X", + hinttext: "Input Title", + ), ), - 45: const InputField5( - label: "Title Type B", - hinttext: "Input Title", + 45: Container( + padding: const EdgeInsets.symmetric( + horizontal: 12, + vertical: 8, + ), + child: const InputField5( + label: "Title Type B", + hinttext: "Input Title", + ), ), - 46: const Slider4( - activeColor: Colors.white, - inactiveColor: Colors.black, - maxRange: 100, + 46: const Padding( + padding: EdgeInsets.all(12.0), + child: Slider4( + activeColor: Colors.white, + inactiveColor: Colors.black, + maxRange: 100, + ), ), - 47: const Slider1( - activeColor: Colors.cyan, - inactiveColor: Colors.black, - maxRange: 100.0, + 47: const Padding( + padding: EdgeInsets.all(12.0), + child: Slider1( + activeColor: Colors.cyan, + inactiveColor: Colors.black, + maxRange: 100.0, + ), ), - 48: const Slider3( - activeColor: Colors.red, - inactiveColor: Colors.white, - maxRange: 100, + 48: const Padding( + padding: EdgeInsets.all(12.0), + child: Slider3( + activeColor: Colors.red, + inactiveColor: Colors.white, + maxRange: 100, + ), ), // 49: const Slider5( // activeColor: Colors.pink, @@ -190,61 +349,91 @@ class FavoritesProvider extends ChangeNotifier { // inactiveColor: Color(0xFF005F99), // maxRange: 60, // ), - 51: Slider2( - activeColor: const Color(0xFF005F99), - inactiveColor: Colors.purple.shade600, - maxRange: 100, - ), - 52: const InboxMessage1( - name: "ClueLess", - username: "clueless@gmail.com", - msg: "Hey let's start", - imgUrl: 'https://picsum.photos/seed/407/600', - ), - 53: const InboxMessage2( - name: "ClueLess", - username: "clueless@gmail.com", - msg: "Hey let's start", - imgUrl: 'https://picsum.photos/seed/407/600', - ), - 54: const InboxMessage3( - name: "ClueLess", - username: "clueless@gmail.com", - msg: "Hey let's start", - imgUrl: 'https://picsum.photos/seed/407/600', - ), - 55: const InboxMessage4( - name: "ClueLess", - username: "clueless@gmail.com", - msg: "Hey let's start ", - imgUrl: 'https://picsum.photos/seed/407/600', - ), - 56: const Message1( - message: "Hello boy", - ), - 57: const Message2( - message: "Hello broo", - ), - 58: const Message3( - message: "Hey whats up man", - ), - 59: const Message4( - message: "Hello broo", - ), - 60: const PricingCard1( - tier: 'FREE', - supportingText: - 'For those who want to try our services with no commitment', - price: '\$0', - period: 'month', - details: [ - 'Easily receive new glasses on a regular basis', - 'More cost-effective than buying glasses individually', - ], - cardColor: Color(0xff0f172a), - textColor: Colors.white, - buttonColor: Color(0xff00c2cb), - buttonTextColor: Color(0xff0f172a), + 51: Padding( + padding: const EdgeInsets.all(12.0), + child: Slider2( + activeColor: const Color(0xFF005F99), + inactiveColor: Colors.purple.shade600, + maxRange: 100, + ), + ), + 52: const Padding( + padding: EdgeInsets.all(8.0), + child: InboxMessage1( + name: "ClueLess", + username: "clueless@gmail.com", + msg: "Hey let's start", + imgUrl: 'https://picsum.photos/seed/407/600', + ), + ), + 53: const Padding( + padding: EdgeInsets.all(8.0), + child: InboxMessage2( + name: "ClueLess", + username: "clueless@gmail.com", + msg: "Hey let's start", + imgUrl: 'https://picsum.photos/seed/407/600', + ), + ), + 54: const Padding( + padding: EdgeInsets.all(8.0), + child: InboxMessage3( + name: "ClueLess", + username: "clueless@gmail.com", + msg: "Hey let's start", + imgUrl: 'https://picsum.photos/seed/407/600', + ), + ), + 55: const Padding( + padding: EdgeInsets.all(8.0), + child: InboxMessage4( + name: "ClueLess", + username: "clueless@gmail.com", + msg: "Hey let's start ", + imgUrl: 'https://picsum.photos/seed/407/600', + ), + ), + 56: const Padding( + padding: EdgeInsets.all(8.0), + child: Message1( + message: "Hello boy", + ), + ), + 57: const Padding( + padding: EdgeInsets.all(8.0), + child: Message2( + message: "Hello broo", + ), + ), + 58: const Padding( + padding: EdgeInsets.all(8.0), + child: Message3( + message: "Hey whats up man", + ), + ), + 59: const Padding( + padding: EdgeInsets.all(8.0), + child: Message4( + message: "Hello broo", + ), + ), + 60: const Padding( + padding: EdgeInsets.all(8.0), + child: PricingCard1( + tier: 'FREE', + supportingText: + 'For those who want to try our services with no commitment', + price: '\$0', + period: 'month', + details: [ + 'Easily receive new glasses on a regular basis', + 'More cost-effective than buying glasses individually', + ], + cardColor: Color(0xff0f172a), + textColor: Colors.white, + buttonColor: Color(0xff00c2cb), + buttonTextColor: Color(0xff0f172a), + ), ), 61: Center( child: SegmentedControlWidget( @@ -276,33 +465,48 @@ class FavoritesProvider extends ChangeNotifier { onSelected: (index) {}, ), ), - 65: const Page1( - iconColor: Colors.black, - containerColor: Colors.white, - textColor: Colors.black, - hightlightColor: Color(0xFF005F99), - ), - 66: const Page2( - iconColor: Colors.black, - textColor: Colors.black, - // highlightedColor: Colors.blue, - ), - 67: const Page3( - iconColor: Colors.white, - containerColor: Colors.black, - textColor: Colors.white, - ), - 68: const Page4( - iconColor: Colors.black, - containerColor: Colors.white, - textColor: Colors.black, - ), - 69: const Page5( - iconColor: Colors.black, - containerColor: Colors.white, - textColor: Colors.black, - hightlightColor: Color(0xFF00C2CB), - ) + 65: const Padding( + padding: EdgeInsets.symmetric(horizontal: 10, vertical: 8), + child: Page1( + iconColor: Colors.black, + containerColor: Colors.white, + textColor: Colors.black, + hightlightColor: Color(0xFF005F99), + ), + ), + 66: const Padding( + padding: EdgeInsets.symmetric(horizontal: 10, vertical: 8), + child: Page2( + iconColor: Colors.black, + textColor: Colors.black, + // highlightedColor: Colors.blue, + ), + ), + 67: const Padding( + padding: EdgeInsets.symmetric(horizontal: 10, vertical: 8), + child: Page3( + iconColor: Colors.white, + containerColor: Colors.black, + textColor: Colors.white, + ), + ), + 68: const Padding( + padding: EdgeInsets.symmetric(horizontal: 10, vertical: 8), + child: Page4( + iconColor: Colors.black, + containerColor: Colors.white, + textColor: Colors.black, + ), + ), + 69: const Padding( + padding: EdgeInsets.symmetric(horizontal: 10, vertical: 8), + child: Page5( + iconColor: Colors.black, + containerColor: Colors.white, + textColor: Colors.black, + hightlightColor: Color(0xFF00C2CB), + ), + ), }; final db = HiveDatabase(); diff --git a/lib/ui_components/messages/messages.dart b/lib/ui_components/messages/messages.dart index 935ddba..4bc27e0 100644 --- a/lib/ui_components/messages/messages.dart +++ b/lib/ui_components/messages/messages.dart @@ -166,7 +166,7 @@ class _MessageScreenState extends State { ), GestureDetector( onTap: () { - favProviderModel.add(bubbleChatIndex[index]); + favProviderModel.add(inboxMessagesIndex[index]); setState(() { inboxMessagesColor[index] = Colors.amber; }); diff --git a/pubspec.lock b/pubspec.lock index 18c7736..24f5ce3 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -148,7 +148,7 @@ packages: dependency: "direct main" description: name: google_fonts - sha256: "6b6f10f0ce3c42f6552d1c70d2c28d764cf22bb487f50f66cca31dcd5194f4d6" + sha256: "927573f2e8a8d65c17931e21918ad0ab0666b1b636537de7c4932bdb487b190f" url: "https://pub.dev" source: hosted version: "4.0.3" @@ -401,27 +401,10 @@ packages: dependency: transitive description: name: url_launcher_android -<<<<<<< HEAD -======= - ->>>>>>> 18525738752460ec578489b4ff43a969d80a70c9 sha256: eed4e6a1164aa9794409325c3b707ff424d4d1c2a785e7db67f8bbda00e36e51 url: "https://pub.dev" source: hosted version: "6.0.35" -<<<<<<< HEAD -======= - sha256: "1a5848f598acc5b7d8f7c18b8cb834ab667e59a13edc3c93e9d09cf38cc6bc87" - url: "https://pub.dev" - source: hosted - version: "6.0.34" - - sha256: eed4e6a1164aa9794409325c3b707ff424d4d1c2a785e7db67f8bbda00e36e51 - url: "https://pub.dev" - source: hosted - version: "6.0.35" - ->>>>>>> 18525738752460ec578489b4ff43a969d80a70c9 url_launcher_ios: dependency: transitive description: @@ -495,12 +478,5 @@ packages: source: hosted version: "1.0.0" sdks: -<<<<<<< HEAD - dart: ">=3.0.0-0 <4.0.0" -======= - - dart: ">=2.19.0 <3.0.0" dart: ">=3.0.0-0 <4.0.0" - dart: ">=2.19.0 <3.0.0" ->>>>>>> 18525738752460ec578489b4ff43a969d80a70c9 flutter: ">=3.3.0"