This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| final windowHeight = WindowHeight.of(context); | |
| if (windowHeight == WindowHeight.compact) { | |
| // Adapt UI for limited vertical space | |
| } | |
| Widget build(BuildContext context) { | |
| final windowHeight = WindowHeight.of(context); | |
| // This value can change during the app's lifetime | |
| // Adapt your layout based on available vertical space... |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Copyright 2025 Fredrick Allan Grott. All rights reserved. | |
| // Use of this source code is governed by a BSD-style | |
| // license that can be found in the LICENSE file. | |
| // | |
| // Modified from window_size_classes package by Yuna | |
| // Copyright 2025 under GNU LGPL 3.0 | |
| import 'package:flutter/widgets.dart'; | |
| import 'package:material_expressive_collection/src/adaptive/breakpoints.dart'; | |
| import 'package:meta/meta.dart'; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| final windowWidth = WindowWidth.of(context); | |
| return switch (wiindowWidth) { | |
| WindowWidth.compact => CompactLayout(), | |
| WindowWidth.medium => MediumLayout(), | |
| WindowWidth.expanded => ExpandedLayout(), | |
| _ => LargeLayout(), // large and extraLarge | |
| }; | |
| Widget build(BuildContext context) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Copyright 2025 Fredrick Allan Grott. All rights reserved. | |
| // Use of this source code is governed by a BSD-style | |
| // license that can be found in the LICENSE file. | |
| // | |
| // Modified from window_size_classes package by Yuna | |
| // Copyright 2025 under GNU LGPL 3.0 | |
| import 'package:flutter/widgets.dart'; | |
| import 'package:material_expressive_collection/src/adaptive/breakpoints.dart'; | |
| import 'package:meta/meta.dart'; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Copyright 2025 Fredrick Allan Grott. All rights reserved. | |
| // Use of this source code is governed by a BSD-style | |
| // license that can be found in the LICENSE file. | |
| // | |
| // Modified from window_size_classes package by Yuna | |
| // Copyright 2025 under GNU LGPL 3.0 | |
| /// The minimum width for [WindowWidthClass.medium] layouts. | |
| /// |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /// Changed this from GSkinner's SizedContext package as with fold-ables | |
| /// on both Android and iOS want an always valid size. That is accomplushed | |
| /// by grabbing a FlutterView.display Display object. | |
| /// | |
| /// @author Fredrick Allan Grott | |
| extension MQExt on BuildContext { | |
| /// Returns pixelsPerInch | |
| double get pixelsPerInch => UniversalPlatform.isAndroid || UniversalPlatform.isIOS? 150 : 96; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| extension WidgetStateHelpers on Iterable<WidgetState> { | |
| bool get isHovered => contains(WidgetState.hovered); | |
| bool get isFocused => contains(WidgetState.focused); | |
| bool get isPressed => contains(WidgetState.pressed); | |
| bool get isDragged => contains(WidgetState.dragged); | |
| bool get isSelected => contains(WidgetState.selected); | |
| bool get isScrolledUnder => contains(WidgetState.scrolledUnder); | |
| bool get isDisabled => contains(WidgetState.disabled); | |
| bool get isError => contains(WidgetState.error); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Copyright 2025 Fredrick Allan Grott. All rights reserved. | |
| // Use of this source code is governed by a BSD-style | |
| // license that can be found in the LICENSE file. | |
| import 'dart:math'; | |
| import 'dart:ui'; | |
| import 'package:flutter/material.dart'; | |
| import 'package:universal_platform/universal_platform.dart'; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Copyright 2025 Fredrick Allan Grott. All rights reserved. | |
| // Use of this source code is governed by a BSD-style | |
| // license that can be found in the LICENSE file. | |
| // | |
| // Modified from the Material_3_Expressive package | |
| // MIT License by Emily Moonstone 2025 | |
| // ignore_for_file: prefer_constructors_over_static_methods, dead_code |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /// Inject (or replace) the M3ETheme extension on a ThemeData. | |
| ThemeData withM3ETheme(ThemeData base, {M3ETheme? override}) { | |
| // Use any existing M3ETheme, else the provided override, else defaults. | |
| final current = base.extension<M3ETheme>(); | |
| final next = override ?? current ?? M3ETheme.defaults(base.colorScheme); | |
| // Merge existing extensions (values) with our M3ETheme, replacing prior ones. | |
| final Iterable<ThemeExtension<dynamic>> existing = base.extensions.values; | |
| final List<ThemeExtension<dynamic>> merged = <ThemeExtension<dynamic>>[]; | |
| for (final e in existing) { |
NewerOlder