Skip to content

Commit fb628aa

Browse files
committed
🚨 Remove part of deprecated usages
1 parent 48b6bdf commit fb628aa

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

lib/src/widget/camera_picker.dart

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@ import 'dart:async';
66
import 'dart:io';
77
import 'dart:math' as math;
88

9+
import 'package:camera/camera.dart';
910
import 'package:flutter/material.dart';
1011
import 'package:flutter/scheduler.dart';
1112
import 'package:flutter/services.dart';
12-
import 'package:camera/camera.dart';
1313

1414
import '../constants/constants.dart';
1515
import '../widget/circular_progress_bar.dart';
@@ -176,13 +176,10 @@ class CameraPicker extends StatefulWidget {
176176
/// 通过主题色构建一个默认的暗黑主题
177177
static ThemeData themeData(Color themeColor) {
178178
return ThemeData.dark().copyWith(
179-
buttonColor: themeColor,
180179
primaryColor: Colors.grey[900],
181180
primaryColorBrightness: Brightness.dark,
182181
primaryColorLight: Colors.grey[900],
183182
primaryColorDark: Colors.grey[900],
184-
accentColor: themeColor,
185-
accentColorBrightness: Brightness.dark,
186183
canvasColor: Colors.grey[850],
187184
scaffoldBackgroundColor: Colors.grey[900],
188185
bottomAppBarColor: Colors.grey[900],
@@ -195,7 +192,14 @@ class CameraPicker extends StatefulWidget {
195192
selectionHandleColor: themeColor,
196193
),
197194
indicatorColor: themeColor,
198-
appBarTheme: const AppBarTheme(brightness: Brightness.dark, elevation: 0),
195+
appBarTheme: const AppBarTheme(
196+
systemOverlayStyle: SystemUiOverlayStyle(
197+
statusBarBrightness: Brightness.dark,
198+
statusBarIconBrightness: Brightness.light,
199+
),
200+
elevation: 0,
201+
),
202+
buttonTheme: ButtonThemeData(buttonColor: themeColor),
199203
colorScheme: ColorScheme(
200204
primary: Colors.grey[900]!,
201205
primaryVariant: Colors.grey[900]!,
@@ -369,6 +373,7 @@ class CameraPickerState extends State<CameraPicker>
369373
/// Hide system status bar automatically when the platform is not Android.
370374
/// 在非 Android 设备上自动隐藏状态栏
371375
if (!Platform.isAndroid) {
376+
// ignore: deprecated_member_use
372377
SystemChrome.setEnabledSystemUIOverlays(<SystemUiOverlay>[]);
373378
}
374379

@@ -382,6 +387,7 @@ class CameraPickerState extends State<CameraPicker>
382387
@override
383388
void dispose() {
384389
if (!Platform.isAndroid) {
390+
// ignore: deprecated_member_use
385391
SystemChrome.setEnabledSystemUIOverlays(SystemUiOverlay.values);
386392
}
387393
WidgetsBinding.instance?.removeObserver(this);

0 commit comments

Comments
 (0)