kopia lustrzana https://gitlab.com/mysocialportal/relatica
Clicking on home button when on that screen scrolls it to the top
rodzic
fe9a27be7c
commit
76da2ca390
|
@ -6,6 +6,7 @@
|
|||
* The "copy text" action now copies the plain text not HTML version. So things like hashtags show up as "#hashtag"
|
||||
not
|
||||
the HTML code around it with the link reference etc.
|
||||
* Clicking on the "Home" button if you already are on that screen scrolls to the top.
|
||||
* Fixes
|
||||
* New Features
|
||||
|
||||
|
|
|
@ -120,6 +120,7 @@ wanted to lay out some expectations before getting into the small details
|
|||
* Nitter replacement of Twitter links
|
||||
* User configurable Server blocking
|
||||
* Server-side searching tied into profiles, posts, hashtags
|
||||
* Smarter hashtag and user account storage/searching
|
||||
* Being able to ignore/unignore users
|
||||
* Deleting images and entire galleries
|
||||
* Events
|
||||
|
|
|
@ -17,8 +17,13 @@ enum NavBarButtons {
|
|||
class AppBottomNavBar extends StatelessWidget {
|
||||
static final _logger = Logger('$AppBottomNavBar');
|
||||
final NavBarButtons currentButton;
|
||||
final Function()? onHomeButtonReclick;
|
||||
|
||||
const AppBottomNavBar({super.key, required this.currentButton});
|
||||
const AppBottomNavBar({
|
||||
super.key,
|
||||
required this.currentButton,
|
||||
this.onHomeButtonReclick,
|
||||
});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
|
@ -36,6 +41,10 @@ class AppBottomNavBar extends StatelessWidget {
|
|||
onTap: (index) {
|
||||
final newButton = _indexToButton(index);
|
||||
if (newButton == currentButton) {
|
||||
if (newButton == NavBarButtons.timelines &&
|
||||
onHomeButtonReclick != null) {
|
||||
onHomeButtonReclick!();
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:logging/logging.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import 'package:scrollable_positioned_list/scrollable_positioned_list.dart';
|
||||
|
||||
import '../../models/TimelineIdentifiers.dart';
|
||||
import '../../services/timeline_manager.dart';
|
||||
|
@ -10,8 +11,9 @@ import 'post_control.dart';
|
|||
class TimelinePanel extends StatelessWidget {
|
||||
static final _logger = Logger('$TimelinePanel');
|
||||
final TimelineIdentifiers timeline;
|
||||
final controller = ItemScrollController();
|
||||
|
||||
const TimelinePanel({super.key, required this.timeline});
|
||||
TimelinePanel({super.key, required this.timeline});
|
||||
|
||||
Future<void> update(TimelineManager manager) async {
|
||||
await manager.updateTimeline(
|
||||
|
@ -25,6 +27,10 @@ class TimelinePanel extends StatelessWidget {
|
|||
);
|
||||
}
|
||||
|
||||
void scrollToTop() {
|
||||
controller.jumpTo(index: 0);
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
_logger.finer('Build');
|
||||
|
@ -50,7 +56,8 @@ class TimelinePanel extends StatelessWidget {
|
|||
],
|
||||
),
|
||||
)
|
||||
: ListView.builder(
|
||||
: ScrollablePositionedList.builder(
|
||||
itemScrollController: controller,
|
||||
physics: const AlwaysScrollableScrollPhysics(),
|
||||
itemBuilder: (context, index) {
|
||||
if (index == 0) {
|
||||
|
|
|
@ -78,6 +78,8 @@ class _HomeScreenState extends State<HomeScreen> {
|
|||
currentGroup = null;
|
||||
}
|
||||
|
||||
final timeline = TimelinePanel(timeline: currentTimeline);
|
||||
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
leading: accountService.loggedIn
|
||||
|
@ -150,13 +152,14 @@ class _HomeScreenState extends State<HomeScreen> {
|
|||
child: Column(
|
||||
children: [
|
||||
StandardLinearProgressIndicator(nss.timelineLoadingStatus),
|
||||
Expanded(child: TimelinePanel(timeline: currentTimeline)),
|
||||
Expanded(child: timeline),
|
||||
],
|
||||
),
|
||||
),
|
||||
drawer: StandardAppDrawer(),
|
||||
bottomNavigationBar: const AppBottomNavBar(
|
||||
drawer: const StandardAppDrawer(),
|
||||
bottomNavigationBar: AppBottomNavBar(
|
||||
currentButton: NavBarButtons.timelines,
|
||||
onHomeButtonReclick: () => timeline.scrollToTop(),
|
||||
),
|
||||
floatingActionButton: FloatingActionButton.small(
|
||||
onPressed: () {
|
||||
|
|
Ładowanie…
Reference in New Issue