frosty/lib/widgets/chat_stats.dart
tommyxchow 012accd918 Add chat stats widget
This widget will be responsible for information relating to the current chat room, such as the room state and members.
2021-10-23 00:26:50 -04:00

54 lines
1.9 KiB
Dart

import 'package:flutter/material.dart';
import 'package:flutter/widgets.dart';
import 'package:flutter_mobx/flutter_mobx.dart';
import 'package:frosty/stores/chat_store.dart';
class ChatStats extends StatelessWidget {
final ChatStore chatStore;
const ChatStats({Key? key, required this.chatStore}) : super(key: key);
@override
Widget build(BuildContext context) {
return SizedBox(
height: MediaQuery.of(context).size.height * 0.5,
child: Center(
child: Observer(
builder: (_) {
return ListView(
children: [
const ListTile(
title: Text('Modes'),
),
ListTile(
leading: const Text('Emote-only'),
trailing: Text(chatStore.roomState.emoteOnly == '0' ? 'Disabled' : 'Enabled'),
),
ListTile(
leading: const Text('Followers-only'),
trailing: Text(chatStore.roomState.followersOnly == '-1'
? 'Disabled'
: chatStore.roomState.followersOnly == '0'
? 'Enabled'
: '${chatStore.roomState.followersOnly} minute(s)'),
),
ListTile(
leading: const Text('R9K'),
trailing: Text(chatStore.roomState.r9k == '0' ? 'Disabled' : 'Enabled'),
),
ListTile(
leading: const Text('Slow'),
trailing: Text(chatStore.roomState.slowMode == '0' ? 'Disabled' : '${chatStore.roomState.slowMode} seconds'),
),
ListTile(
leading: const Text('Sub-only'),
trailing: Text(chatStore.roomState.subMode == '0' ? 'Disabled' : 'Enabled'),
),
],
);
},
),
),
);
}
}