kopia lustrzana https://gitlab.com/mysocialportal/relatica
49 wiersze
1.5 KiB
Dart
49 wiersze
1.5 KiB
Dart
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 {
|
|
final String id;
|
|
|
|
final String goToId;
|
|
|
|
const PostScreen({
|
|
super.key,
|
|
required this.id,
|
|
required this.goToId,
|
|
});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
final nss = getIt<NetworkStatusService>();
|
|
final manager = context.watch<TimelineManager>();
|
|
final body = manager.getPostTreeEntryBy(id).fold(
|
|
onSuccess: (post) => PostControl(
|
|
originalItem: post,
|
|
scrollToId: goToId,
|
|
openRemote: true,
|
|
showStatusOpenButton: true,
|
|
isRoot: true,
|
|
),
|
|
onError: (error) => Text('Error getting post: $error'));
|
|
return Scaffold(
|
|
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,
|
|
));
|
|
}
|
|
}
|