From 5e00e6163aad20dfa02995896abef107aee190a0 Mon Sep 17 00:00:00 2001 From: Alexey Leonenko <93009588+trullse@users.noreply.github.com> Date: Wed, 16 Jul 2025 10:11:39 +0300 Subject: [PATCH 1/3] add secondary button customization (#87) --- .../pages/suggestion/suggestion_page.dart | 6 ++++-- .../presentation/pages/theme/suggestions_theme.dart | 11 +++++++++++ 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/lib/src/presentation/pages/suggestion/suggestion_page.dart b/lib/src/presentation/pages/suggestion/suggestion_page.dart index 93dc93c..82e7353 100644 --- a/lib/src/presentation/pages/suggestion/suggestion_page.dart +++ b/lib/src/presentation/pages/suggestion/suggestion_page.dart @@ -797,10 +797,12 @@ class _NewCommentButton extends StatelessWidget { child: FilledButton( style: context.theme.filledButtonTheme.style?.copyWith( backgroundColor: WidgetStateProperty.resolveWith( - (states) => context.theme.colorScheme.secondaryContainer, + (states) => theme.secondaryButtonBackgroundColor ?? + context.theme.colorScheme.secondaryContainer, ), foregroundColor: WidgetStatePropertyAll( - context.theme.colorScheme.onSecondaryContainer, + theme.secondaryButtonForegroundColor ?? + context.theme.colorScheme.onSecondaryContainer, ), ), onPressed: onClick, diff --git a/lib/src/presentation/pages/theme/suggestions_theme.dart b/lib/src/presentation/pages/theme/suggestions_theme.dart index 23a1d1b..4ca8a7c 100644 --- a/lib/src/presentation/pages/theme/suggestions_theme.dart +++ b/lib/src/presentation/pages/theme/suggestions_theme.dart @@ -17,7 +17,10 @@ class SuggestionsTheme { final Color featureLabelColor; final Color bugLabelColor; + final Color? backgroundColor; + final Color? secondaryButtonBackgroundColor; + final Color? secondaryButtonForegroundColor; SuggestionsTheme({ required this.actionColor, @@ -35,6 +38,8 @@ class SuggestionsTheme { required this.fade, required this.fabColor, this.backgroundColor, + this.secondaryButtonBackgroundColor, + this.secondaryButtonForegroundColor, }); factory SuggestionsTheme.initial() => SuggestionsTheme( @@ -70,6 +75,8 @@ class SuggestionsTheme { Color? fade, Color? fabColor, Color? backgroundColor, + Color? secondaryButtonBackgroundColor, + Color? secondaryButtonForegroundColor, }) { return SuggestionsTheme( actionColor: actionColor ?? this.actionColor, @@ -88,6 +95,10 @@ class SuggestionsTheme { fade: fade ?? this.fade, fabColor: fabColor ?? this.fabColor, backgroundColor: backgroundColor ?? this.backgroundColor, + secondaryButtonBackgroundColor: + secondaryButtonBackgroundColor ?? this.secondaryButtonBackgroundColor, + secondaryButtonForegroundColor: + secondaryButtonForegroundColor ?? this.secondaryButtonForegroundColor, ); } } From d771b3c7159f61f7afe97d54b220320b8acafc6d Mon Sep 17 00:00:00 2001 From: Alexey Leonenko <93009588+trullse@users.noreply.github.com> Date: Wed, 16 Jul 2025 10:12:05 +0300 Subject: [PATCH 2/3] fix: suggestions editing (#86) --- example/.vscode/launch.json | 11 +++++++++++ lib/src/presentation/di/injector.dart | 19 +++++++++++++------ .../pages/suggestion/suggestion_page.dart | 7 ++----- 3 files changed, 26 insertions(+), 11 deletions(-) create mode 100644 example/.vscode/launch.json diff --git a/example/.vscode/launch.json b/example/.vscode/launch.json new file mode 100644 index 0000000..c8a15c4 --- /dev/null +++ b/example/.vscode/launch.json @@ -0,0 +1,11 @@ +{ + "version": "0.2.0", + "configurations": [ + { + "name": "Example", + "request": "launch", + "type": "dart", + "program": "lib/main.dart", + }, + ] +} \ No newline at end of file diff --git a/lib/src/presentation/di/injector.dart b/lib/src/presentation/di/injector.dart index 137f2b9..1ac4000 100644 --- a/lib/src/presentation/di/injector.dart +++ b/lib/src/presentation/di/injector.dart @@ -38,18 +38,25 @@ class _Injector { _theme = theme; _imageHeaders = imageHeaders; _userId = userId; - _cacheDataSource = CacheDataSourceImpl(); - _suggestionsDataSource = suggestionsDataSource; - _suggestionRepository = SuggestionRepositoryImpl( - _suggestionsDataSource, - _cacheDataSource, - ); + + if (!_isInitialized) { + _cacheDataSource = CacheDataSourceImpl(); + _suggestionsDataSource = suggestionsDataSource; + _suggestionRepository = SuggestionRepositoryImpl( + _suggestionsDataSource, + _cacheDataSource, + ); + _isInitialized = true; + } + _adminSettings = adminSettings; _isAdmin = isAdmin; _localization = locale.localizationOptions; _navigatorKey = navigatorKey; } + bool _isInitialized = false; + AdminSettings? _adminSettings; AdminSettings? get adminSettings => _adminSettings; diff --git a/lib/src/presentation/pages/suggestion/suggestion_page.dart b/lib/src/presentation/pages/suggestion/suggestion_page.dart index 82e7353..d820003 100644 --- a/lib/src/presentation/pages/suggestion/suggestion_page.dart +++ b/lib/src/presentation/pages/suggestion/suggestion_page.dart @@ -26,7 +26,6 @@ import 'package:suggest_a_feature/src/presentation/utils/assets_strings.dart'; import 'package:suggest_a_feature/src/presentation/utils/date_utils.dart'; import 'package:suggest_a_feature/src/presentation/utils/dimensions.dart'; import 'package:suggest_a_feature/src/presentation/utils/image_utils.dart'; -import 'package:suggest_a_feature/src/presentation/utils/platform_check.dart'; import 'package:suggest_a_feature/src/presentation/utils/typedefs.dart'; import 'package:wtf_sliding_sheet/wtf_sliding_sheet.dart'; @@ -107,11 +106,9 @@ class _SuggestionPageState extends State { ), SafeArea( top: false, - bottom: SuggestionsPlatform.isIOS, child: Container( - padding: EdgeInsets.only( - bottom: MediaQuery.of(context).padding.bottom + - Dimensions.marginSmall, + padding: const EdgeInsets.only( + bottom: Dimensions.marginSmall, ), child: Row( crossAxisAlignment: CrossAxisAlignment.end, From f0006e0a35e7c9547aac11aff3ca1d018e659e22 Mon Sep 17 00:00:00 2001 From: Aliaksei Date: Thu, 17 Jul 2025 11:17:12 +0300 Subject: [PATCH 3/3] update CHANGELOG.md and package version, minor fixes --- CHANGELOG.md | 4 ++ example/pubspec.lock | 56 +++++++++---------- .../pages/suggestion/suggestion_page.dart | 3 +- .../pages/suggestions/suggestions_page.dart | 3 +- pubspec.yaml | 2 +- 5 files changed, 36 insertions(+), 32 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b148d04..5fdd11f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +## 0.5.2 +* Fixed creation and editing of suggestions +* Added secondary button customization + ## 0.5.1 * Updates to support flutter version 3.32.1 * Edge-to-edge mode fixes on Android diff --git a/example/pubspec.lock b/example/pubspec.lock index 5e3773b..5365258 100644 --- a/example/pubspec.lock +++ b/example/pubspec.lock @@ -5,10 +5,10 @@ packages: dependency: transitive description: name: args - sha256: "7cf60b9f0cc88203c5a190b4cd62a99feea42759a7fa695010eb5de1c0b2252a" + sha256: d0481093c50b1da8910eb0bb301626d4d8eb7284aa739614d2b394ee09e3ea04 url: "https://pub.dev" source: hosted - version: "2.5.0" + version: "2.7.0" async: dependency: transitive description: @@ -61,10 +61,10 @@ packages: dependency: transitive description: name: equatable - sha256: c2b87cb7756efdf69892005af546c56c0b5037f54d2a88269b4f347a505e3ca2 + sha256: "567c64b3cb4cf82397aac55f4f0cbd3ca20d77c6c03bedbc4ceaddc08904aef7" url: "https://pub.dev" source: hosted - version: "2.0.5" + version: "2.0.7" fake_async: dependency: transitive description: @@ -90,10 +90,10 @@ packages: dependency: transitive description: name: flutter_svg - sha256: "7b4ca6cf3304575fe9c8ec64813c8d02ee41d2afe60bcfe0678bcb5375d596a2" + sha256: cd57f7969b4679317c17af6fd16ee233c1e60a82ed209d8a475c54fd6fd6f845 url: "https://pub.dev" source: hosted - version: "2.0.10+1" + version: "2.2.0" flutter_test: dependency: "direct dev" description: flutter @@ -103,18 +103,18 @@ packages: dependency: transitive description: name: http - sha256: "761a297c042deedc1ffbb156d6e2af13886bb305c2a343a4d972504cd67dd938" + sha256: "2c11f3f94c687ee9bad77c171151672986360b2b001d109814ee7140b2cf261b" url: "https://pub.dev" source: hosted - version: "1.2.1" + version: "1.4.0" http_parser: dependency: transitive description: name: http_parser - sha256: "2aa08ce0341cc9b354a498388e30986515406668dbcc4f7c950c3e715496693b" + sha256: "178d74305e7866013777bab2c3d8726205dc5a4dd935297175b19a23a2e66571" url: "https://pub.dev" source: hosted - version: "4.0.2" + version: "4.1.2" intl: dependency: "direct main" description: @@ -191,18 +191,18 @@ packages: dependency: transitive description: name: path_parsing - sha256: e3e67b1629e6f7e8100b367d3db6ba6af4b1f0bb80f64db18ef1fbabd2fa9ccf + sha256: "883402936929eac138ee0a45da5b0f2c80f89913e6dc3bf77eb65b84b409c6ca" url: "https://pub.dev" source: hosted - version: "1.0.1" + version: "1.1.0" petitparser: dependency: transitive description: name: petitparser - sha256: c15605cd28af66339f8eb6fbe0e541bfe2d1b72d5825efc6598f3e0a31b9ad27 + sha256: "07c8f0b1913bcde1ff0d26e57ace2f3012ccbf2b204e070290dad3bb22797646" url: "https://pub.dev" source: hosted - version: "6.0.2" + version: "6.1.0" sky_engine: dependency: transitive description: flutter @@ -246,7 +246,7 @@ packages: path: ".." relative: true source: path - version: "0.5.1" + version: "0.5.2" term_glyph: dependency: transitive description: @@ -267,34 +267,34 @@ packages: dependency: transitive description: name: typed_data - sha256: facc8d6582f16042dd49f2463ff1bd6e2c9ef9f3d5da3d9b087e244a7b564b3c + sha256: f9049c039ebfeb4cf7a7104a675823cd72dba8297f264b6637062516699fa006 url: "https://pub.dev" source: hosted - version: "1.3.2" + version: "1.4.0" vector_graphics: dependency: transitive description: name: vector_graphics - sha256: "32c3c684e02f9bc0afb0ae0aa653337a2fe022e8ab064bcd7ffda27a74e288e3" + sha256: a4f059dc26fc8295b5921376600a194c4ec7d55e72f2fe4c7d2831e103d461e6 url: "https://pub.dev" source: hosted - version: "1.1.11+1" + version: "1.1.19" vector_graphics_codec: dependency: transitive description: name: vector_graphics_codec - sha256: c86987475f162fadff579e7320c7ddda04cd2fdeffbe1129227a85d9ac9e03da + sha256: "99fd9fbd34d9f9a32efd7b6a6aae14125d8237b10403b422a6a6dfeac2806146" url: "https://pub.dev" source: hosted - version: "1.1.11+1" + version: "1.1.13" vector_graphics_compiler: dependency: transitive description: name: vector_graphics_compiler - sha256: "12faff3f73b1741a36ca7e31b292ddeb629af819ca9efe9953b70bd63fc8cd81" + sha256: "557a315b7d2a6dbb0aaaff84d857967ce6bdc96a63dc6ee2a57ce5a6ee5d3331" url: "https://pub.dev" source: hosted - version: "1.1.11+1" + version: "1.1.17" vector_math: dependency: transitive description: @@ -315,18 +315,18 @@ packages: dependency: transitive description: name: web - sha256: "97da13628db363c635202ad97068d47c5b8aa555808e7a9411963c533b449b27" + sha256: "868d88a33d8a87b18ffc05f9f030ba328ffefba92d6c127917a2ba740f9cfe4a" url: "https://pub.dev" source: hosted - version: "0.5.1" + version: "1.1.1" wtf_sliding_sheet: dependency: transitive description: name: wtf_sliding_sheet - sha256: df68a79cb6fe3272b79ec995f9ec254d6ae33b53199f6213e40221b5e7bd5f2b + sha256: eb2f844a03fc64b9b904dc441bbb2283ee4dcf5244fe64bd91063bfbad70e89c url: "https://pub.dev" source: hosted - version: "1.1.3" + version: "1.1.5" xml: dependency: transitive description: @@ -337,4 +337,4 @@ packages: version: "6.5.0" sdks: dart: ">=3.7.0-0 <4.0.0" - flutter: ">=3.18.0-18.0.pre.54" + flutter: ">=3.27.0" diff --git a/lib/src/presentation/pages/suggestion/suggestion_page.dart b/lib/src/presentation/pages/suggestion/suggestion_page.dart index d820003..3b4dd0a 100644 --- a/lib/src/presentation/pages/suggestion/suggestion_page.dart +++ b/lib/src/presentation/pages/suggestion/suggestion_page.dart @@ -794,7 +794,8 @@ class _NewCommentButton extends StatelessWidget { child: FilledButton( style: context.theme.filledButtonTheme.style?.copyWith( backgroundColor: WidgetStateProperty.resolveWith( - (states) => theme.secondaryButtonBackgroundColor ?? + (states) => + theme.secondaryButtonBackgroundColor ?? context.theme.colorScheme.secondaryContainer, ), foregroundColor: WidgetStatePropertyAll( diff --git a/lib/src/presentation/pages/suggestions/suggestions_page.dart b/lib/src/presentation/pages/suggestions/suggestions_page.dart index 88e5f73..dd30beb 100644 --- a/lib/src/presentation/pages/suggestions/suggestions_page.dart +++ b/lib/src/presentation/pages/suggestions/suggestions_page.dart @@ -389,8 +389,7 @@ class _BottomFab extends StatelessWidget { @override Widget build(BuildContext context) { return Positioned( - bottom: Dimensions.marginDefault + - MediaQuery.paddingOf(context).bottom, + bottom: Dimensions.marginDefault + MediaQuery.paddingOf(context).bottom, right: Dimensions.marginDefault, child: SuggestionsFab( padding: const EdgeInsets.all(Dimensions.marginDefault), diff --git a/pubspec.yaml b/pubspec.yaml index 22541b1..e44ee87 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,6 +1,6 @@ name: suggest_a_feature description: Ready-made Flutter package for collecting suggestions from users. -version: 0.5.1 +version: 0.5.2 repository: https://github.com/flutterwtf/Suggest-a-Feature homepage: https://pub.dev/packages/suggest_a_feature