code refactoring

This commit is contained in:
ashilkn 2022-06-06 16:02:10 +05:30
parent 74512d85b5
commit 768558d3b9
4 changed files with 17 additions and 21 deletions

View file

@ -1,6 +1,7 @@
import 'dart:ui';
import 'package:flutter/material.dart';
import 'package:flutter_datetime_picker/flutter_datetime_picker.dart';
extension CustomColorScheme on ColorScheme {
Color get defaultTextColor =>
@ -55,6 +56,16 @@ extension CustomColorScheme on ColorScheme {
Color get cupertinoPickerTopColor => brightness == Brightness.light
? Color.fromARGB(255, 238, 238, 238)
: Colors.white.withOpacity(0.1);
DatePickerTheme get dateTimePickertheme => brightness == Brightness.light
? DatePickerTheme(
backgroundColor: Colors.white,
itemStyle: TextStyle(color: Colors.black),
cancelStyle: TextStyle(color: Colors.black))
: DatePickerTheme(
backgroundColor: Colors.black,
itemStyle: TextStyle(color: Colors.white),
cancelStyle: TextStyle(color: Colors.white));
}
OutlinedButtonThemeData buildOutlinedButtonThemeData(

View file

@ -9,6 +9,7 @@ import 'package:logging/logging.dart';
import 'package:photo_manager/photo_manager.dart';
import 'package:photos/core/event_bus.dart';
import 'package:photos/db/files_db.dart';
import 'package:photos/ente_theme_data.dart';
import 'package:photos/events/local_photos_updated_event.dart';
import 'package:photos/models/file.dart';
import 'package:photos/models/file_type.dart';
@ -253,11 +254,7 @@ class FadingAppBarState extends State<FadingAppBar> {
maxTime: DateTime.now(),
currentTime: DateTime.fromMicrosecondsSinceEpoch(file.creationTime),
locale: LocaleType.en,
theme: DatePickerTheme(
backgroundColor: Theme.of(context).backgroundColor,
itemStyle: Theme.of(context).textTheme.subtitle1,
cancelStyle: Theme.of(context).textTheme.subtitle1,
),
theme: Theme.of(context).colorScheme.dateTimePickertheme,
);
if (dateResult == null) {
return;
@ -267,11 +264,7 @@ class FadingAppBarState extends State<FadingAppBar> {
showTitleActions: true,
currentTime: dateResult,
locale: LocaleType.en,
theme: DatePickerTheme(
backgroundColor: Theme.of(context).backgroundColor,
itemStyle: Theme.of(context).textTheme.subtitle1,
cancelStyle: Theme.of(context).textTheme.subtitle1,
),
theme: Theme.of(context).colorScheme.dateTimePickertheme,
);
if (dateWithTimeResult != null) {
if (await editTime(context, List.of([widget.file]),

View file

@ -309,11 +309,7 @@ class _ManageSharedLinkWidgetState extends State<ManageSharedLinkWidget> {
minTime: DateTime.now(),
currentTime: DateTime.now(),
locale: LocaleType.en,
theme: DatePickerTheme(
backgroundColor: Theme.of(context).backgroundColor,
itemStyle: Theme.of(context).textTheme.subtitle1,
cancelStyle: Theme.of(context).textTheme.subtitle1,
),
theme: Theme.of(context).colorScheme.dateTimePickertheme,
);
if (dateResult == null) {
return null;
@ -323,11 +319,7 @@ class _ManageSharedLinkWidgetState extends State<ManageSharedLinkWidget> {
showTitleActions: true,
currentTime: dateResult,
locale: LocaleType.en,
theme: DatePickerTheme(
backgroundColor: Theme.of(context).backgroundColor,
itemStyle: Theme.of(context).textTheme.subtitle1,
cancelStyle: Theme.of(context).textTheme.subtitle1,
),
theme: Theme.of(context).colorScheme.dateTimePickertheme,
);
if (dateWithTimeResult == null) {
return null;

View file

@ -72,7 +72,7 @@ class SupportSectionWidget extends StatelessWidget {
onDoubleTap: () async {
final zipFilePath = await getZippedLogsFile(context);
await shareLogs(context, "bug@ente.io", zipFilePath);
},
},
child: SettingsTextItem(
text: "Report bug 🐞", icon: Icons.navigate_next),
),