diff --git a/lib/components/text.dart b/lib/components/text.dart index b875192..d7a5c0d 100644 --- a/lib/components/text.dart +++ b/lib/components/text.dart @@ -79,8 +79,9 @@ class TextBlockquote extends StatelessWidget { } ButtonStyle? menuButtonStyle = TextButton.styleFrom( + foregroundColor: textSecondary, backgroundColor: Colors.transparent, - onSurface: null, - primary: textSecondary, + disabledForegroundColor: const Color.fromRGBO( + 0, 0, 0, 0.38), // Replace null with desired color and opacity textStyle: buttonTextStyle, padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 16)); diff --git a/lib/main.dart b/lib/main.dart index 687832f..3ecb818 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -3,6 +3,7 @@ import 'package:minimal/pages/pages.dart'; import 'package:minimal/routes.dart'; import 'package:navigation_utils/navigation_utils.dart'; import 'package:responsive_framework/responsive_framework.dart'; +import 'package:minimal/utils/conditional_route_widget.dart'; void main() { runApp(const MyApp()); diff --git a/lib/utils/conditional_route_widget.dart b/lib/utils/conditional_route_widget.dart new file mode 100644 index 0000000..0e0f0a1 --- /dev/null +++ b/lib/utils/conditional_route_widget.dart @@ -0,0 +1,32 @@ +import 'package:flutter/material.dart'; + +class ConditionalRouteWidget extends StatelessWidget { + final List? routes; + final List? routesExcluded; + final TransitionBuilder builder; + final Widget child; + + const ConditionalRouteWidget( + {Key? key, + this.routes, + this.routesExcluded, + required this.builder, + required this.child}) + : assert(routes == null || routesExcluded == null, + 'Cannot include `routes` and `routesExcluded`. Please provide an list of routes to include or exclude, not both.'), + super(key: key); + + @override + Widget build(BuildContext context) { + String? currentRoute = ModalRoute.of(context)?.settings.name; + + if (routes != null && routes!.contains(currentRoute)) { + return builder(context, child); + } else if (routesExcluded != null && + routesExcluded!.contains(currentRoute) == false) { + return builder(context, child); + } + + return child; + } +}