Skip to content

Commit

Permalink
use build context x
Browse files Browse the repository at this point in the history
  • Loading branch information
Feichtmeier committed Mar 19, 2024
1 parent 64b7976 commit 90d16c1
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 10 deletions.
3 changes: 1 addition & 2 deletions lib/build_context_x.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,5 @@ extension BuildContextX on BuildContext {
ThemeData get theme => Theme.of(this);
MediaQueryData get mq => MediaQuery.of(this);
Color get baseColor => theme.colorScheme.onSurface;
Color get highlightColor =>
theme.colorScheme.onSurface.scale(lightness: isLight ? 0.6 : -0.4);
Color get highlightColor => baseColor.scale(lightness: isLight ? 0.6 : -0.4);
}
9 changes: 5 additions & 4 deletions lib/home_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import 'package:flutter/material.dart';
import 'package:shimmer/shimmer.dart';
import 'package:yaru_widgets/widgets.dart';

import 'build_context_x.dart';
import 'constants.dart';
import 'plated_icon.dart';
import 'repositories.dart';
Expand Down Expand Up @@ -36,8 +37,8 @@ class HomePage extends StatelessWidget {
child: ScreenMessage(
title: const Text(kWelcomeTitle),
subTitle: Shimmer.fromColors(
baseColor: kBaseColor,
highlightColor: kHighlightColor,
baseColor: context.baseColor,
highlightColor: context.highlightColor,
child: InkWell(
borderRadius: BorderRadius.circular(5),
onTap: () => Navigator.of(context).pushNamed('/projects'),
Expand All @@ -58,8 +59,8 @@ class HomePage extends StatelessWidget {
),
title: Text(e.$2),
subTitle: Shimmer.fromColors(
baseColor: kBaseColor,
highlightColor: kHighlightColor,
baseColor: context.baseColor,
highlightColor: context.highlightColor,
child: InkWell(
borderRadius: BorderRadius.circular(5),
onTap: onTap,
Expand Down
6 changes: 3 additions & 3 deletions lib/plated_icon.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import 'constants.dart';
import 'build_context_x.dart';
import 'package:flutter/material.dart';
import 'package:shimmer/shimmer.dart';

Expand All @@ -21,8 +21,8 @@ class PlatedIcon extends StatelessWidget {
return Opacity(
opacity: 0.7,
child: Shimmer.fromColors(
baseColor: kBaseColor,
highlightColor: kHighlightColor,
baseColor: context.baseColor,
highlightColor: context.highlightColor,
child: InkWell(
onTap: onTap,
borderRadius:
Expand Down
2 changes: 1 addition & 1 deletion lib/scaffold_gradient.dart
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ BoxDecoration scaffoldGradient(BuildContext context) {
colors: context.isLight
? [
Colors.white,
Colors.white.scale(lightness: -0.2),
Colors.white,
]
: [
const Color(0xFF77216F).scale(lightness: -0.8),
Expand Down

0 comments on commit 90d16c1

Please sign in to comment.