2020-09-07 21:29:07 +02:00
|
|
|
import 'package:cached_network_image/cached_network_image.dart';
|
2020-09-08 21:18:17 +02:00
|
|
|
import 'package:esys_flutter_share/esys_flutter_share.dart';
|
2020-09-16 22:53:04 +02:00
|
|
|
import 'package:flutter/cupertino.dart';
|
2020-09-07 21:29:07 +02:00
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
import 'package:flutter_hooks/flutter_hooks.dart';
|
2021-01-24 20:01:55 +01:00
|
|
|
import 'package:lemmy_api_client/v2.dart';
|
2021-01-16 13:28:25 +01:00
|
|
|
import 'package:url_launcher/url_launcher.dart' as ul;
|
2020-09-07 21:29:07 +02:00
|
|
|
|
2020-09-29 00:57:25 +02:00
|
|
|
import '../hooks/stores.dart';
|
2021-01-27 20:50:28 +01:00
|
|
|
import '../util/extensions/api.dart';
|
2020-09-09 17:41:54 +02:00
|
|
|
import '../util/goto.dart';
|
2020-12-04 13:57:37 +01:00
|
|
|
import '../util/more_icon.dart';
|
2020-09-07 21:29:07 +02:00
|
|
|
import '../util/text_color.dart';
|
|
|
|
import '../widgets/badge.dart';
|
2021-01-16 13:28:25 +01:00
|
|
|
import '../widgets/bottom_modal.dart';
|
2020-09-11 20:38:50 +02:00
|
|
|
import '../widgets/fullscreenable_image.dart';
|
2020-10-26 18:47:49 +01:00
|
|
|
import '../widgets/info_table_popup.dart';
|
2020-09-07 21:29:07 +02:00
|
|
|
import '../widgets/markdown_text.dart';
|
2020-09-29 10:27:36 +02:00
|
|
|
import '../widgets/sortable_infinite_list.dart';
|
2020-09-08 23:01:40 +02:00
|
|
|
import 'communities_list.dart';
|
2020-09-08 20:24:36 +02:00
|
|
|
import 'users_list.dart';
|
2020-09-07 21:29:07 +02:00
|
|
|
|
2020-09-30 19:05:00 +02:00
|
|
|
/// Displays posts, comments, and general info about the given instance
|
2020-09-07 21:29:07 +02:00
|
|
|
class InstancePage extends HookWidget {
|
2020-12-31 14:58:23 +01:00
|
|
|
final String instanceHost;
|
2020-09-07 21:29:07 +02:00
|
|
|
final Future<FullSiteView> siteFuture;
|
2020-09-08 18:57:48 +02:00
|
|
|
final Future<List<CommunityView>> communitiesFuture;
|
2020-09-07 21:29:07 +02:00
|
|
|
|
2020-09-08 22:33:11 +02:00
|
|
|
void _share() =>
|
2020-12-31 14:58:23 +01:00
|
|
|
Share.text('Share instance', 'https://$instanceHost', 'text/plain');
|
2020-09-07 21:29:07 +02:00
|
|
|
|
2020-12-31 14:58:23 +01:00
|
|
|
InstancePage({@required this.instanceHost})
|
|
|
|
: assert(instanceHost != null),
|
2021-01-24 20:01:55 +01:00
|
|
|
siteFuture = LemmyApiV2(instanceHost).run(GetSite()),
|
2021-01-31 14:42:28 +01:00
|
|
|
communitiesFuture = LemmyApiV2(instanceHost).run(ListCommunities(
|
|
|
|
type: PostListingType.local, sort: SortType.hot, limit: 6));
|
2020-09-07 21:29:07 +02:00
|
|
|
|
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
final theme = Theme.of(context);
|
|
|
|
final siteSnap = useFuture(siteFuture);
|
|
|
|
final colorOnCard = textColorBasedOnBackground(theme.cardColor);
|
2020-09-29 10:53:40 +02:00
|
|
|
final accStore = useAccountsStore();
|
2020-09-07 21:29:07 +02:00
|
|
|
|
|
|
|
if (!siteSnap.hasData) {
|
|
|
|
return Scaffold(
|
|
|
|
appBar: AppBar(
|
|
|
|
iconTheme: theme.iconTheme,
|
2020-09-09 22:15:39 +02:00
|
|
|
brightness: theme.brightness,
|
2020-09-07 21:29:07 +02:00
|
|
|
backgroundColor: theme.cardColor,
|
|
|
|
elevation: 0,
|
|
|
|
),
|
|
|
|
body: Center(
|
|
|
|
child: Column(
|
|
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
|
|
children: [
|
|
|
|
if (siteSnap.hasError) ...[
|
2021-01-03 19:43:39 +01:00
|
|
|
const Icon(Icons.error),
|
2020-09-07 21:29:07 +02:00
|
|
|
Padding(
|
|
|
|
padding: const EdgeInsets.all(8),
|
|
|
|
child: Text('ERROR: ${siteSnap.error}'),
|
|
|
|
)
|
|
|
|
] else
|
2021-01-03 19:43:39 +01:00
|
|
|
const CircularProgressIndicator(semanticsLabel: 'loading')
|
2020-09-07 21:29:07 +02:00
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
final site = siteSnap.data;
|
|
|
|
|
2020-09-09 01:22:07 +02:00
|
|
|
void _openMoreMenu(BuildContext c) {
|
2021-01-16 13:28:25 +01:00
|
|
|
showModalBottomSheet(
|
|
|
|
backgroundColor: Colors.transparent,
|
|
|
|
context: context,
|
|
|
|
builder: (context) => BottomModal(
|
|
|
|
child: Column(
|
|
|
|
children: [
|
|
|
|
ListTile(
|
|
|
|
leading: const Icon(Icons.open_in_browser),
|
|
|
|
title: const Text('Open in browser'),
|
|
|
|
onTap: () async => await ul
|
2021-01-24 20:01:55 +01:00
|
|
|
.canLaunch('https://${site.instanceHost}')
|
|
|
|
? ul.launch('https://${site.instanceHost}')
|
2021-01-16 13:28:25 +01:00
|
|
|
: Scaffold.of(context).showSnackBar(
|
|
|
|
const SnackBar(content: Text("can't open in browser"))),
|
|
|
|
),
|
|
|
|
ListTile(
|
|
|
|
leading: const Icon(Icons.info_outline),
|
|
|
|
title: const Text('Nerd stuff'),
|
|
|
|
onTap: () {
|
|
|
|
showInfoTablePopup(context, {
|
|
|
|
'url': instanceHost,
|
2021-01-24 20:01:55 +01:00
|
|
|
'creator': '@${site.siteView.creator.name}',
|
2021-01-16 13:28:25 +01:00
|
|
|
'version': site.version,
|
2021-01-24 20:01:55 +01:00
|
|
|
'enableDownvotes': site.siteView.site.enableDownvotes,
|
|
|
|
'enableNsfw': site.siteView.site.enableNsfw,
|
|
|
|
'published': site.siteView.site.published,
|
|
|
|
'updated': site.siteView.site.updated,
|
2021-01-16 13:28:25 +01:00
|
|
|
});
|
|
|
|
},
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
);
|
2020-09-09 01:22:07 +02:00
|
|
|
}
|
|
|
|
|
2020-09-07 21:29:07 +02:00
|
|
|
return Scaffold(
|
|
|
|
body: DefaultTabController(
|
|
|
|
length: 3,
|
|
|
|
child: NestedScrollView(
|
2020-09-08 23:10:40 +02:00
|
|
|
headerSliverBuilder: (context, innerBoxIsScrolled) => <Widget>[
|
|
|
|
SliverAppBar(
|
2020-09-09 22:15:39 +02:00
|
|
|
brightness: theme.brightness,
|
2020-09-08 23:10:40 +02:00
|
|
|
expandedHeight: 200,
|
|
|
|
pinned: true,
|
|
|
|
elevation: 0,
|
|
|
|
backgroundColor: theme.cardColor,
|
|
|
|
iconTheme: theme.iconTheme,
|
|
|
|
title: Text(
|
2021-01-24 20:01:55 +01:00
|
|
|
site.siteView.site.name,
|
2020-09-08 23:10:40 +02:00
|
|
|
style: TextStyle(color: colorOnCard),
|
|
|
|
),
|
|
|
|
actions: [
|
2021-01-03 19:43:39 +01:00
|
|
|
IconButton(icon: const Icon(Icons.share), onPressed: _share),
|
2020-09-08 23:10:40 +02:00
|
|
|
IconButton(
|
2020-12-04 13:57:37 +01:00
|
|
|
icon: Icon(moreIcon),
|
2020-09-08 23:10:40 +02:00
|
|
|
onPressed: () => _openMoreMenu(context)),
|
|
|
|
],
|
|
|
|
flexibleSpace: FlexibleSpaceBar(
|
|
|
|
background: Stack(children: [
|
2021-01-24 20:01:55 +01:00
|
|
|
if (site.siteView.site.banner != null)
|
2020-09-11 21:18:45 +02:00
|
|
|
FullscreenableImage(
|
2021-01-24 20:01:55 +01:00
|
|
|
url: site.siteView.site.banner,
|
2020-09-13 16:05:17 +02:00
|
|
|
child: CachedNetworkImage(
|
2021-01-24 20:01:55 +01:00
|
|
|
imageUrl: site.siteView.site.banner,
|
2021-01-03 19:43:39 +01:00
|
|
|
errorWidget: (_, __, ___) => const SizedBox.shrink(),
|
2020-09-13 16:05:17 +02:00
|
|
|
),
|
2020-09-11 21:18:45 +02:00
|
|
|
),
|
2020-09-08 23:10:40 +02:00
|
|
|
SafeArea(
|
|
|
|
child: Center(
|
|
|
|
child: Column(
|
|
|
|
children: [
|
|
|
|
Padding(
|
|
|
|
padding: const EdgeInsets.only(top: 40),
|
2021-01-24 20:01:55 +01:00
|
|
|
child: site.siteView.site.icon == null
|
2021-01-09 02:42:00 +01:00
|
|
|
? const SizedBox(height: 100, width: 100)
|
|
|
|
: FullscreenableImage(
|
2021-01-24 20:01:55 +01:00
|
|
|
url: site.siteView.site.icon,
|
2021-01-09 02:42:00 +01:00
|
|
|
child: CachedNetworkImage(
|
|
|
|
width: 100,
|
|
|
|
height: 100,
|
2021-01-24 20:01:55 +01:00
|
|
|
imageUrl: site.siteView.site.icon,
|
2021-01-09 02:42:00 +01:00
|
|
|
errorWidget: (_, __, ___) =>
|
|
|
|
const Icon(Icons.warning),
|
|
|
|
),
|
|
|
|
),
|
2020-09-08 23:10:40 +02:00
|
|
|
),
|
2021-01-24 20:01:55 +01:00
|
|
|
Text(site.siteView.site.name,
|
2020-09-08 23:10:40 +02:00
|
|
|
style: theme.textTheme.headline6),
|
2020-12-31 14:58:23 +01:00
|
|
|
Text(instanceHost, style: theme.textTheme.caption)
|
2020-09-08 23:10:40 +02:00
|
|
|
],
|
2020-09-07 21:29:07 +02:00
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
2020-09-08 23:10:40 +02:00
|
|
|
]),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
SliverPersistentHeader(
|
|
|
|
delegate: _SliverAppBarDelegate(
|
|
|
|
TabBar(
|
|
|
|
labelColor: theme.textTheme.bodyText1.color,
|
|
|
|
unselectedLabelColor: Colors.grey,
|
2021-01-03 18:21:56 +01:00
|
|
|
tabs: const [
|
2020-09-08 23:10:40 +02:00
|
|
|
Tab(text: 'Posts'),
|
|
|
|
Tab(text: 'Comments'),
|
|
|
|
Tab(text: 'About'),
|
|
|
|
],
|
2020-09-07 21:29:07 +02:00
|
|
|
),
|
|
|
|
),
|
2020-09-08 23:10:40 +02:00
|
|
|
pinned: true,
|
|
|
|
),
|
|
|
|
],
|
2020-09-07 21:29:07 +02:00
|
|
|
body: TabBarView(
|
|
|
|
children: [
|
2020-09-28 22:41:40 +02:00
|
|
|
InfinitePostList(
|
|
|
|
fetcher: (page, batchSize, sort) =>
|
2021-01-24 20:01:55 +01:00
|
|
|
LemmyApiV2(instanceHost).run(GetPosts(
|
|
|
|
// TODO: switch between all and subscribed
|
|
|
|
type: PostListingType.all,
|
|
|
|
sort: sort,
|
|
|
|
limit: batchSize,
|
|
|
|
page: page,
|
|
|
|
auth: accStore.defaultTokenFor(instanceHost)?.raw,
|
|
|
|
))),
|
2020-09-29 10:53:40 +02:00
|
|
|
InfiniteCommentList(
|
|
|
|
fetcher: (page, batchSize, sort) =>
|
2021-01-24 20:01:55 +01:00
|
|
|
LemmyApiV2(instanceHost).run(GetComments(
|
|
|
|
type: CommentListingType.all,
|
|
|
|
sort: sort,
|
|
|
|
limit: batchSize,
|
|
|
|
page: page,
|
|
|
|
auth: accStore.defaultTokenFor(instanceHost)?.raw,
|
|
|
|
))),
|
2020-09-12 09:30:22 +02:00
|
|
|
_AboutTab(site,
|
|
|
|
communitiesFuture: communitiesFuture,
|
2020-12-31 14:58:23 +01:00
|
|
|
instanceHost: instanceHost),
|
2020-09-07 21:29:07 +02:00
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
class _SliverAppBarDelegate extends SliverPersistentHeaderDelegate {
|
|
|
|
final TabBar _tabBar;
|
|
|
|
|
2021-01-03 19:43:39 +01:00
|
|
|
const _SliverAppBarDelegate(this._tabBar);
|
|
|
|
|
2020-09-07 21:29:07 +02:00
|
|
|
@override
|
|
|
|
double get minExtent => _tabBar.preferredSize.height;
|
|
|
|
@override
|
|
|
|
double get maxExtent => _tabBar.preferredSize.height;
|
|
|
|
|
|
|
|
@override
|
|
|
|
Widget build(
|
|
|
|
BuildContext context, double shrinkOffset, bool overlapsContent) {
|
|
|
|
final theme = Theme.of(context);
|
2021-01-03 18:13:25 +01:00
|
|
|
return Container(color: theme.cardColor, child: _tabBar);
|
2020-09-07 21:29:07 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
@override
|
2020-09-08 23:10:40 +02:00
|
|
|
bool shouldRebuild(_SliverAppBarDelegate oldDelegate) => false;
|
2020-09-07 21:29:07 +02:00
|
|
|
}
|
|
|
|
|
2020-09-08 18:57:48 +02:00
|
|
|
class _AboutTab extends HookWidget {
|
2020-09-07 21:29:07 +02:00
|
|
|
final FullSiteView site;
|
2020-09-08 18:57:48 +02:00
|
|
|
final Future<List<CommunityView>> communitiesFuture;
|
2020-12-31 14:58:23 +01:00
|
|
|
final String instanceHost;
|
2020-09-07 21:29:07 +02:00
|
|
|
|
2020-09-12 09:30:22 +02:00
|
|
|
const _AboutTab(this.site,
|
2020-12-31 14:58:23 +01:00
|
|
|
{@required this.communitiesFuture, @required this.instanceHost})
|
2020-09-12 09:30:22 +02:00
|
|
|
: assert(communitiesFuture != null),
|
2020-12-31 14:58:23 +01:00
|
|
|
assert(instanceHost != null);
|
2020-09-07 21:29:07 +02:00
|
|
|
|
2020-09-08 19:52:09 +02:00
|
|
|
void goToModLog() {
|
|
|
|
print('GO TO MODLOG');
|
|
|
|
}
|
|
|
|
|
2020-09-08 20:24:36 +02:00
|
|
|
void goToBannedUsers(BuildContext c) {
|
2020-09-16 22:53:04 +02:00
|
|
|
goTo(
|
|
|
|
c,
|
|
|
|
(_) => UsersListPage(
|
2020-09-08 20:24:36 +02:00
|
|
|
users: site.banned.reversed.toList(), title: 'Banned users'),
|
2020-09-16 22:53:04 +02:00
|
|
|
);
|
2020-09-08 19:52:09 +02:00
|
|
|
}
|
|
|
|
|
2020-09-07 21:29:07 +02:00
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
2020-09-08 18:57:48 +02:00
|
|
|
final theme = Theme.of(context);
|
|
|
|
final commSnap = useFuture(communitiesFuture);
|
2020-09-29 00:57:25 +02:00
|
|
|
final accStore = useAccountsStore();
|
2020-09-08 18:57:48 +02:00
|
|
|
|
2020-09-08 23:01:40 +02:00
|
|
|
void goToCommunities() {
|
2020-09-16 22:53:04 +02:00
|
|
|
goTo(
|
|
|
|
context,
|
|
|
|
(_) => CommunitiesListPage(
|
2021-01-31 14:42:28 +01:00
|
|
|
fetcher: (page, batchSize, sortType) => LemmyApiV2(instanceHost).run(
|
|
|
|
ListCommunities(
|
|
|
|
type: PostListingType.local,
|
|
|
|
sort: sortType,
|
|
|
|
limit: batchSize,
|
|
|
|
page: page,
|
|
|
|
auth: accStore.defaultTokenFor(instanceHost)?.raw,
|
|
|
|
),
|
|
|
|
),
|
2021-01-24 20:01:55 +01:00
|
|
|
title: 'Communities of ${site.siteView.site.name}',
|
2020-09-29 00:57:25 +02:00
|
|
|
),
|
2020-09-16 22:53:04 +02:00
|
|
|
);
|
2020-09-08 23:01:40 +02:00
|
|
|
}
|
|
|
|
|
2020-09-07 21:29:07 +02:00
|
|
|
return SingleChildScrollView(
|
|
|
|
child: SafeArea(
|
|
|
|
top: false,
|
|
|
|
child: Column(
|
|
|
|
children: [
|
|
|
|
Padding(
|
|
|
|
padding: const EdgeInsets.symmetric(horizontal: 15, vertical: 15),
|
2020-09-12 09:30:22 +02:00
|
|
|
child: MarkdownText(
|
2021-01-24 20:01:55 +01:00
|
|
|
site.siteView.site.description,
|
2020-12-31 14:58:23 +01:00
|
|
|
instanceHost: instanceHost,
|
2020-09-12 09:30:22 +02:00
|
|
|
),
|
2020-09-07 21:29:07 +02:00
|
|
|
),
|
2021-01-03 19:43:39 +01:00
|
|
|
const _Divider(),
|
2020-09-07 21:29:07 +02:00
|
|
|
SizedBox(
|
|
|
|
height: 25,
|
|
|
|
child: ListView(
|
|
|
|
scrollDirection: Axis.horizontal,
|
|
|
|
children: [
|
2021-01-03 19:43:39 +01:00
|
|
|
const SizedBox(width: 7),
|
2021-01-31 15:07:36 +01:00
|
|
|
_Badge('${site.online} users online'),
|
2021-01-24 20:01:55 +01:00
|
|
|
_Badge('${site.siteView.counts.users} users'),
|
|
|
|
_Badge('${site.siteView.counts.communities} communities'),
|
|
|
|
_Badge('${site.siteView.counts.posts} posts'),
|
|
|
|
_Badge('${site.siteView.counts.comments} comments'),
|
2021-01-03 19:43:39 +01:00
|
|
|
const SizedBox(width: 15),
|
2020-09-07 21:29:07 +02:00
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
2021-01-03 19:43:39 +01:00
|
|
|
const _Divider(),
|
2020-09-08 21:20:29 +02:00
|
|
|
ListTile(
|
|
|
|
title: Center(
|
|
|
|
child: Text(
|
|
|
|
'Trending communities:',
|
|
|
|
style: theme.textTheme.headline6.copyWith(fontSize: 18),
|
|
|
|
),
|
|
|
|
),
|
2020-09-08 18:57:48 +02:00
|
|
|
),
|
|
|
|
if (commSnap.hasData)
|
2021-01-31 14:42:28 +01:00
|
|
|
for (final c in commSnap.data)
|
|
|
|
ListTile(
|
|
|
|
onTap: () => goToCommunity.byId(
|
|
|
|
context, c.instanceHost, c.community.id),
|
|
|
|
title: Text(c.community.name),
|
|
|
|
leading: c.community.icon != null
|
|
|
|
? CachedNetworkImage(
|
|
|
|
height: 50,
|
|
|
|
width: 50,
|
|
|
|
imageUrl: c.community.icon,
|
|
|
|
errorWidget: (_, __, ___) =>
|
|
|
|
const SizedBox(width: 50, height: 50),
|
|
|
|
imageBuilder: (context, imageProvider) => Container(
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
shape: BoxShape.circle,
|
|
|
|
image: DecorationImage(
|
|
|
|
fit: BoxFit.cover,
|
|
|
|
image: imageProvider,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
)
|
|
|
|
: const SizedBox(width: 50),
|
|
|
|
)
|
2020-09-08 18:57:48 +02:00
|
|
|
else if (commSnap.hasError)
|
|
|
|
Padding(
|
2021-01-03 18:03:59 +01:00
|
|
|
padding: const EdgeInsets.all(8),
|
2020-09-08 18:57:48 +02:00
|
|
|
child: Text("Can't load communities, ${commSnap.error}"),
|
|
|
|
)
|
|
|
|
else
|
2021-01-03 19:43:39 +01:00
|
|
|
const Padding(
|
|
|
|
padding: EdgeInsets.symmetric(vertical: 10),
|
2020-09-08 18:57:48 +02:00
|
|
|
child: CircularProgressIndicator(),
|
|
|
|
),
|
|
|
|
ListTile(
|
2021-01-03 19:43:39 +01:00
|
|
|
title: const Center(child: Text('See all')),
|
2020-09-08 19:52:09 +02:00
|
|
|
onTap: goToCommunities,
|
2020-09-08 18:57:48 +02:00
|
|
|
),
|
2021-01-03 19:43:39 +01:00
|
|
|
const _Divider(),
|
2020-09-08 19:14:05 +02:00
|
|
|
ListTile(
|
|
|
|
title: Center(
|
|
|
|
child: Text(
|
|
|
|
'Admins:',
|
|
|
|
style: theme.textTheme.headline6.copyWith(fontSize: 18),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
2021-01-31 14:38:47 +01:00
|
|
|
for (final u in site.admins)
|
|
|
|
ListTile(
|
|
|
|
title: Text(u.user.originDisplayName),
|
|
|
|
subtitle: u.user.bio != null
|
|
|
|
? MarkdownText(u.user.bio, instanceHost: instanceHost)
|
|
|
|
: null,
|
|
|
|
onTap: () => goToUser.byId(context, instanceHost, u.user.id),
|
|
|
|
leading: u.user.avatar != null
|
|
|
|
? CachedNetworkImage(
|
|
|
|
height: 50,
|
|
|
|
width: 50,
|
|
|
|
imageUrl: u.user.avatar,
|
|
|
|
errorWidget: (_, __, ___) =>
|
|
|
|
const SizedBox(width: 50, height: 50),
|
|
|
|
imageBuilder: (context, imageProvider) => Container(
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
shape: BoxShape.circle,
|
|
|
|
image: DecorationImage(
|
|
|
|
fit: BoxFit.cover, image: imageProvider),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
)
|
|
|
|
: const SizedBox(width: 50),
|
|
|
|
),
|
2021-01-03 19:43:39 +01:00
|
|
|
const _Divider(),
|
2020-09-08 19:44:04 +02:00
|
|
|
ListTile(
|
2021-01-03 19:43:39 +01:00
|
|
|
title: const Center(child: Text('Banned users')),
|
2020-09-08 20:24:36 +02:00
|
|
|
onTap: () => goToBannedUsers(context),
|
2020-09-08 19:44:04 +02:00
|
|
|
),
|
|
|
|
ListTile(
|
2021-01-03 19:43:39 +01:00
|
|
|
title: const Center(child: Text('Modlog')),
|
2020-09-08 19:52:09 +02:00
|
|
|
onTap: goToModLog,
|
2020-09-08 19:44:04 +02:00
|
|
|
),
|
2020-09-07 21:29:07 +02:00
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
class _Badge extends StatelessWidget {
|
|
|
|
final String text;
|
|
|
|
|
2021-01-03 18:21:56 +01:00
|
|
|
const _Badge(this.text);
|
2020-09-07 21:29:07 +02:00
|
|
|
|
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
final theme = Theme.of(context);
|
|
|
|
|
|
|
|
return Padding(
|
|
|
|
padding: const EdgeInsets.only(left: 8),
|
|
|
|
child: Badge(
|
|
|
|
child: Text(
|
|
|
|
text,
|
|
|
|
style:
|
|
|
|
TextStyle(color: textColorBasedOnBackground(theme.accentColor)),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
class _Divider extends StatelessWidget {
|
2021-01-03 19:43:39 +01:00
|
|
|
const _Divider();
|
|
|
|
|
2020-09-07 21:29:07 +02:00
|
|
|
@override
|
2021-01-03 19:43:39 +01:00
|
|
|
Widget build(BuildContext context) => const Padding(
|
|
|
|
padding: EdgeInsets.symmetric(horizontal: 15, vertical: 10),
|
2020-09-08 23:10:40 +02:00
|
|
|
child: Divider(),
|
|
|
|
);
|
2020-09-07 21:29:07 +02:00
|
|
|
}
|