Skip to content

Commit

Permalink
Update github pages theme (#53)
Browse files Browse the repository at this point in the history
  • Loading branch information
cp-pratik-k authored Nov 12, 2024
1 parent 973398d commit 88e264a
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 6 deletions.
1 change: 1 addition & 0 deletions app/lib/components/web_view_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ class _WebViewScreenState extends State<WebViewScreen> {

@override
Widget build(BuildContext context) {
_controller.setBackgroundColor(context.colorScheme.surface);
return AppPage(
title: '',
automaticallyImplyLeading: false,
Expand Down
17 changes: 15 additions & 2 deletions app/lib/ui/flow/accounts/components/settings_action_list.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:style/buttons/buttons_list.dart';
import 'package:style/buttons/segmented_button.dart';
import 'package:style/buttons/switch.dart';
import 'package:style/extensions/context_extensions.dart';

class SettingsActionList extends ConsumerWidget {
const SettingsActionList({super.key});
Expand Down Expand Up @@ -50,16 +51,28 @@ class SettingsActionList extends ConsumerWidget {
ActionListButton(
title: context.l10n.common_term_and_condition,
onPressed: () {
final colors = _getWebPageColors(context, ref);
showWebView(context,
"https://canopas.github.io/cloud-gallery/terms-and-conditions");
"https://canopas.github.io/cloud-gallery/terms-and-conditions?bgColor=${colors.background}&textColor=${colors.text}");
},
),
ActionListButton(
title: context.l10n.common_privacy_policy,
onPressed: () {
final colors = _getWebPageColors(context, ref);
showWebView(context,
"https://canopas.github.io/cloud-gallery/privacy-policy");
"https://canopas.github.io/cloud-gallery/privacy-policy?bgColor=${colors.background}&textColor=${colors.text}");
}),
]);
}

({String background, String text}) _getWebPageColors(
BuildContext context, WidgetRef ref) {
final isDark =
(ref.watch(AppPreferences.isDarkMode) ?? context.systemThemeIsDark);
return (
background: isDark ? "%23000000" : "%23FFFFFF",
text: isDark ? "%23FFFFFF" : "%23000000"
);
}
}
8 changes: 4 additions & 4 deletions style/lib/extensions/context_extensions.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,17 @@ import 'package:flutter/cupertino.dart';
import 'package:style/theme/theme.dart';

extension BuildContextExtensions on BuildContext {
EdgeInsets get systemPadding => MediaQuery.of(this).padding;
EdgeInsets get systemPadding => MediaQuery.paddingOf(this);

Size get mediaQuerySize => MediaQuery.of(this).size;
Size get mediaQuerySize => MediaQuery.sizeOf(this);

AppColorScheme get colorScheme => appColorSchemeOf(this);

Brightness get brightness => MediaQuery.of(this).platformBrightness;
Brightness get brightness => MediaQuery.platformBrightnessOf(this);

bool get systemThemeIsDark => brightness == Brightness.dark;

FocusScopeNode get focusScope => FocusScope.of(this);

bool get use24Hour => MediaQuery.of(this).alwaysUse24HourFormat;
bool get use24Hour => MediaQuery.alwaysUse24HourFormatOf(this);
}

0 comments on commit 88e264a

Please sign in to comment.