Skip to content

Commit da41cbe

Browse files
committed
🚀 Use ImageFormatGroup.unknown by default
1 parent faccefc commit da41cbe

File tree

1 file changed

+40
-45
lines changed

1 file changed

+40
-45
lines changed

lib/src/widget/camera_picker.dart

Lines changed: 40 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ class CameraPicker extends StatefulWidget {
4141
this.maximumRecordingDuration = const Duration(seconds: 15),
4242
this.theme,
4343
this.resolutionPreset = ResolutionPreset.max,
44-
this.imageFormatGroup = ImageFormatGroup.jpeg,
44+
this.imageFormatGroup = ImageFormatGroup.unknown,
4545
this.cameraQuarterTurns = 0,
4646
this.foregroundBuilder,
4747
this.onEntitySaving,
@@ -114,9 +114,6 @@ class CameraPicker extends StatefulWidget {
114114

115115
/// The [ImageFormatGroup] describes the output of the raw image format.
116116
/// 输出图像的格式描述
117-
///
118-
/// When null the imageFormat will fallback to the platforms default.
119-
/// 为空时将使用平台默认值
120117
final ImageFormatGroup imageFormatGroup;
121118

122119
/// The foreground widget builder which will cover the whole camera preview.
@@ -143,7 +140,7 @@ class CameraPicker extends StatefulWidget {
143140
int cameraQuarterTurns = 0,
144141
CameraPickerTextDelegate? textDelegate,
145142
ResolutionPreset resolutionPreset = ResolutionPreset.max,
146-
ImageFormatGroup imageFormatGroup = ImageFormatGroup.jpeg,
143+
ImageFormatGroup imageFormatGroup = ImageFormatGroup.unknown,
147144
Widget Function(CameraValue)? foregroundBuilder,
148145
EntitySaveCallback? onEntitySaving,
149146
}) async {
@@ -182,47 +179,45 @@ class CameraPicker extends StatefulWidget {
182179

183180
/// Build a dark theme according to the theme color.
184181
/// 通过主题色构建一个默认的暗黑主题
185-
static ThemeData themeData(Color themeColor) => ThemeData.dark().copyWith(
186-
buttonColor: themeColor,
182+
static ThemeData themeData(Color themeColor) {
183+
return ThemeData.dark().copyWith(
184+
buttonColor: themeColor,
185+
primaryColor: Colors.grey[900],
186+
primaryColorBrightness: Brightness.dark,
187+
primaryColorLight: Colors.grey[900],
188+
primaryColorDark: Colors.grey[900],
189+
accentColor: themeColor,
190+
accentColorBrightness: Brightness.dark,
191+
canvasColor: Colors.grey[850],
192+
scaffoldBackgroundColor: Colors.grey[900],
193+
bottomAppBarColor: Colors.grey[900],
194+
cardColor: Colors.grey[900],
195+
highlightColor: Colors.transparent,
196+
toggleableActiveColor: themeColor,
197+
textSelectionTheme: TextSelectionThemeData(
198+
cursorColor: themeColor,
199+
selectionColor: themeColor.withAlpha(100),
200+
selectionHandleColor: themeColor,
201+
),
202+
indicatorColor: themeColor,
203+
appBarTheme: const AppBarTheme(brightness: Brightness.dark, elevation: 0),
204+
colorScheme: ColorScheme(
205+
primary: Colors.grey[900]!,
206+
primaryVariant: Colors.grey[900]!,
207+
secondary: themeColor,
208+
secondaryVariant: themeColor,
209+
background: Colors.grey[900]!,
210+
surface: Colors.grey[900]!,
187211
brightness: Brightness.dark,
188-
primaryColor: Colors.grey[900],
189-
primaryColorBrightness: Brightness.dark,
190-
primaryColorLight: Colors.grey[900],
191-
primaryColorDark: Colors.grey[900],
192-
accentColor: themeColor,
193-
accentColorBrightness: Brightness.dark,
194-
canvasColor: Colors.grey[850],
195-
scaffoldBackgroundColor: Colors.grey[900],
196-
bottomAppBarColor: Colors.grey[900],
197-
cardColor: Colors.grey[900],
198-
highlightColor: Colors.transparent,
199-
toggleableActiveColor: themeColor,
200-
textSelectionTheme: TextSelectionThemeData(
201-
cursorColor: themeColor,
202-
selectionColor: themeColor.withAlpha(100),
203-
selectionHandleColor: themeColor,
204-
),
205-
indicatorColor: themeColor,
206-
appBarTheme: const AppBarTheme(
207-
brightness: Brightness.dark,
208-
elevation: 0,
209-
),
210-
colorScheme: ColorScheme(
211-
primary: Colors.grey[900]!,
212-
primaryVariant: Colors.grey[900]!,
213-
secondary: themeColor,
214-
secondaryVariant: themeColor,
215-
background: Colors.grey[900]!,
216-
surface: Colors.grey[900]!,
217-
brightness: Brightness.dark,
218-
error: const Color(0xffcf6679),
219-
onPrimary: Colors.black,
220-
onSecondary: Colors.black,
221-
onSurface: Colors.white,
222-
onBackground: Colors.white,
223-
onError: Colors.black,
224-
),
225-
);
212+
error: const Color(0xffcf6679),
213+
onPrimary: Colors.black,
214+
onSecondary: Colors.black,
215+
onSurface: Colors.white,
216+
onBackground: Colors.white,
217+
onError: Colors.black,
218+
),
219+
);
220+
}
226221

227222
@override
228223
CameraPickerState createState() => CameraPickerState();

0 commit comments

Comments
 (0)