Made a resuable button with linear gradient and bigger font for 'today'
This commit is contained in:
parent
89ef900bcb
commit
044471eaa1
5 changed files with 80 additions and 57 deletions
|
@ -20,12 +20,6 @@ extension CustomColorScheme on ColorScheme {
|
|||
Color get fabTextOrIconColor =>
|
||||
brightness == Brightness.light ? Colors.white : Colors.white;
|
||||
|
||||
// todo: use brightness == Brightness.light for changing color for dark/light theme
|
||||
ButtonStyle get primaryActionButtonStyle => buildElevatedButtonThemeData(
|
||||
onPrimary: Colors.white,
|
||||
primary: Color.fromRGBO(29, 185, 84, 1.0),
|
||||
).style;
|
||||
|
||||
// todo: use brightness == Brightness.light for changing color for dark/light theme
|
||||
ButtonStyle get optionalActionButtonStyle => buildElevatedButtonThemeData(
|
||||
onPrimary: Colors.black87,
|
||||
|
|
29
lib/ui/common/gradientButton.dart
Normal file
29
lib/ui/common/gradientButton.dart
Normal file
|
@ -0,0 +1,29 @@
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
|
||||
class GradientButton extends StatelessWidget {
|
||||
final Widget child;
|
||||
final List<Color> linearGradientColors;
|
||||
final Function onTap;
|
||||
|
||||
GradientButton({this.child, this.linearGradientColors, this.onTap});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return InkWell(
|
||||
onTap: onTap,
|
||||
child: Container(
|
||||
height: 56,
|
||||
decoration: BoxDecoration(
|
||||
gradient: LinearGradient(
|
||||
begin: Alignment(0.1, -0.9),
|
||||
end: Alignment(-0.6, 0.9),
|
||||
colors: linearGradientColors,
|
||||
),
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
),
|
||||
child: child,
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
|
@ -4,53 +4,52 @@ import 'package:photo_manager/photo_manager.dart';
|
|||
import 'package:photos/ente_theme_data.dart';
|
||||
import 'package:photos/services/local_sync_service.dart';
|
||||
import 'package:photos/ui/backup_folder_selection_page.dart';
|
||||
import 'package:photos/ui/common/gradientButton.dart';
|
||||
import 'package:photos/utils/navigation_util.dart';
|
||||
import 'package:sqflite/utils/utils.dart';
|
||||
|
||||
class GalleryFooterWidget extends StatelessWidget {
|
||||
const GalleryFooterWidget({Key key}) : super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Column(
|
||||
children: [
|
||||
Padding(padding: EdgeInsets.all(6)),
|
||||
Divider(
|
||||
height: 1,
|
||||
),
|
||||
Container(
|
||||
padding: EdgeInsets.fromLTRB(20, 24, 20, 72),
|
||||
child: ElevatedButton(
|
||||
style: Theme.of(context).colorScheme.primaryActionButtonStyle,
|
||||
onPressed: () async {
|
||||
if (LocalSyncService.instance.hasGrantedLimitedPermissions()) {
|
||||
await PhotoManager.presentLimited();
|
||||
} else {
|
||||
routeToPage(
|
||||
context,
|
||||
BackupFolderSelectionPage(
|
||||
buttonText: "preserve",
|
||||
),
|
||||
);
|
||||
}
|
||||
},
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
//mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Icon(
|
||||
Icons.cloud_upload,
|
||||
color: Theme.of(context).backgroundColor,
|
||||
),
|
||||
Padding(padding: EdgeInsets.all(6)),
|
||||
Text(
|
||||
"Preserve more",
|
||||
),
|
||||
],
|
||||
return Padding(
|
||||
padding: const EdgeInsets.fromLTRB(20, 24, 20, 80),
|
||||
child: GradientButton(
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
//mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Icon(
|
||||
Icons.cloud_upload_outlined,
|
||||
color: Colors.white,
|
||||
),
|
||||
),
|
||||
Padding(padding: EdgeInsets.all(6)),
|
||||
Text("Preserve more",
|
||||
style: Theme.of(context)
|
||||
.textTheme
|
||||
.headline6
|
||||
.copyWith(color: Colors.white)),
|
||||
],
|
||||
),
|
||||
],
|
||||
linearGradientColors: const [
|
||||
Color(0xFF2CD267),
|
||||
Color(0xFF1DB954),
|
||||
],
|
||||
onTap: () async {
|
||||
if (LocalSyncService.instance.hasGrantedLimitedPermissions()) {
|
||||
await PhotoManager.presentLimited();
|
||||
} else {
|
||||
routeToPage(
|
||||
context,
|
||||
BackupFolderSelectionPage(
|
||||
buttonText: "preserve",
|
||||
),
|
||||
);
|
||||
}
|
||||
},
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -89,9 +89,11 @@ class _LazyLoadingGalleryState extends State<LazyLoadingGallery> {
|
|||
fileDate.day == galleryDate.day;
|
||||
});
|
||||
if (filesUpdatedThisDay.isNotEmpty) {
|
||||
_logger.info(filesUpdatedThisDay.length.toString() +
|
||||
" files were updated on " +
|
||||
getDayTitle(galleryDate.microsecondsSinceEpoch));
|
||||
_logger.info(
|
||||
filesUpdatedThisDay.length.toString() +
|
||||
" files were updated on " +
|
||||
getDayTitle(galleryDate.microsecondsSinceEpoch),
|
||||
);
|
||||
if (event.type == EventType.addedOrUpdated) {
|
||||
final dayStartTime =
|
||||
DateTime(galleryDate.year, galleryDate.month, galleryDate.day);
|
||||
|
|
|
@ -163,16 +163,15 @@ bool isLeapYear(DateTime dateTime) {
|
|||
|
||||
Widget getDayWidget(BuildContext context, int timestamp) {
|
||||
return Container(
|
||||
padding: const EdgeInsets.fromLTRB(10, 8, 0, 10),
|
||||
alignment: Alignment.centerLeft,
|
||||
child: Text(
|
||||
getDayTitle(timestamp),
|
||||
style: TextStyle(
|
||||
fontSize: 14,
|
||||
color: Theme.of(context).colorScheme.onSurface.withOpacity(0.85),
|
||||
),
|
||||
),
|
||||
);
|
||||
padding: const EdgeInsets.fromLTRB(10, 14, 0, 12),
|
||||
alignment: Alignment.centerLeft,
|
||||
child: Text(getDayTitle(timestamp),
|
||||
style: getDayTitle(timestamp) == "Today"
|
||||
? Theme.of(context).textTheme.headline5
|
||||
: Theme.of(context).textTheme.caption.copyWith(
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.w600,
|
||||
fontFamily: 'Inter-SemiBold')));
|
||||
}
|
||||
|
||||
String getDayTitle(int timestamp) {
|
||||
|
|
Loading…
Add table
Reference in a new issue