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 'dart:ui';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_datetime_picker/flutter_datetime_picker.dart';
extension CustomColorScheme on ColorScheme { extension CustomColorScheme on ColorScheme {
Color get defaultTextColor => Color get defaultTextColor =>
@ -55,6 +56,16 @@ extension CustomColorScheme on ColorScheme {
Color get cupertinoPickerTopColor => brightness == Brightness.light Color get cupertinoPickerTopColor => brightness == Brightness.light
? Color.fromARGB(255, 238, 238, 238) ? Color.fromARGB(255, 238, 238, 238)
: Colors.white.withOpacity(0.1); : 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( OutlinedButtonThemeData buildOutlinedButtonThemeData(

View file

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

View file

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

View file

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