Merge branch 'main' into cities
This commit is contained in:
commit
2c0069ff6e
3 changed files with 19 additions and 9 deletions
|
@ -23,7 +23,7 @@ class EmbeddingsDB {
|
|||
}
|
||||
|
||||
Future<void> clearTable() async {
|
||||
await _isar.clear();
|
||||
await _isar.writeTxn(() => _isar.clear());
|
||||
}
|
||||
|
||||
Future<List<Embedding>> getAll(Model model) async {
|
||||
|
|
|
@ -91,18 +91,24 @@ class _MemoriesWidgetState extends State<MemoriesWidget> {
|
|||
return SizedBox(
|
||||
height: _maxHeight,
|
||||
child: ListView.builder(
|
||||
physics: const BouncingScrollPhysics(),
|
||||
physics: const AlwaysScrollableScrollPhysics(
|
||||
parent: BouncingScrollPhysics(),
|
||||
),
|
||||
scrollDirection: Axis.horizontal,
|
||||
controller: _controller,
|
||||
itemCount: collatedMemories.length,
|
||||
itemBuilder: (context, itemIndex) {
|
||||
final offsetOfItem = _maxWidth * itemIndex;
|
||||
final maxScaleOffsetX =
|
||||
_maxWidth + MemoryCoverWidget.horizontalPadding * 2;
|
||||
final offsetOfItem =
|
||||
(_maxWidth + MemoryCoverWidget.horizontalPadding * 2) * itemIndex;
|
||||
return MemoryCoverWidget(
|
||||
memories: collatedMemories[itemIndex],
|
||||
controller: _controller,
|
||||
offsetOfItem: offsetOfItem,
|
||||
maxHeight: _maxHeight,
|
||||
maxWidth: _maxWidth,
|
||||
maxScaleOffsetX: maxScaleOffsetX,
|
||||
);
|
||||
},
|
||||
),
|
||||
|
|
|
@ -14,6 +14,8 @@ class MemoryCoverWidget extends StatefulWidget {
|
|||
final double maxWidth;
|
||||
static const centerStrokeWidth = 1.0;
|
||||
static const aspectRatio = 0.68;
|
||||
static const horizontalPadding = 2.5;
|
||||
final double maxScaleOffsetX;
|
||||
|
||||
const MemoryCoverWidget({
|
||||
required this.memories,
|
||||
|
@ -21,6 +23,7 @@ class MemoryCoverWidget extends StatefulWidget {
|
|||
required this.offsetOfItem,
|
||||
required this.maxHeight,
|
||||
required this.maxWidth,
|
||||
required this.maxScaleOffsetX,
|
||||
super.key,
|
||||
});
|
||||
|
||||
|
@ -48,13 +51,12 @@ class _MemoryCoverWidgetState extends State<MemoryCoverWidget> {
|
|||
animation: widget.controller,
|
||||
builder: (context, child) {
|
||||
final diff = (widget.controller.offset - widget.offsetOfItem) +
|
||||
widthOfScreen / 7;
|
||||
widget.maxScaleOffsetX;
|
||||
final scale = 1 - (diff / widthOfScreen).abs() / 3.7;
|
||||
return Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 2.5),
|
||||
//Adding this row is a workaround for making height of memory cover
|
||||
//render as [MemoryCoverWidgetNew.height] * scale. Without this, height of rendered memory
|
||||
//cover will be [MemoryCoverWidgetNew.height].
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: MemoryCoverWidget.horizontalPadding,
|
||||
),
|
||||
child: GestureDetector(
|
||||
onTap: () async {
|
||||
await routeToPage(
|
||||
|
@ -67,7 +69,9 @@ class _MemoryCoverWidgetState extends State<MemoryCoverWidget> {
|
|||
forceCustomPageRoute: true,
|
||||
);
|
||||
setState(() {});
|
||||
},
|
||||
}, //Adding this row is a workaround for making height of memory cover
|
||||
//render as [MemoryCoverWidgetNew.height] * scale. Without this, height of rendered memory
|
||||
//cover will be [MemoryCoverWidgetNew.height].
|
||||
child: Row(
|
||||
children: [
|
||||
Container(
|
||||
|
|
Loading…
Add table
Reference in a new issue