basic theme changes

This commit is contained in:
Neeraj Gupta 2022-03-06 02:22:00 +05:30
parent d2ce10d90b
commit 682fb04743
No known key found for this signature in database
GPG key ID: 3C5A1684DC1729E1
18 changed files with 163 additions and 100 deletions

View file

@ -10,15 +10,73 @@ import 'package:photos/services/app_lifecycle_service.dart';
import 'package:photos/services/sync_service.dart';
import 'package:photos/ui/home_widget.dart';
final darkThemeData = ThemeData(
final lightThemeData = ThemeData(
fontFamily: 'Ubuntu',
brightness: Brightness.dark,
brightness: Brightness.light,
hintColor: Colors.grey,
iconTheme: IconThemeData(color: Colors.green),
primaryIconTheme: IconThemeData(color: Colors.red, opacity: 1.0, size: 50.0),
colorScheme: ColorScheme.light(primary: Colors.blue),
accentColor: Color.fromRGBO(45, 194, 98, 0.2),
buttonColor: Color.fromRGBO(45, 194, 98, 1.0),
buttonTheme: ButtonThemeData().copyWith(
buttonColor: Color.fromRGBO(45, 194, 98, 1.0),
),
toggleableActiveColor: Colors.red[400],
scaffoldBackgroundColor: Colors.white,
backgroundColor: Colors.white,
appBarTheme: AppBarTheme().copyWith(color: Colors.blue),
textTheme: TextTheme().copyWith(
caption: TextStyle(
color: Colors.black.withOpacity(0.7),
fontSize: 14,
),
overline: TextStyle(
color: Colors.black.withOpacity(0.8),
fontSize: 12,
)),
primaryTextTheme: TextTheme().copyWith(
bodyText2: TextStyle(color: Colors.yellow),
bodyText1: TextStyle(color: Colors.orange)),
cardColor: Color.fromRGBO(250, 250, 250, 1.0), //
dialogTheme: DialogTheme().copyWith(
backgroundColor: Color.fromRGBO(250, 250, 250, 1.0), //
),
textSelectionTheme: TextSelectionThemeData().copyWith(
cursorColor: Colors.white.withOpacity(0.5),
),
inputDecorationTheme: InputDecorationTheme().copyWith(
focusedBorder: UnderlineInputBorder(
borderSide: BorderSide(
color: Color.fromRGBO(45, 194, 98, 1.0),
),
),
),
);
final darkThemeData = ThemeData(
fontFamily: 'Ubuntu',
brightness: Brightness.dark,
iconTheme: IconThemeData(color: Colors.white),
primaryIconTheme: IconThemeData(color: Colors.red, opacity: 1.0, size: 50.0),
hintColor: Colors.grey,
colorScheme: ColorScheme.dark(),
accentColor: Color.fromRGBO(45, 194, 98, 0.2),
buttonColor: Color.fromRGBO(45, 194, 98, 1.0),
buttonTheme: ButtonThemeData().copyWith(
buttonColor: Color.fromRGBO(45, 194, 98, 1.0),
),
// primaryColor: Colors.red,
textTheme: TextTheme().copyWith(
caption: TextStyle(
color: Colors.white.withOpacity(0.6),
fontSize: 14,
),
overline: TextStyle(
color: Colors.white.withOpacity(0.8),
fontSize: 12,
)),
toggleableActiveColor: Colors.green[400],
scaffoldBackgroundColor: Colors.black,
backgroundColor: Colors.black,
@ -41,6 +99,11 @@ final darkThemeData = ThemeData(
),
);
extension CustomColorScheme on ColorScheme {
Color get defaultTextColor =>
brightness == Brightness.light ? Colors.black : Colors.white;
}
class EnteApp extends StatefulWidget {
static const _homeWidget = HomeWidget();
@ -71,7 +134,9 @@ class _EnteAppState extends State<EnteApp> with WidgetsBindingObserver {
Widget build(BuildContext context) {
return MaterialApp(
title: "ente",
theme: darkThemeData,
themeMode: ThemeMode.system,
theme: lightThemeData,
darkTheme: darkThemeData,
home: EnteApp._homeWidget,
debugShowCheckedModeBanner: false,
navigatorKey: Network.instance.getAlice().getNavigatorKey(),

View file

@ -23,11 +23,7 @@ class _AppUpdateDialogState extends State<AppUpdateDialog> {
for (final log in widget.latestVersionInfo.changelog) {
changelog.add(Padding(
padding: const EdgeInsets.fromLTRB(8, 4, 0, 4),
child: Text("- " + log,
style: TextStyle(
fontSize: 14,
color: Colors.white.withOpacity(0.7),
)),
child: Text("- " + log, style: Theme.of(context).textTheme.caption),
));
}
final content = Column(
@ -78,7 +74,9 @@ class _AppUpdateDialogState extends State<AppUpdateDialog> {
return WillPopScope(
onWillPop: () async => !shouldForceUpdate,
child: AlertDialog(
title: Text(shouldForceUpdate? "critical update available" : "update available"),
title: Text(shouldForceUpdate
? "critical update available"
: "update available"),
content: content,
),
);

View file

@ -72,11 +72,7 @@ class _BackupFolderSelectionPageState extends State<BackupFolderSelectionPage> {
padding: const EdgeInsets.only(left: 32, right: 32),
child: Text(
"the selected folders will be end-to-end encrypted and backed up",
style: TextStyle(
color: Colors.white.withOpacity(0.4),
fontSize: 14,
height: 1.3,
),
style: Theme.of(context).textTheme.caption.copyWith(height: 1.3),
textAlign: TextAlign.center,
),
),
@ -96,10 +92,7 @@ class _BackupFolderSelectionPageState extends State<BackupFolderSelectionPage> {
? "unselect all"
: "select all",
textAlign: TextAlign.right,
style: TextStyle(
fontSize: 12,
color: Colors.white.withOpacity(0.8),
),
style: Theme.of(context).textTheme.overline,
),
),
),
@ -179,8 +172,9 @@ class _BackupFolderSelectionPageState extends State<BackupFolderSelectionPage> {
builder: (context, dragAnimation, inDrag) {
final t = dragAnimation.value;
final elevation = lerpDouble(0, 8, t);
final color = Color.lerp(
Colors.white, Colors.white.withOpacity(0.8), t);
final themeColor = Theme.of(context).colorScheme.onSurface;
final color =
Color.lerp(themeColor, themeColor.withOpacity(0.8), t);
return SizeFadeTransition(
sizeFraction: 0.7,
curve: Curves.easeInOut,
@ -208,7 +202,7 @@ class _BackupFolderSelectionPageState extends State<BackupFolderSelectionPage> {
child: Container(
decoration: BoxDecoration(
border: Border.all(
color: Colors.black,
color: Theme.of(context).primaryColor,
),
borderRadius: BorderRadius.all(
Radius.circular(10),

View file

@ -207,7 +207,6 @@ class _CollectionsGalleryWidgetState extends State<CollectionsGalleryWidget>
children: const [
Icon(
Icons.archive_outlined,
color: Colors.white,
),
Padding(padding: EdgeInsets.all(6)),
Text(
@ -247,7 +246,6 @@ class _CollectionsGalleryWidgetState extends State<CollectionsGalleryWidget>
children: const [
Icon(
Icons.delete_outline_sharp,
color: Colors.white,
),
Padding(padding: EdgeInsets.all(6)),
Text(
@ -294,7 +292,7 @@ class _CollectionsGalleryWidgetState extends State<CollectionsGalleryWidget>
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: 13,
color: Colors.white.withOpacity(0.6),
color: Theme.of(context).colorScheme.onSurface.withOpacity(0.6),
),
);
}

View file

@ -37,7 +37,9 @@ Future<T> showChoiceDialog<T>(
firstAction,
style: TextStyle(
color: firstActionColor ??
(actionType == ActionType.critical ? Colors.red : Colors.white),
(actionType == ActionType.critical
? Colors.red
: Theme.of(context).colorScheme.onSurface),
),
),
onPressed: () {

View file

@ -27,6 +27,7 @@ class FileInfoWidget extends StatefulWidget {
class _FileInfoWidgetState extends State<FileInfoWidget> {
Map<String, IfdTag> _exif;
bool _isImage = false;
Color infoColor;
@override
void initState() {
@ -45,12 +46,13 @@ class _FileInfoWidgetState extends State<FileInfoWidget> {
@override
Widget build(BuildContext context) {
final file = widget.file;
infoColor = Theme.of(context).colorScheme.onSurface.withOpacity(0.85);
var items = <Widget>[
Row(
children: [
Icon(
Icons.calendar_today_outlined,
color: Colors.white.withOpacity(0.85),
color: infoColor
),
Padding(padding: EdgeInsets.all(4)),
Text(
@ -58,7 +60,7 @@ class _FileInfoWidgetState extends State<FileInfoWidget> {
DateTime.fromMicrosecondsSinceEpoch(file.creationTime),
),
style: TextStyle(
color: Colors.white.withOpacity(0.85),
color: infoColor
),
),
],
@ -68,7 +70,7 @@ class _FileInfoWidgetState extends State<FileInfoWidget> {
children: [
Icon(
Icons.folder_outlined,
color: Colors.white.withOpacity(0.85),
color: infoColor
),
Padding(padding: EdgeInsets.all(4)),
Text(
@ -77,7 +79,7 @@ class _FileInfoWidgetState extends State<FileInfoWidget> {
.getCollectionByID(file.collectionID)
.name,
style: TextStyle(
color: Colors.white.withOpacity(0.85),
color: infoColor
),
),
],
@ -90,7 +92,7 @@ class _FileInfoWidgetState extends State<FileInfoWidget> {
children: [
Icon(
Icons.sd_storage_outlined,
color: Colors.white.withOpacity(0.85),
color: infoColor
),
Padding(padding: EdgeInsets.all(4)),
_getFileSize(),
@ -106,7 +108,7 @@ class _FileInfoWidgetState extends State<FileInfoWidget> {
children: [
Icon(
Icons.timer_outlined,
color: Colors.white.withOpacity(0.85),
color: infoColor
),
Padding(padding: EdgeInsets.all(4)),
FutureBuilder(
@ -116,7 +118,7 @@ class _FileInfoWidgetState extends State<FileInfoWidget> {
return Text(
snapshot.data.videoDuration.toString().split(".")[0],
style: TextStyle(
color: Colors.white.withOpacity(0.85),
color: infoColor
),
);
} else {
@ -147,14 +149,14 @@ class _FileInfoWidgetState extends State<FileInfoWidget> {
children: [
Icon(
Icons.cloud_upload_outlined,
color: Colors.white.withOpacity(0.85),
color: infoColor
),
Padding(padding: EdgeInsets.all(4)),
Text(
getFormattedTime(
DateTime.fromMicrosecondsSinceEpoch(file.updationTime)),
style: TextStyle(
color: Colors.white.withOpacity(0.85),
color: infoColor
),
),
],
@ -190,7 +192,7 @@ class _FileInfoWidgetState extends State<FileInfoWidget> {
Padding(padding: EdgeInsets.all(8)),
Icon(
Icons.edit,
color: Colors.white.withOpacity(0.85),
color: infoColor
),
],
),
@ -232,7 +234,7 @@ class _FileInfoWidgetState extends State<FileInfoWidget> {
Text(
"exif",
style: TextStyle(
color: Colors.white.withOpacity(0.85),
color: infoColor
),
),
],
@ -256,13 +258,13 @@ class _FileInfoWidgetState extends State<FileInfoWidget> {
children: [
Icon(
Icons.feed_outlined,
color: Colors.white.withOpacity(0.85),
color: infoColor
),
Padding(padding: EdgeInsets.all(4)),
Text(
"view exif",
style: TextStyle(
color: Colors.white.withOpacity(0.85),
color: infoColor
),
),
],
@ -309,7 +311,7 @@ class _FileInfoWidgetState extends State<FileInfoWidget> {
child: Text(
"close",
style: TextStyle(
color: Colors.white.withOpacity(0.8),
color: infoColor,
),
),
onPressed: () {
@ -337,7 +339,7 @@ class _FileInfoWidgetState extends State<FileInfoWidget> {
children: [
Icon(
Icons.photo_size_select_actual_outlined,
color: Colors.white.withOpacity(0.85),
color: infoColor
),
Padding(padding: EdgeInsets.all(4)),
Text(
@ -345,7 +347,7 @@ class _FileInfoWidgetState extends State<FileInfoWidget> {
" x " +
exif["EXIF ExifImageLength"].toString(),
style: TextStyle(
color: Colors.white.withOpacity(0.85),
color: infoColor
),
),
],
@ -359,7 +361,7 @@ class _FileInfoWidgetState extends State<FileInfoWidget> {
children: [
Icon(
Icons.photo_size_select_actual_outlined,
color: Colors.white.withOpacity(0.85),
color: infoColor
),
Padding(padding: EdgeInsets.all(4)),
Text(
@ -367,7 +369,7 @@ class _FileInfoWidgetState extends State<FileInfoWidget> {
" x " +
exif["Image ImageLength"].toString(),
style: TextStyle(
color: Colors.white.withOpacity(0.85),
color: infoColor
),
),
],
@ -382,7 +384,7 @@ class _FileInfoWidgetState extends State<FileInfoWidget> {
children: [
Icon(
Icons.camera_outlined,
color: Colors.white.withOpacity(0.85),
color: infoColor
),
Padding(padding: EdgeInsets.all(4)),
Flexible(
@ -391,7 +393,7 @@ class _FileInfoWidgetState extends State<FileInfoWidget> {
" " +
exif["Image Model"].toString(),
style: TextStyle(
color: Colors.white.withOpacity(0.85),
color: infoColor
),
overflow: TextOverflow.clip,
),
@ -408,13 +410,13 @@ class _FileInfoWidgetState extends State<FileInfoWidget> {
children: [
Icon(
CupertinoIcons.f_cursive,
color: Colors.white.withOpacity(0.85),
color: infoColor
),
Padding(padding: EdgeInsets.all(4)),
Text(
fNumber.toString(),
style: TextStyle(
color: Colors.white.withOpacity(0.85),
color: infoColor
),
),
],
@ -428,12 +430,12 @@ class _FileInfoWidgetState extends State<FileInfoWidget> {
children: [
Icon(
Icons.center_focus_strong_outlined,
color: Colors.white.withOpacity(0.85),
color: infoColor
),
Padding(padding: EdgeInsets.all(4)),
Text(focalLength.toString() + " mm",
style: TextStyle(
color: Colors.white.withOpacity(0.85),
color: infoColor
)),
],
),
@ -446,13 +448,13 @@ class _FileInfoWidgetState extends State<FileInfoWidget> {
children: [
Icon(
Icons.shutter_speed,
color: Colors.white.withOpacity(0.85),
color: infoColor
),
Padding(padding: EdgeInsets.all(4)),
Text(
exif["EXIF ExposureTime"].toString(),
style: TextStyle(
color: Colors.white.withOpacity(0.85),
color: infoColor
),
),
],
@ -473,7 +475,7 @@ class _FileInfoWidgetState extends State<FileInfoWidget> {
return Text(
(snapshot.data / (1024 * 1024)).toStringAsFixed(2) + " MB",
style: TextStyle(
color: Colors.white.withOpacity(0.85),
color: infoColor
),
);
} else {

View file

@ -49,6 +49,11 @@ class _FreeSpacePageState extends State<FreeSpacePage> {
Widget _getWidget(BackupStatus status) {
final count = status.localIDs.length;
final formattedCount = NumberFormat().format(count);
final informationTextStyle = TextStyle(
fontSize: 14,
height: 1.3,
color: Theme.of(context).colorScheme.onSurface.withOpacity(0.8),
);
return Container(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
@ -75,11 +80,7 @@ class _FreeSpacePageState extends State<FreeSpacePage> {
" file on this device has been backed up safely"
: formattedCount.toString() +
" files on this device have been backed up safely",
style: TextStyle(
fontSize: 14,
height: 1.3,
color: Colors.white.withOpacity(0.8),
),
style: informationTextStyle,
),
),
],
@ -100,11 +101,7 @@ class _FreeSpacePageState extends State<FreeSpacePage> {
(count == 1 ? "it" : "they") +
" can be deleted from this device to free up " +
formatBytes(status.size),
style: TextStyle(
fontSize: 14,
height: 1.3,
color: Colors.white.withOpacity(0.8),
),
style: informationTextStyle,
),
),
],
@ -125,11 +122,7 @@ class _FreeSpacePageState extends State<FreeSpacePage> {
"you can still access " +
(count == 1 ? "it" : "them") +
" on ente as long as you have an active subscription",
style: TextStyle(
fontSize: 14,
height: 1.3,
color: Colors.white.withOpacity(0.8),
),
style: informationTextStyle,
),
),
],

View file

@ -34,16 +34,14 @@ class GalleryFooterWidget extends StatelessWidget {
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisSize: MainAxisSize.min,
children: const [
Icon(
Icons.cloud_upload,
color: Colors.white,
),
children: [
Icon(Icons.cloud_upload,
color: Theme.of(context).colorScheme.onSurface),
Padding(padding: EdgeInsets.all(6)),
Text(
"preserve more",
style: TextStyle(
color: Colors.white,
color: Theme.of(context).colorScheme.onBackground,
),
),
],

View file

@ -441,7 +441,7 @@ class _HomeWidgetState extends State<HomeWidget> {
Widget _buildBottomNavigationBar() {
return Container(
decoration: BoxDecoration(
color: Colors.black.withOpacity(0.90),
color: Theme.of(context).backgroundColor.withOpacity(0.30),
),
child: SafeArea(
child: Padding(
@ -455,7 +455,8 @@ class _HomeWidgetState extends State<HomeWidget> {
padding: EdgeInsets.symmetric(horizontal: 20, vertical: 12),
duration: Duration(milliseconds: 400),
tabMargin: EdgeInsets.only(left: 8, right: 8),
tabBackgroundColor: Color.fromRGBO(15, 25, 25, 0.7),
tabBackgroundColor:
Theme.of(context).cardColor.withOpacity(0.7), // review
haptic: false,
tabs: [
GButton(

View file

@ -61,8 +61,8 @@ class HugeListView<T> extends StatefulWidget {
this.emptyResultBuilder,
this.errorBuilder,
this.firstShown,
this.thumbBackgroundColor = Colors.white,
this.thumbDrawColor = Colors.grey,
this.thumbBackgroundColor = Colors.red,// Colors.white,
this.thumbDrawColor = Colors.yellow, //Colors.grey,
this.thumbHeight = 48.0,
this.isDraggableScrollbarEnabled = true,
}) : super(key: key);

View file

@ -146,7 +146,7 @@ class _LazyLoadingGalleryState extends State<LazyLoadingGallery> {
padding: const EdgeInsets.only(bottom: 12),
child: Column(
children: [
getDayWidget(_files[0].creationTime),
getDayWidget(context, _files[0].creationTime),
_shouldRender ? _getGallery() : PlaceHolderWidget(_files.length),
],
),

View file

@ -72,6 +72,7 @@ class _DangerSectionWidgetState extends State<DangerSectionWidget> {
),
],
style: TextStyle(
color: Theme.of(context).colorScheme.onSurface,
height: 1.5,
fontFamily: 'Ubuntu',
fontSize: 16,
@ -103,7 +104,7 @@ class _DangerSectionWidgetState extends State<DangerSectionWidget> {
child: Text(
"ok",
style: TextStyle(
color: Colors.white,
color: Theme.of(context).colorScheme.onSurface,
),
),
onPressed: () {

View file

@ -27,7 +27,8 @@ class _DetailsSectionWidgetState extends State<DetailsSectionWidget> {
void initState() {
super.initState();
_fetchUserDetails();
_userDetailsChangedEvent = Bus.instance.on<UserDetailsChangedEvent>().listen((event) {
_userDetailsChangedEvent =
Bus.instance.on<UserDetailsChangedEvent>().listen((event) {
_fetchUserDetails();
});
}
@ -101,7 +102,6 @@ class _DetailsSectionWidgetState extends State<DetailsSectionWidget> {
centerText:
convertBytesToReadableFormat(_userDetails.usage) + "\nused",
centerTextStyle: TextStyle(
color: Colors.white,
fontSize: 12,
),
initialAngleInDegree: 270,
@ -123,19 +123,13 @@ class _DetailsSectionWidgetState extends State<DetailsSectionWidget> {
Padding(padding: EdgeInsets.all(6)),
Text(
_userDetails.fileCount.toString() + " memories preserved",
style: TextStyle(
color: Colors.white.withOpacity(0.6),
fontSize: 14,
),
style: Theme.of(context).textTheme.caption,
),
Padding(padding: EdgeInsets.all(3)),
Text(
_userDetails.sharedCollectionsCount.toString() +
" albums shared",
style: TextStyle(
color: Colors.white.withOpacity(0.6),
fontSize: 14,
),
style: Theme.of(context).textTheme.caption,
),
],
),

View file

@ -13,7 +13,7 @@ class SettingsButton extends StatelessWidget {
child: IconButton(
icon: Icon(
Icons.settings,
color: Colors.white.withOpacity(0.4),
color: Theme.of(context).colorScheme.onSurface.withOpacity(0.6),
),
padding: EdgeInsets.fromLTRB(16, 4, 16, 18),
onPressed: () async {

View file

@ -162,7 +162,9 @@ class _SharedCollectionGalleryState extends State<SharedCollectionGallery>
children: [
Text(
"no one is sharing with you",
style: TextStyle(color: Colors.white.withOpacity(0.6)),
style: TextStyle(
color:
Theme.of(context).colorScheme.onSurface.withOpacity(0.6)),
),
Container(
padding: EdgeInsets.fromLTRB(28, 20, 28, 46),
@ -184,13 +186,19 @@ class _SharedCollectionGalleryState extends State<SharedCollectionGallery>
children: [
Icon(
Icons.outgoing_mail,
color: Colors.white.withOpacity(0.7),
color: Theme.of(context)
.colorScheme
.onSurface
.withOpacity(0.7),
),
Padding(padding: EdgeInsets.all(6)),
Text(
"invite",
style: TextStyle(
color: Colors.white.withOpacity(0.8),
color: Theme.of(context)
.colorScheme
.onSurface
.withOpacity(0.8),
),
),
],
@ -212,7 +220,9 @@ class _SharedCollectionGalleryState extends State<SharedCollectionGallery>
children: [
Text(
"you aren't sharing anything",
style: TextStyle(color: Colors.white.withOpacity(0.6)),
style: TextStyle(
color:
Theme.of(context).colorScheme.onSurface.withOpacity(0.6)),
),
Container(
padding: EdgeInsets.fromLTRB(28, 20, 28, 46),
@ -234,13 +244,19 @@ class _SharedCollectionGalleryState extends State<SharedCollectionGallery>
children: [
Icon(
Icons.person_add,
color: Colors.white.withOpacity(0.7),
color: Theme.of(context)
.colorScheme
.onSurface
.withOpacity(0.7),
),
Padding(padding: EdgeInsets.all(6)),
Text(
"share",
style: TextStyle(
color: Colors.white.withOpacity(0.8),
color: Theme.of(context)
.colorScheme
.onSurface
.withOpacity(0.8),
),
),
],

View file

@ -41,7 +41,7 @@ class _VideoControlsState extends State<VideoControls> {
: Center(
child: Icon(
Icons.error,
color: Colors.white,
color: Theme.of(context).colorScheme.onSurface,
size: 42,
),
);

View file

@ -1,4 +1,5 @@
import 'package:flutter/material.dart';
Map<int, String> _months = {
1: "Jan",
2: "Feb",
@ -160,7 +161,7 @@ bool isLeapYear(DateTime dateTime) {
}
}
Widget getDayWidget(int timestamp) {
Widget getDayWidget(BuildContext context, int timestamp) {
return Container(
padding: const EdgeInsets.fromLTRB(10, 8, 0, 10),
alignment: Alignment.centerLeft,
@ -168,7 +169,7 @@ Widget getDayWidget(int timestamp) {
getDayTitle(timestamp),
style: TextStyle(
fontSize: 14,
color: Colors.white.withOpacity(0.85),
color: Theme.of(context).colorScheme.onSurface.withOpacity(0.85),
),
),
);

View file

@ -35,7 +35,7 @@ Future<dynamic> showErrorDialog(
child: Text(
"ok",
style: TextStyle(
color: Colors.white,
color: Theme.of(context).colorScheme.onSurface,
),
),
onPressed: () {