Skip to content

Commit d8db175

Browse files
committed
🐛 Fix theme usages
1 parent c98ef36 commit d8db175

File tree

3 files changed

+12
-48
lines changed

3 files changed

+12
-48
lines changed

lib/src/widgets/camera_picker.dart

Lines changed: 7 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@ import 'dart:async';
66

77
import 'package:camera/camera.dart';
88
import 'package:flutter/material.dart';
9-
import 'package:flutter/services.dart';
9+
import 'package:wechat_picker_library/wechat_picker_library.dart'
10+
show buildTheme;
1011

1112
import '../constants/config.dart';
1213
import '../internals/singleton.dart';
@@ -64,48 +65,11 @@ class CameraPicker extends StatefulWidget {
6465

6566
/// Build a dark theme according to the theme color.
6667
/// 通过主题色构建一个默认的暗黑主题
67-
static ThemeData themeData(Color themeColor) {
68-
return ThemeData.dark().copyWith(
69-
primaryColor: Colors.grey[900],
70-
primaryColorLight: Colors.grey[900],
71-
primaryColorDark: Colors.grey[900],
72-
canvasColor: Colors.grey[850],
73-
scaffoldBackgroundColor: Colors.grey[900],
74-
cardColor: Colors.grey[900],
75-
highlightColor: Colors.transparent,
76-
textSelectionTheme: TextSelectionThemeData(
77-
cursorColor: themeColor,
78-
selectionColor: themeColor.withAlpha(100),
79-
selectionHandleColor: themeColor,
80-
),
81-
// ignore: deprecated_member_use
82-
indicatorColor: themeColor,
83-
appBarTheme: const AppBarTheme(
84-
systemOverlayStyle: SystemUiOverlayStyle(
85-
statusBarBrightness: Brightness.dark,
86-
statusBarIconBrightness: Brightness.light,
87-
),
88-
elevation: 0,
89-
),
90-
buttonTheme: ButtonThemeData(buttonColor: themeColor),
91-
colorScheme: ColorScheme(
92-
primary: Colors.grey[900]!,
93-
primaryContainer: Colors.grey[900],
94-
secondary: themeColor,
95-
secondaryContainer: themeColor,
96-
// ignore: deprecated_member_use
97-
background: Colors.grey[900]!,
98-
surface: Colors.grey[900]!,
99-
brightness: Brightness.dark,
100-
error: const Color(0xffcf6679),
101-
onPrimary: Colors.black,
102-
onSecondary: Colors.black,
103-
onSurface: Colors.white,
104-
// ignore: deprecated_member_use
105-
onBackground: Colors.white,
106-
onError: Colors.black,
107-
),
108-
);
68+
static ThemeData themeData(
69+
Color themeColor, {
70+
bool light = false,
71+
}) {
72+
return buildTheme(themeColor, light: light);
10973
}
11074

11175
@override

lib/src/widgets/camera_picker_viewer.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import '../states/camera_picker_viewer_state.dart';
1414

1515
class CameraPickerViewer extends StatefulWidget {
1616
const CameraPickerViewer._({
17-
// ignore: unused_element
17+
// ignore: unused_element, unused_element_parameter
1818
super.key,
1919
required this.viewType,
2020
required this.previewXFile,

pubspec.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,20 +15,20 @@ repository: https://github.com/fluttercandies/flutter_wechat_camera_picker
1515
issue_tracker: https://github.com/fluttercandies/flutter_wechat_camera_picker/issues
1616

1717
environment:
18-
sdk: ^3.2.0
19-
flutter: '>=3.16.0'
18+
sdk: ^3.4.0
19+
flutter: '>=3.22.0'
2020

2121
dependencies:
2222
flutter:
2323
sdk: flutter
2424

25-
wechat_picker_library: ^1.0.2
25+
wechat_picker_library: ^1.0.7
2626

2727
camera: ^0.10.0
2828
camera_android: ^0.10.9+6
2929
camera_platform_interface: ^2.1.5
3030

31-
collection: '>=1.18.0 <2.0.0'
31+
collection: ^1.18.0
3232
path: ^1.8.0
3333
photo_manager: ^3.2.3
3434
photo_manager_image_provider: ^2.0.0

0 commit comments

Comments
 (0)