-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat(helpers): added new flag extensions on country * test(helpers): added tests for new getters * docs: provide documentation for v1.1.0 * refactor: general refactoring in flutter packages and tests * feat(ui): improvements in world_countries example * chore(deps): bump fujidaiti/dart-package-inspector * chore(test): update goldens --------- Co-authored-by: Cirrus CI <[email protected]>
- Loading branch information
Showing
617 changed files
with
302 additions
and
178 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -67,7 +67,7 @@ jobs: | |
|
||
- name: 📈 Check Pub score | ||
if: ${{ github.event_name == 'pull_request' }} | ||
uses: fujidaiti/[email protected].2 | ||
uses: fujidaiti/[email protected].3 | ||
with: | ||
report: ${{ steps.analysis.outputs.json_output }} | ||
min-pub-points: 130 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
69 changes: 0 additions & 69 deletions
69
packages/world_countries/example/lib/theme/color_schemes.g.dart
This file was deleted.
Oops, something went wrong.
26 changes: 26 additions & 0 deletions
26
packages/world_countries/example/lib/theme/theme_manager.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import "package:flutter/material.dart"; | ||
import "package:world_countries/world_countries.dart"; | ||
|
||
import "theme_switcher.dart"; | ||
|
||
class ThemeManager extends StatefulWidget { | ||
const ThemeManager({required this.child, super.key}); | ||
|
||
final Widget child; | ||
|
||
@override | ||
State<ThemeManager> createState() => _ThemeManagerState(); | ||
} | ||
|
||
class _ThemeManagerState extends State<ThemeManager> { | ||
FlagProperties? _properties; | ||
|
||
void _onChange(FlagProperties? newProperties) => | ||
setState(() => _properties = newProperties); | ||
@override | ||
Widget build(BuildContext context) => ThemeProvider( | ||
_properties, | ||
changeColors: _onChange, | ||
child: widget.child, | ||
); | ||
} |
48 changes: 48 additions & 0 deletions
48
packages/world_countries/example/lib/theme/theme_switcher.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
import "package:flutter/material.dart"; | ||
import "package:world_countries/world_countries.dart"; | ||
|
||
class ThemeProvider extends InheritedWidget { | ||
const ThemeProvider( | ||
this._flagProperties, { | ||
required super.child, | ||
this.changeColors, | ||
super.key, | ||
}); | ||
|
||
static const _whiteColor = Colors.white; | ||
final FlagProperties? _flagProperties; | ||
final ValueSetter<FlagProperties?>? changeColors; | ||
|
||
Iterable<Color>? _maybeStripeColors(FlagProperties? flagProperties) => | ||
flagProperties?.stripeColors.map((stripe) => stripe.color); | ||
|
||
@override | ||
bool updateShouldNotify(ThemeProvider oldWidget) { | ||
final oldSeed = _maybeStripeColors(oldWidget._flagProperties)?.firstOrNull; | ||
final newSeed = _maybeStripeColors(_flagProperties)?.firstOrNull; | ||
|
||
return newSeed != oldSeed; | ||
} | ||
|
||
static ThemeProvider? of(BuildContext context) => | ||
context.dependOnInheritedWidgetOfExactType<ThemeProvider>(); | ||
|
||
ThemeData get theme { | ||
final stripeColors = _maybeStripeColors(_flagProperties); | ||
final seedColor = stripeColors?.first.withOpacity(1) ?? _whiteColor; | ||
final isDark = | ||
ThemeData.estimateBrightnessForColor(seedColor) == Brightness.dark; | ||
|
||
return ThemeData( | ||
colorScheme: ColorScheme.fromSeed( | ||
seedColor: seedColor, | ||
secondary: stripeColors?.elementAtOrNull(1), | ||
primary: stripeColors?.elementAtOrNull(2), | ||
), | ||
floatingActionButtonTheme: FloatingActionButtonThemeData( | ||
backgroundColor: seedColor, | ||
foregroundColor: isDark ? _whiteColor : Colors.black, | ||
), | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 29 additions & 0 deletions
29
packages/world_countries/example/lib/widgets/menu_button.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import "package:flutter/material.dart"; | ||
|
||
class MenuButton extends StatelessWidget { | ||
const MenuButton({super.key}); | ||
|
||
@override | ||
Widget build(BuildContext context) => PopupMenuButton<String>( | ||
itemBuilder: (_) => const [ | ||
PopupMenuItem( | ||
child: Align( | ||
alignment: Alignment.centerRight, | ||
child: Text("Feedback"), | ||
), | ||
), | ||
PopupMenuItem( | ||
child: Align( | ||
alignment: Alignment.centerRight, | ||
child: Text("Settings"), | ||
), | ||
), | ||
PopupMenuItem( | ||
child: Align( | ||
alignment: Alignment.centerRight, | ||
child: Text("About"), | ||
), | ||
), | ||
], | ||
); | ||
} |
Oops, something went wrong.