✨ Article editor
This commit is contained in:
@ -1,9 +1,12 @@
|
||||
import 'package:auto_route/auto_route.dart';
|
||||
import 'package:easy_localization/easy_localization.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_hooks/flutter_hooks.dart';
|
||||
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
||||
import 'package:island/widgets/app_scaffold.dart';
|
||||
import 'package:island/widgets/content/sheet.dart';
|
||||
import 'package:island/widgets/post/post_list.dart';
|
||||
import 'package:material_symbols_icons/symbols.dart';
|
||||
|
||||
@RoutePage()
|
||||
class CreatorPostListScreen extends HookConsumerWidget {
|
||||
@ -15,13 +18,62 @@ class CreatorPostListScreen extends HookConsumerWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context, WidgetRef ref) {
|
||||
final refreshKey = useState(0);
|
||||
|
||||
void showCreatePostSheet() {
|
||||
showModalBottomSheet(
|
||||
context: context,
|
||||
builder:
|
||||
(context) => SheetScaffold(
|
||||
titleText: 'create'.tr(),
|
||||
child: Column(
|
||||
children: [
|
||||
ListTile(
|
||||
leading: const Icon(Symbols.edit),
|
||||
title: Text('postContent'.tr()),
|
||||
subtitle: Text('Create a regular post'),
|
||||
onTap: () async {
|
||||
Navigator.pop(context);
|
||||
final result = await context.router.pushPath(
|
||||
'/posts/compose?type=0',
|
||||
);
|
||||
if (result == true) {
|
||||
refreshKey.value++;
|
||||
}
|
||||
},
|
||||
),
|
||||
ListTile(
|
||||
leading: const Icon(Symbols.article),
|
||||
title: Text('Article'),
|
||||
subtitle: Text('Create a detailed article'),
|
||||
onTap: () async {
|
||||
Navigator.pop(context);
|
||||
final result = await context.router.pushPath(
|
||||
'/posts/compose?type=1',
|
||||
);
|
||||
if (result == true) {
|
||||
refreshKey.value++;
|
||||
}
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
return AppScaffold(
|
||||
appBar: AppBar(title: Text('posts').tr()),
|
||||
body: CustomScrollView(
|
||||
key: ValueKey(refreshKey.value),
|
||||
slivers: [
|
||||
SliverPostList(pubName: pubName, itemType: PostItemType.creator),
|
||||
],
|
||||
),
|
||||
floatingActionButton: FloatingActionButton(
|
||||
onPressed: showCreatePostSheet,
|
||||
child: const Icon(Symbols.add),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user