Merge pull request #657 from ente-io/select-all-button-tap-area

Select all button tap area
This commit is contained in:
Neeraj Gupta 2022-11-21 15:48:25 +05:30 committed by GitHub
commit ca58f38fa3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 64 additions and 79 deletions

View file

@ -1,7 +0,0 @@
{
"workbench.colorCustomizations": {
"activityBar.background": "#123046",
"titleBar.activeBackground": "#194363",
"titleBar.activeForeground": "#F9FBFD"
}
}

View file

@ -33,7 +33,6 @@ class LazyLoadingGallery extends StatefulWidget {
final String tag;
final String logTag;
final Stream<int> currentIndexStream;
final bool smallerTodayFont;
LazyLoadingGallery(
this.files,
@ -44,7 +43,6 @@ class LazyLoadingGallery extends StatefulWidget {
this.selectedFiles,
this.tag,
this.currentIndexStream, {
this.smallerTodayFont,
this.logTag = "",
Key key,
}) : super(key: key ?? UniqueKey());
@ -182,22 +180,26 @@ class _LazyLoadingGalleryState extends State<LazyLoadingGallery> {
}
return Column(
children: [
Padding(
padding: const EdgeInsets.fromLTRB(4, 14, 12, 8),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
getDayWidget(
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Padding(
padding: const EdgeInsets.all(12),
child: getDayWidget(
context,
_files[0].creationTime,
widget.smallerTodayFont,
),
ValueListenableBuilder(
valueListenable: _showSelectAllButton,
builder: (context, value, _) {
return widget.selectedFiles.files.isEmpty
? const SizedBox.shrink()
: GestureDetector(
),
ValueListenableBuilder(
valueListenable: _showSelectAllButton,
builder: (context, value, _) {
return widget.selectedFiles.files.isEmpty
? const SizedBox.shrink()
: GestureDetector(
behavior: HitTestBehavior.translucent,
child: SizedBox(
width: 48,
height: 44,
child: ValueListenableBuilder(
valueListenable: _shouldSelectAll,
builder: (context, value, _) {
@ -214,14 +216,14 @@ class _LazyLoadingGalleryState extends State<LazyLoadingGallery> {
);
},
),
onTap: () {
_shouldSelectAll.value = !_shouldSelectAll.value;
},
);
},
)
],
),
),
onTap: () {
_shouldSelectAll.value = !_shouldSelectAll.value;
},
);
},
)
],
),
_shouldRender ? _getGallery() : PlaceHolderWidget(_files.length),
],
@ -380,6 +382,8 @@ class _LazyLoadingGridViewState extends State<LazyLoadingGridView> {
},
itemCount: widget.files.length,
gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount(
crossAxisSpacing: 2,
mainAxisSpacing: 2,
crossAxisCount: 4,
),
padding: const EdgeInsets.all(0),
@ -399,47 +403,41 @@ class _LazyLoadingGridViewState extends State<LazyLoadingGridView> {
HapticFeedback.lightImpact();
_selectFile(file);
},
child: Container(
margin: const EdgeInsets.all(1.5),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(3),
),
child: ClipRRect(
borderRadius: BorderRadius.circular(3),
child: Stack(
children: [
Hero(
tag: widget.tag + file.tag,
child: ColorFiltered(
colorFilter: ColorFilter.mode(
Colors.black.withOpacity(
widget.selectedFiles.isFileSelected(file) ? 0.4 : 0,
),
BlendMode.darken,
),
child: ThumbnailWidget(
file,
diskLoadDeferDuration: thumbnailDiskLoadDeferDuration,
serverLoadDeferDuration: thumbnailServerLoadDeferDuration,
shouldShowLivePhotoOverlay: true,
key: Key(widget.tag + file.tag),
child: ClipRRect(
borderRadius: BorderRadius.circular(1),
child: Stack(
children: [
Hero(
tag: widget.tag + file.tag,
child: ColorFiltered(
colorFilter: ColorFilter.mode(
Colors.black.withOpacity(
widget.selectedFiles.isFileSelected(file) ? 0.4 : 0,
),
BlendMode.darken,
),
child: ThumbnailWidget(
file,
diskLoadDeferDuration: thumbnailDiskLoadDeferDuration,
serverLoadDeferDuration: thumbnailServerLoadDeferDuration,
shouldShowLivePhotoOverlay: true,
key: Key(widget.tag + file.tag),
),
),
Visibility(
visible: widget.selectedFiles.isFileSelected(file),
child: const Positioned(
right: 4,
top: 4,
child: Icon(
Icons.check_circle_rounded,
size: 20,
color: Colors.white, //same for both themes
),
),
Visibility(
visible: widget.selectedFiles.isFileSelected(file),
child: const Positioned(
right: 4,
top: 4,
child: Icon(
Icons.check_circle_rounded,
size: 20,
color: Colors.white, //same for both themes
),
)
],
),
),
)
],
),
),
);

View file

@ -66,7 +66,6 @@ class CollectionPage extends StatelessWidget {
tagPrefix: tagPrefix,
selectedFiles: _selectedFiles,
initialFiles: initialFiles,
smallerTodayFont: true,
albumName: c.collection.name,
);
return Scaffold(

View file

@ -39,7 +39,6 @@ class Gallery extends StatefulWidget {
final Widget header;
final Widget footer;
final Widget emptyState;
final bool smallerTodayFont;
final String albumName;
final double scrollBottomSafeArea;
@ -55,7 +54,6 @@ class Gallery extends StatefulWidget {
this.footer = const SizedBox(height: 120),
this.emptyState = const EmptyState(),
this.scrollBottomSafeArea = 120.0,
this.smallerTodayFont = false,
this.albumName = '',
Key key,
}) : super(key: key);
@ -247,7 +245,6 @@ class _GalleryState extends State<Gallery> {
.on<GalleryIndexUpdatedEvent>()
.where((event) => event.tag == widget.tagPrefix)
.map((event) => event.index),
smallerTodayFont: widget.smallerTodayFont,
logTag: _logTag,
);
if (widget.header != null && index == 0) {

View file

@ -1,6 +1,7 @@
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:intl/intl.dart';
import 'package:photos/theme/ente_theme.dart';
const Set<int> monthWith31Days = {1, 3, 5, 7, 8, 10, 12};
const Set<int> monthWith30Days = {4, 6, 9, 11};
@ -194,19 +195,16 @@ bool isLeapYear(DateTime dateTime) {
Widget getDayWidget(
BuildContext context,
int timestamp,
bool smallerTodayFont,
) {
final colorScheme = getEnteColorScheme(context);
final textTheme = getEnteTextTheme(context);
return Container(
alignment: Alignment.centerLeft,
child: Text(
getDayTitle(timestamp),
style: (getDayTitle(timestamp) == "Today" && !smallerTodayFont)
? Theme.of(context).textTheme.headline5
: Theme.of(context).textTheme.caption?.copyWith(
fontSize: 16,
fontWeight: FontWeight.w600,
fontFamily: 'Inter-SemiBold',
),
style: (getDayTitle(timestamp) == "Today")
? textTheme.body
: textTheme.body.copyWith(color: colorScheme.textMuted),
),
);
}