Skip to content

Commit

Permalink
fix: latest flutter breaking changes (#8)
Browse files Browse the repository at this point in the history
* fix: latest flutter breaking changes

* chore: update web platform class

* chore: update pubspec homepage
  • Loading branch information
nank1ro authored Dec 12, 2024
1 parent df40a86 commit 28492de
Show file tree
Hide file tree
Showing 7 changed files with 44 additions and 19 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 1.3.0

- **FIX**: Breaking changes introduced by Flutter 3.27.0

## 1.2.0

- **FEAT**: Add `ordinal`, `roman` and space extensions (thanks to @athishaves)
Expand Down
1 change: 1 addition & 0 deletions lib/src/dart_io/barrel.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export 'io.dart' if (dart.library.js_interop) 'web.dart' show Platform;
1 change: 1 addition & 0 deletions lib/src/dart_io/io.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export 'dart:io' show Platform;
28 changes: 28 additions & 0 deletions lib/src/dart_io/web.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
/// Information about the environment in which the current program is running.
///
/// Platform provides information such as the operating system,
/// the hostname of the computer, the value of environment variables,
/// the path to the running program,
/// and other global properties of the program being run.
abstract final class Platform {
/// Whether the program is running in the web browser
static const isWeb = true;

/// Whether the operating system is Android
static const isAndroid = false;

/// Whether the operating system is macOS
static const isMacOS = false;

/// Whether the operating system is Windows
static const isWindows = false;

/// Whether the operating system is Fuchsia
static const isFuchsia = false;

/// Whether the operating system is iOS
static const isIOS = false;

/// Whether the operating system is Linux
static const isLinux = false;
}
3 changes: 1 addition & 2 deletions lib/src/platform_ext.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import 'dart:io';

import 'package:awesome_flutter_extensions/src/dart_io/barrel.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';

Expand Down
18 changes: 6 additions & 12 deletions lib/src/themes_ext.dart
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ extension Themes on BuildContext {
popupMenu: _popupMenuTheme,
banner: _bannerTheme,
divider: _dividerTheme,
buttonBar: _buttonBarTheme,
bottomNavigationBar: _bottomNavigationBarTheme,
timePicker: _timePickerTheme,
textButton: _textButtonTheme,
Expand Down Expand Up @@ -71,14 +70,14 @@ extension Themes on BuildContext {
_themeData.inputDecorationTheme;
IconThemeData get _primaryIconTheme => _themeData.primaryIconTheme;
SliderThemeData get _sliderTheme => _themeData.sliderTheme;
TabBarTheme get _tabBarTheme => _themeData.tabBarTheme;
TabBarThemeData get _tabBarTheme => _themeData.tabBarTheme;
TooltipThemeData get _tooltipTheme => _themeData.tooltipTheme;
CardTheme get _cardTheme => _themeData.cardTheme;
CardThemeData get _cardTheme => _themeData.cardTheme;
ChipThemeData get _chipTheme => _themeData.chipTheme;
AppBarTheme get _appBarTheme => _themeData.appBarTheme;
ScrollbarThemeData get _scrollbarTheme => _themeData.scrollbarTheme;
BottomAppBarTheme get _bottomAppBarTheme => _themeData.bottomAppBarTheme;
DialogTheme get _dialogTheme => _themeData.dialogTheme;
DialogThemeData get _dialogTheme => _themeData.dialogTheme;
FloatingActionButtonThemeData get _floatingActionButtonTheme =>
_themeData.floatingActionButtonTheme;
NavigationRailThemeData get _navigationRailTheme =>
Expand All @@ -90,7 +89,6 @@ extension Themes on BuildContext {
PopupMenuThemeData get _popupMenuTheme => _themeData.popupMenuTheme;
MaterialBannerThemeData get _bannerTheme => _themeData.bannerTheme;
DividerThemeData get _dividerTheme => _themeData.dividerTheme;
ButtonBarThemeData get _buttonBarTheme => _themeData.buttonBarTheme;
BottomNavigationBarThemeData get _bottomNavigationBarTheme =>
_themeData.bottomNavigationBarTheme;
TimePickerThemeData get _timePickerTheme => _themeData.timePickerTheme;
Expand Down Expand Up @@ -154,7 +152,6 @@ class _Themes {
required this.popupMenu,
required this.banner,
required this.divider,
required this.buttonBar,
required this.bottomNavigationBar,
required this.timePicker,
required this.textButton,
Expand Down Expand Up @@ -209,13 +206,13 @@ class _Themes {
final SliderThemeData slider;

/// See [ThemeData.tabBarTheme].
final TabBarTheme tabBar;
final TabBarThemeData tabBar;

/// See [ThemeData.tooltipTheme].
final TooltipThemeData tooltip;

/// See [ThemeData.cardTheme].
final CardTheme card;
final CardThemeData card;

/// See [ThemeData.chipTheme].
final ChipThemeData chip;
Expand All @@ -230,7 +227,7 @@ class _Themes {
final BottomAppBarTheme bottomAppBar;

/// See [ThemeData.dialogTheme].
final DialogTheme dialog;
final DialogThemeData dialog;

/// See [ThemeData.floatingActionButtonTheme].
final FloatingActionButtonThemeData floatingActionButton;
Expand All @@ -256,9 +253,6 @@ class _Themes {
/// See [ThemeData.dividerTheme].
final DividerThemeData divider;

/// See [ThemeData.buttonBarTheme].
final ButtonBarThemeData buttonBar;

/// See [ThemeData.bottomNavigationBarTheme].
final BottomNavigationBarThemeData bottomNavigationBar;

Expand Down
8 changes: 3 additions & 5 deletions pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@ name: awesome_flutter_extensions
description: >
A Flutter Extension to remove boilerplate when accessing
ancestor context properties
version: 1.2.0
homepage: https://bestofcode.dev
version: 1.3.0
homepage: https://mariuti.com
repository: https://github.com/nank1ro/awesome_flutter_extensions

environment:
sdk: ^3.0.0
flutter: ">=1.17.0"
flutter: ">=3.27.0"

dependencies:
flutter:
Expand All @@ -18,5 +18,3 @@ dev_dependencies:
flutter_test:
sdk: flutter
very_good_analysis: ^4.0.0+1

flutter: null

0 comments on commit 28492de

Please sign in to comment.