add reusable widget BottomSafe
This commit is contained in:
parent
5a449eb0be
commit
8d0f85ceae
|
@ -210,10 +210,12 @@ class HomeTab extends HookWidget {
|
|||
),
|
||||
),
|
||||
),
|
||||
body: InfiniteHomeList(
|
||||
body: SafeArea(
|
||||
child: InfiniteHomeList(
|
||||
controller: isc,
|
||||
selectedList: selectedList.value,
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,6 +2,7 @@ import 'package:cached_network_image/cached_network_image.dart';
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_hooks/flutter_hooks.dart';
|
||||
import 'package:image_picker/image_picker.dart';
|
||||
import 'package:lemmur/widgets/bottom_safe.dart';
|
||||
import 'package:lemmy_api_client/pictrs.dart';
|
||||
import 'package:lemmy_api_client/v2.dart';
|
||||
|
||||
|
@ -430,7 +431,7 @@ class _ManageAccount extends HookWidget {
|
|||
),
|
||||
child: const Text('DELETE ACCOUNT'),
|
||||
),
|
||||
const SafeArea(top: false, child: SizedBox.shrink()),
|
||||
const BottomSafe(),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
|
|
@ -0,0 +1,10 @@
|
|||
import 'package:flutter/material.dart';
|
||||
|
||||
class BottomSafe extends StatelessWidget {
|
||||
final double additionalPadding;
|
||||
const BottomSafe([this.additionalPadding = 0]);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) => SizedBox(
|
||||
height: MediaQuery.of(context).padding.bottom + additionalPadding);
|
||||
}
|
|
@ -5,6 +5,7 @@ import 'package:lemmy_api_client/v2.dart';
|
|||
|
||||
import '../comment_tree.dart';
|
||||
import 'bottom_modal.dart';
|
||||
import 'bottom_safe.dart';
|
||||
import 'comment.dart';
|
||||
|
||||
/// Manages comments section, sorts them
|
||||
|
@ -106,7 +107,7 @@ class CommentSection extends HookWidget {
|
|||
else
|
||||
for (final com in comments)
|
||||
CommentWidget(com, postCreatorId: postCreatorId),
|
||||
const SizedBox(height: 50),
|
||||
const BottomSafe(50),
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,6 +3,7 @@ import 'package:flutter/services.dart';
|
|||
import 'package:flutter_hooks/flutter_hooks.dart';
|
||||
|
||||
import '../hooks/ref.dart';
|
||||
import 'bottom_safe.dart';
|
||||
|
||||
class InfiniteScrollController {
|
||||
VoidCallback clear;
|
||||
|
@ -82,7 +83,7 @@ class InfiniteScroll<T> extends HookWidget {
|
|||
if (i == data.value.length) {
|
||||
// if there are no more, skip
|
||||
if (!hasMore.current) {
|
||||
return const SafeArea(child: SizedBox.shrink());
|
||||
return const BottomSafe();
|
||||
}
|
||||
|
||||
// if it's already fetching more, skip
|
||||
|
@ -99,6 +100,7 @@ class InfiniteScroll<T> extends HookWidget {
|
|||
}
|
||||
|
||||
return SafeArea(
|
||||
top: false,
|
||||
child: loadingWidget,
|
||||
);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue