Skip to content

Commit

Permalink
[#231] [NF] BrandBook and Custom Theme. Correct styling for titles an…
Browse files Browse the repository at this point in the history
…d buttons
  • Loading branch information
lyskouski committed Sep 16, 2023
1 parent d64ab5f commit 329f442
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 22 deletions.
3 changes: 1 addition & 2 deletions lib/_configs/custom_color_scheme.dart
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,7 @@ class AppDefaultColors {
}

factory AppDefaultColors.fromJson(Map<String, dynamic> json) {
final palette = AppDefaultColors();
return palette
return AppDefaultColors()
..primary = Color(json['primary'])
..inversePrimary = Color(json['inversePrimary'])
..onSecondary = Color(json['onSecondary'])
Expand Down
15 changes: 15 additions & 0 deletions lib/_configs/custom_text_theme.dart
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,21 @@ extension CustomTextTheme on TextTheme {

static TextTheme? textTheme(ThemeData baseTheme) {
return baseTheme.textTheme.copyWith(
titleLarge: GoogleFonts.abel(
fontSize: 32,
fontWeight: FontWeight.w400,
letterSpacing: letterSpacingOrNone(1.2),
),
titleMedium: GoogleFonts.abel(
fontSize: 18,
fontWeight: FontWeight.w400,
letterSpacing: letterSpacingOrNone(1.2),
),
titleSmall: GoogleFonts.abel(
fontSize: 12,
fontWeight: FontWeight.w400,
letterSpacing: letterSpacingOrNone(1.2),
),
headlineLarge: GoogleFonts.abel(
fontSize: 32,
fontWeight: FontWeight.w400,
Expand Down
1 change: 1 addition & 0 deletions lib/pages/about_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ class AboutPageState extends AbstractPageState<AboutPage> with LauncherMixin {
},
),
),
ThemeHelper.formEndBox,
],
),
);
Expand Down
32 changes: 16 additions & 16 deletions lib/pages/subscription/widgets/other_widget.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import 'package:app_finance/_classes/herald/app_locale.dart';
import 'package:app_finance/_configs/theme_helper.dart';
import 'package:app_finance/_mixins/launcher_mixin.dart';
import 'package:app_finance/widgets/wrapper/elevate_button_widget.dart';
import 'package:app_finance/widgets/wrapper/full_sized_button_widget.dart';
import 'package:flutter/material.dart';

class OtherWidget extends StatelessWidget with LauncherMixin {
Expand All @@ -15,33 +15,33 @@ class OtherWidget extends StatelessWidget with LauncherMixin {
return Expanded(
child: Column(children: [
ThemeHelper.hIndent,
ElevatedButtonWidget(
onPressed: () => openURL('https://www.buymeacoffee.com/lyskouski'),
text: AppLocale.labels.subscriptionCoffee,
FullSizedButtonWidget(
setState: () => openURL('https://www.buymeacoffee.com/lyskouski'),
title: AppLocale.labels.subscriptionCoffee,
icon: Icons.coffee,
),
ThemeHelper.hIndent2x,
ElevatedButtonWidget(
onPressed: () => openURL('https://paypal.me/terCAD'),
text: AppLocale.labels.subscriptionPaypal,
FullSizedButtonWidget(
setState: () => openURL('https://paypal.me/terCAD'),
title: AppLocale.labels.subscriptionPaypal,
icon: Icons.coffee_maker,
),
ThemeHelper.hIndent2x,
ElevatedButtonWidget(
onPressed: () => openURL('https://donorbox.org/tercad'),
text: AppLocale.labels.subscriptionDonorbox,
FullSizedButtonWidget(
setState: () => openURL('https://donorbox.org/tercad'),
title: AppLocale.labels.subscriptionDonorbox,
icon: Icons.support,
),
ThemeHelper.hIndent2x,
ElevatedButtonWidget(
onPressed: () => openURL('https://patreon.com/terCAD'),
text: AppLocale.labels.subscriptionPatreon,
FullSizedButtonWidget(
setState: () => openURL('https://patreon.com/terCAD'),
title: AppLocale.labels.subscriptionPatreon,
icon: Icons.pattern,
),
ThemeHelper.hIndent2x,
ElevatedButtonWidget(
onPressed: () => openURL('https://github.com/sponsors/lyskouski'),
text: AppLocale.labels.subscriptionGithub,
FullSizedButtonWidget(
setState: () => openURL('https://github.com/sponsors/lyskouski'),
title: AppLocale.labels.subscriptionGithub,
icon: Icons.gite,
),
]),
Expand Down
9 changes: 5 additions & 4 deletions lib/widgets/wrapper/full_sized_button_widget.dart
Original file line number Diff line number Diff line change
Expand Up @@ -16,30 +16,31 @@ class FullSizedButtonWidget extends AbstractInput {
final OnPressedFunction setState;
final String title;
final IconData icon;
final BoxConstraints constraints;
final BoxConstraints? constraints;
late final String heroTag;

FullSizedButtonWidget({
super.key,
required this.setState,
required this.constraints,
required this.title,
required this.icon,
this.constraints,
}) : super(value: null) {
heroTag = 'fz_button_${UniqueKey()}';
}

@override
Widget buildContent(BuildContext context) {
final isBottom = ResponsiveMatrix(getWindowType(context)).isNavBottom(constraints);
final isBottom = constraints != null ? ResponsiveMatrix(getWindowType(context)).isNavBottom(constraints!) : false;
final bool isKeyboardVisible = ThemeHelper.isKeyboardVisible(context) || isBottom;
final colorScheme = context.colorScheme;
final width = constraints.maxWidth - ThemeHelper.getIndent(4) - 2;
final width = constraints != null ? constraints!.maxWidth - ThemeHelper.getIndent(4) - 2 : double.infinity;
return SizedBox(
width: isKeyboardVisible ? null : width,
child: FloatingActionButton(
heroTag: heroTag,
onPressed: setState,
hoverColor: colorScheme.primary,
tooltip: title,
focusNode: FocusController.getFocusNode(),
child: Row(
Expand Down

0 comments on commit 329f442

Please sign in to comment.