wip: info page and GET app login / settings
This commit is contained in:
51
lib/src/utils/conditional_parent_widget.dart
Normal file
51
lib/src/utils/conditional_parent_widget.dart
Normal file
@@ -0,0 +1,51 @@
|
||||
import 'package:flutter/widgets.dart';
|
||||
|
||||
/// Conditionally wrap a subtree with a parent widget without breaking the code tree.
|
||||
///
|
||||
/// [condition]: the condition depending on which the subtree [child] is wrapped with the parent.
|
||||
/// [child]: The subtree that should always be build.
|
||||
/// [conditionalBuilder]: builds the parent with the subtree [child].
|
||||
///
|
||||
/// ___________
|
||||
/// Usage:
|
||||
/// ```dart
|
||||
/// return ConditionalParentWidget(
|
||||
/// condition: shouldIncludeParent,
|
||||
/// child: Widget1(
|
||||
/// child: Widget2(
|
||||
/// child: Widget3(),
|
||||
/// ),
|
||||
/// ),
|
||||
/// conditionalBuilder: (Widget child) => SomeParentWidget(child: child),
|
||||
///);
|
||||
/// ```
|
||||
///
|
||||
/// ___________
|
||||
/// Instead of:
|
||||
/// ```dart
|
||||
/// Widget child = Widget1(
|
||||
/// child: Widget2(
|
||||
/// child: Widget3(),
|
||||
/// ),
|
||||
/// );
|
||||
///
|
||||
/// return shouldIncludeParent ? SomeParentWidget(child: child) : child;
|
||||
/// ```
|
||||
///
|
||||
class ConditionalParentWidget extends StatelessWidget {
|
||||
const ConditionalParentWidget({
|
||||
required this.child,
|
||||
required this.condition,
|
||||
required this.conditionalBuilder,
|
||||
Key? key,
|
||||
}) : super(key: key);
|
||||
|
||||
final Widget child;
|
||||
final bool condition;
|
||||
final Widget Function(Widget child) conditionalBuilder;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return condition ? conditionalBuilder(child) : child;
|
||||
}
|
||||
}
|
@@ -8,26 +8,44 @@ ThemeData _baseTheme = ThemeData(
|
||||
unselectedItemColor: Colors.grey[500],
|
||||
),
|
||||
textTheme: TextTheme(
|
||||
headline1: TextStyle(
|
||||
headlineLarge: TextStyle(
|
||||
color: Colors.grey[800],
|
||||
fontWeight: FontWeight.w900,
|
||||
fontSize: 22,
|
||||
),
|
||||
subtitle1: TextStyle(
|
||||
titleLarge: TextStyle(
|
||||
color: Colors.grey[800],
|
||||
fontSize: 18,
|
||||
fontWeight: FontWeight.w700,
|
||||
),
|
||||
titleSmall: TextStyle(
|
||||
color: Colors.grey[800],
|
||||
fontWeight: FontWeight.w700,
|
||||
),
|
||||
labelLarge: TextStyle(
|
||||
color: Colors.grey[500],
|
||||
fontWeight: FontWeight.w500,
|
||||
fontSize: 16,
|
||||
),
|
||||
subtitle2: TextStyle(
|
||||
labelMedium: TextStyle(
|
||||
color: Colors.grey[500],
|
||||
fontWeight: FontWeight.w500,
|
||||
fontSize: 14,
|
||||
),
|
||||
),
|
||||
pageTransitionsTheme: const PageTransitionsTheme(
|
||||
builders: {
|
||||
TargetPlatform.android:
|
||||
CupertinoPageTransitionsBuilder(),
|
||||
TargetPlatform.iOS:
|
||||
CupertinoPageTransitionsBuilder(),
|
||||
},
|
||||
),
|
||||
);
|
||||
|
||||
ThemeData myFurmanTheme = _baseTheme.copyWith(
|
||||
textTheme: GoogleFonts.interTextTheme(_baseTheme.textTheme),
|
||||
);
|
||||
|
||||
var furmanTextStyle = (TextStyle baseStyle) => GoogleFonts.inter(textStyle: baseStyle);
|
||||
var furmanTextStyle = (TextStyle baseStyle) =>
|
||||
GoogleFonts.inter(textStyle: baseStyle);
|
||||
|
Reference in New Issue
Block a user