mirror of
https://github.com/ente-io/ente.git
synced 2025-08-08 07:28:26 +00:00
[mob][photos] Fix alignment of faces in People section
This commit is contained in:
parent
39252122ef
commit
27d5ef2bc0
@ -51,50 +51,54 @@ class _PeopleSectionAllPageState extends State<PeopleSectionAllPage> {
|
||||
final smallFontSize = getEnteTextTheme(context).small.fontSize!;
|
||||
final textScaleFactor =
|
||||
MediaQuery.textScalerOf(context).scale(smallFontSize) / smallFontSize;
|
||||
const horizontalEdgePadding = 4.0;
|
||||
const horizontalEdgePadding = 20.0;
|
||||
const gridPadding = 16.0;
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
title: Text(S.of(context).people),
|
||||
),
|
||||
body: FutureBuilder<List<SearchResult>>(
|
||||
future: sectionData,
|
||||
builder: (context, snapshot) {
|
||||
if (snapshot.connectionState == ConnectionState.waiting) {
|
||||
return const Center(child: CircularProgressIndicator());
|
||||
} else if (snapshot.hasError) {
|
||||
return Center(child: Text('Error: ${snapshot.error}'));
|
||||
} else if (!snapshot.hasData || snapshot.data!.isEmpty) {
|
||||
return const Center(child: Text('No results found.'));
|
||||
} else {
|
||||
final results = snapshot.data!;
|
||||
final screenWidth = MediaQuery.of(context).size.width;
|
||||
final crossAxisCount = (screenWidth / 100).floor();
|
||||
body: SafeArea(
|
||||
child: FutureBuilder<List<SearchResult>>(
|
||||
future: sectionData,
|
||||
builder: (context, snapshot) {
|
||||
if (snapshot.connectionState == ConnectionState.waiting) {
|
||||
return const Center(child: CircularProgressIndicator());
|
||||
} else if (snapshot.hasError) {
|
||||
return Center(child: Text('Error: ${snapshot.error}'));
|
||||
} else if (!snapshot.hasData || snapshot.data!.isEmpty) {
|
||||
return const Center(child: Text('No results found.'));
|
||||
} else {
|
||||
final results = snapshot.data!;
|
||||
final screenWidth = MediaQuery.of(context).size.width;
|
||||
final crossAxisCount = (screenWidth / 100).floor();
|
||||
|
||||
final itemSize = (screenWidth -
|
||||
((horizontalEdgePadding * 2) +
|
||||
(crossAxisCount * gridPadding))) /
|
||||
crossAxisCount;
|
||||
final itemSize = (screenWidth -
|
||||
((horizontalEdgePadding * 2) +
|
||||
((crossAxisCount - 1) * gridPadding))) /
|
||||
crossAxisCount;
|
||||
|
||||
return GridView.builder(
|
||||
padding: const EdgeInsets.all(horizontalEdgePadding),
|
||||
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
|
||||
mainAxisSpacing: gridPadding,
|
||||
crossAxisSpacing: gridPadding,
|
||||
crossAxisCount: crossAxisCount,
|
||||
childAspectRatio:
|
||||
itemSize / (itemSize + (18 * textScaleFactor)),
|
||||
),
|
||||
itemCount: results.length,
|
||||
itemBuilder: (context, index) {
|
||||
return PersonSearchExample(
|
||||
searchResult: results[index],
|
||||
size: itemSize,
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
},
|
||||
return GridView.builder(
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: horizontalEdgePadding,
|
||||
),
|
||||
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
|
||||
mainAxisSpacing: gridPadding,
|
||||
crossAxisSpacing: gridPadding,
|
||||
crossAxisCount: crossAxisCount,
|
||||
childAspectRatio:
|
||||
itemSize / (itemSize + (24 * textScaleFactor)),
|
||||
),
|
||||
itemCount: results.length,
|
||||
itemBuilder: (context, index) {
|
||||
return PersonSearchExample(
|
||||
searchResult: results[index],
|
||||
size: itemSize,
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
},
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
@ -170,7 +170,7 @@ class SearchExampleRow extends StatelessWidget {
|
||||
return SizedBox(
|
||||
height: 128,
|
||||
child: ListView.separated(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 7),
|
||||
padding: const EdgeInsets.symmetric(horizontal: 6),
|
||||
physics: const BouncingScrollPhysics(),
|
||||
scrollDirection: Axis.horizontal,
|
||||
itemCount: examples.length,
|
||||
@ -179,7 +179,7 @@ class SearchExampleRow extends StatelessWidget {
|
||||
searchResult: examples[index],
|
||||
);
|
||||
},
|
||||
separatorBuilder: (context, index) => const SizedBox(width: 5),
|
||||
separatorBuilder: (context, index) => const SizedBox(width: 3),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user