relatica/lib/screens/post_screen.dart

40 wiersze
1.2 KiB
Dart

import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
import '../controls/timeline/status_control.dart';
import '../services/timeline_manager.dart';
class PostScreen extends StatelessWidget {
final String id;
const PostScreen({super.key, required this.id});
@override
Widget build(BuildContext context) {
final manager = context.watch<TimelineManager>();
final body = manager.getPostTreeEntryBy(id).fold(
onSuccess: (post) => RefreshIndicator(
onRefresh: () async {
await manager.refreshStatusChain(id);
},
child: SingleChildScrollView(
physics: const AlwaysScrollableScrollPhysics(),
child: StatusControl(
originalItem: post,
openRemote: true,
showStatusOpenButton: true,
),
),
),
onError: (error) => Text('Error getting post: $error'));
return Scaffold(
appBar: AppBar(
title: Text('View Post'),
),
body: Padding(
padding: const EdgeInsets.all(8.0),
child: body,
));
}
}