Skip to content

Commit

Permalink
refactor: migrate MediaQuery properties to InheritedModel (#1115)
Browse files Browse the repository at this point in the history
Co-authored-by: Ushie <ushiekane@gmail.com>
  • Loading branch information
dhruvanbhalara and Ushie committed Aug 10, 2023
1 parent f5e45ea commit 97e37f3
Show file tree
Hide file tree
Showing 7 changed files with 9 additions and 8 deletions.
2 changes: 1 addition & 1 deletion lib/ui/views/app_selector/app_selector_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ class _AppSelectorViewState extends State<AppSelectorView> {
padding: const EdgeInsets.symmetric(horizontal: 12.0)
.copyWith(
bottom:
MediaQuery.of(context).viewPadding.bottom + 8.0,
MediaQuery.viewPaddingOf(context).bottom + 8.0,
),
child: Column(
children: [
Expand Down
2 changes: 1 addition & 1 deletion lib/ui/views/contributors/contributors_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ class ContributorsView extends StatelessWidget {
title: 'contributorsView.managerContributors',
contributors: model.managerContributors,
),
SizedBox(height: MediaQuery.of(context).viewPadding.bottom),
SizedBox(height: MediaQuery.viewPaddingOf(context).bottom),
],
),
),
Expand Down
2 changes: 1 addition & 1 deletion lib/ui/views/navigation/navigation_viewmodel.dart
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class NavigationViewModel extends IndexTrackingViewModel {

if (prefs.getBool('useDarkTheme') == null) {
final bool isDark =
MediaQuery.of(context).platformBrightness != Brightness.light;
MediaQuery.platformBrightnessOf(context) != Brightness.light;
await prefs.setBool('useDarkTheme', isDark);
await DynamicTheme.of(context)!.setTheme(isDark ? 1 : 0);
}
Expand Down
2 changes: 1 addition & 1 deletion lib/ui/views/patches_selector/patches_selector_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ class _PatchesSelectorViewState extends State<PatchesSelectorView> {
: Padding(
padding:
const EdgeInsets.symmetric(horizontal: 12.0).copyWith(
bottom: MediaQuery.of(context).viewPadding.bottom + 8.0,
bottom: MediaQuery.viewPaddingOf(context).bottom + 8.0,
),
child: Column(
children: [
Expand Down
2 changes: 1 addition & 1 deletion lib/ui/widgets/appSelectorView/app_skeleton_loader.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ class AppSkeletonLoader extends StatelessWidget {

@override
Widget build(BuildContext context) {
final screenWidth = MediaQuery.of(context).size.width;
final screenWidth = MediaQuery.sizeOf(context).width;
return ListView.builder(
shrinkWrap: true,
itemCount: 7,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class _GradientProgressIndicatorState extends State<GradientProgressIndicator> {
),
),
height: 5,
width: MediaQuery.of(context).size.width * widget.progress!,
width: MediaQuery.sizeOf(context).width * widget.progress!,
),
);
}
Expand Down
5 changes: 3 additions & 2 deletions lib/ui/widgets/patchesSelectorView/patch_options_fields.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,9 @@ class OptionsTextField extends StatelessWidget {

@override
Widget build(BuildContext context) {
final sHeight = MediaQuery.of(context).size.height;
final sWidth = MediaQuery.of(context).size.width;
final size = MediaQuery.sizeOf(context);
final sHeight = size.height;
final sWidth = size.width;
return Container(
margin: const EdgeInsets.only(top: 12, bottom: 6),
padding: EdgeInsets.zero,
Expand Down

0 comments on commit 97e37f3

Please sign in to comment.