From 0877cefc8b3c44e9b63e62acf40f8264934912ad Mon Sep 17 00:00:00 2001 From: Yaroslav Kuchmenko Date: Wed, 25 Oct 2023 14:33:33 +0300 Subject: [PATCH] chore: drop support for dart SDK version below 2.17 --- .gitignore | 2 ++ example/pubspec.yaml | 6 +++--- lib/src/list/settings_list.dart | 10 ++++------ pubspec.yaml | 4 ++-- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/.gitignore b/.gitignore index 8ab5b0c..d50e6e8 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,6 @@ # See https://www.dartlang.org/guides/libraries/private-files +.fvm/ +.DS_Store # Files and directories created by pub .dart_tool/ diff --git a/example/pubspec.yaml b/example/pubspec.yaml index 168485d..8b3c90b 100644 --- a/example/pubspec.yaml +++ b/example/pubspec.yaml @@ -4,13 +4,13 @@ version: 1.0.0+1 publish_to: none environment: - sdk: '>=2.12.0 <4.0.0' + sdk: '>=2.19.0 <4.0.0' dependencies: flutter: sdk: flutter - cupertino_icons: ^1.0.4 - device_preview: 1.0.0 + cupertino_icons: ^1.0.5 + device_preview: ^1.1.0 settings_ui: path: ../ # settings_ui: ^2.0.2 diff --git a/lib/src/list/settings_list.dart b/lib/src/list/settings_list.dart index 2cb1e21..87ce685 100644 --- a/lib/src/list/settings_list.dart +++ b/lib/src/list/settings_list.dart @@ -1,3 +1,5 @@ +import 'dart:ui'; + import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:settings_ui/src/sections/abstract_settings_section.dart'; @@ -100,7 +102,7 @@ class _SettingsListState extends State { DevicePlatform platform, BuildContext context, ) { - final mqSizeWidth = MediaQuery.sizeOf(context).width; + final mqSizeWidth = MediaQuery.of(context).size.width; final isWideScreen = mqSizeWidth > widget.wideScreenBreakpoint; double horizontalPaddingValue = (mqSizeWidth - widget.wideScreenBreakpoint) / 2; @@ -137,11 +139,7 @@ class _SettingsListState extends State { BuildContext context, DevicePlatform platform, ) { - // final platformBrightness = - // View.of(context).platformDispatcher.platformBrightness; - // TODO: remove this deprecated Window usage whenever min dark SDK constraint is 3.0 - final Brightness platformBrightness = - WidgetsBinding.instance.window.platformBrightness; + final platformBrightness = PlatformDispatcher.instance.platformBrightness; final materialBrightness = Theme.of(context).brightness; final cupertinoBrightness = CupertinoTheme.of(context).brightness; diff --git a/pubspec.yaml b/pubspec.yaml index f294698..e121cef 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -4,7 +4,7 @@ version: 2.0.3 homepage: https://github.com/yako-dev/flutter-settings-ui environment: - sdk: '>=2.12.0 <4.0.0' + sdk: '>=2.17.0 <4.0.0' dependencies: flutter: @@ -13,6 +13,6 @@ dependencies: dev_dependencies: flutter_test: sdk: flutter - flutter_lints: ^3.0.0 + flutter_lints: ^2.0.1 flutter: