kopia lustrzana https://gitlab.com/mysocialportal/relatica
Wire in new StatusAndRefreshButton and process into PostScreen
rodzic
7f46b72c51
commit
0e60aba2f6
|
@ -1,7 +1,11 @@
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
import '../controls/standard_appbar.dart';
|
||||
import '../controls/status_and_refresh_button.dart';
|
||||
import '../controls/timeline/post_control.dart';
|
||||
import '../globals.dart';
|
||||
import '../services/network_status_service.dart';
|
||||
import '../services/timeline_manager.dart';
|
||||
|
||||
class PostScreen extends StatelessWidget {
|
||||
|
@ -17,25 +21,25 @@ class PostScreen extends StatelessWidget {
|
|||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final nss = getIt<NetworkStatusService>();
|
||||
final manager = context.watch<TimelineManager>();
|
||||
final body = manager.getPostTreeEntryBy(id).fold(
|
||||
onSuccess: (post) => RefreshIndicator(
|
||||
onRefresh: () async {
|
||||
await manager.refreshStatusChain(id);
|
||||
},
|
||||
child: PostControl(
|
||||
originalItem: post,
|
||||
scrollToId: goToId,
|
||||
openRemote: true,
|
||||
showStatusOpenButton: true,
|
||||
isRoot: true,
|
||||
),
|
||||
onSuccess: (post) => PostControl(
|
||||
originalItem: post,
|
||||
scrollToId: goToId,
|
||||
openRemote: true,
|
||||
showStatusOpenButton: true,
|
||||
isRoot: true,
|
||||
),
|
||||
onError: (error) => Text('Error getting post: $error'));
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
title: Text('View Post'),
|
||||
),
|
||||
appBar: StandardAppBar.build(context, 'View Post', actions: [
|
||||
StatusAndRefreshButton(
|
||||
valueListenable: nss.timelineLoadingStatus,
|
||||
refreshFunction: () async => await manager.refreshStatusChain(id),
|
||||
busyColor: Theme.of(context).appBarTheme.foregroundColor,
|
||||
),
|
||||
]),
|
||||
body: Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: body,
|
||||
|
|
Ładowanie…
Reference in New Issue