Convert dialogs to FrostyDialog (#90)
This commit is contained in:
parent
eac021d892
commit
3158ada7db
6 changed files with 80 additions and 85 deletions
|
|
@ -4,6 +4,7 @@ import 'package:frosty/constants/constants.dart';
|
|||
import 'package:frosty/screens/channel/stores/chat_store.dart';
|
||||
import 'package:frosty/screens/settings/stores/settings_store.dart';
|
||||
import 'package:frosty/widgets/button.dart';
|
||||
import 'package:frosty/widgets/dialog.dart';
|
||||
import 'package:frosty/widgets/section_header.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
|
|
@ -23,15 +24,10 @@ class _RecentEmotesPanelState extends State<RecentEmotesPanel> {
|
|||
Future<void> _showClearDialog() {
|
||||
return showDialog(
|
||||
context: context,
|
||||
builder: (context) => AlertDialog(
|
||||
title: const Text('Clear Recent Emotes'),
|
||||
builder: (context) => FrostyDialog(
|
||||
title: 'Clear Recent Emotes',
|
||||
content: const Text('Are you sure you want to clear your recent emotes?'),
|
||||
actions: [
|
||||
Button(
|
||||
onPressed: Navigator.of(context).pop,
|
||||
color: Colors.red,
|
||||
child: const Text('Cancel'),
|
||||
),
|
||||
Button(
|
||||
onPressed: () {
|
||||
setState(widget.chatStore.assetsStore.recentEmotes.clear);
|
||||
|
|
@ -39,6 +35,12 @@ class _RecentEmotesPanelState extends State<RecentEmotesPanel> {
|
|||
},
|
||||
child: const Text('Yes'),
|
||||
),
|
||||
Button(
|
||||
fill: true,
|
||||
onPressed: Navigator.of(context).pop,
|
||||
color: Colors.red,
|
||||
child: const Text('Cancel'),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
|
|
@ -59,6 +61,7 @@ class _RecentEmotesPanelState extends State<RecentEmotesPanel> {
|
|||
SizedBox(
|
||||
height: 25,
|
||||
child: Button(
|
||||
padding: const EdgeInsets.all(0.0),
|
||||
onPressed: widget.chatStore.assetsStore.recentEmotes.isEmpty ? null : _showClearDialog,
|
||||
color: Theme.of(context).colorScheme.secondary,
|
||||
child: const Text(
|
||||
|
|
|
|||
|
|
@ -19,6 +19,7 @@ import 'package:frosty/screens/channel/stores/video_store.dart';
|
|||
import 'package:frosty/screens/settings/settings.dart';
|
||||
import 'package:frosty/screens/settings/stores/settings_store.dart';
|
||||
import 'package:frosty/widgets/button.dart';
|
||||
import 'package:frosty/widgets/dialog.dart';
|
||||
import 'package:frosty/widgets/profile_picture.dart';
|
||||
import 'package:intl/intl.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
|
|
@ -296,8 +297,8 @@ class _VideoOverlay extends StatelessWidget {
|
|||
Future<void> _showSleepTimerDialog(BuildContext context) {
|
||||
return showDialog(
|
||||
context: context,
|
||||
builder: (context) => AlertDialog(
|
||||
title: const Text('Sleep Timer'),
|
||||
builder: (context) => FrostyDialog(
|
||||
title: 'Sleep Timer',
|
||||
content: Observer(
|
||||
builder: (context) => Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
|
|
@ -343,11 +344,6 @@ class _VideoOverlay extends StatelessWidget {
|
|||
),
|
||||
),
|
||||
actions: [
|
||||
Button(
|
||||
onPressed: Navigator.of(context).pop,
|
||||
color: Colors.red,
|
||||
child: const Text('Dismiss'),
|
||||
),
|
||||
Observer(
|
||||
builder: (context) => Button(
|
||||
onPressed: videoStore.sleepHours == 0 && videoStore.sleepMinutes == 0
|
||||
|
|
@ -358,6 +354,11 @@ class _VideoOverlay extends StatelessWidget {
|
|||
child: const Text('Set Timer'),
|
||||
),
|
||||
),
|
||||
Button(
|
||||
onPressed: Navigator.of(context).pop,
|
||||
color: Colors.red,
|
||||
child: const Text('Cancel'),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
|
|
@ -591,7 +592,7 @@ class _VideoOverlay extends StatelessWidget {
|
|||
overflow: TextOverflow.ellipsis,
|
||||
style: const TextStyle(
|
||||
color: Colors.white,
|
||||
fontWeight: FontWeight.w600,
|
||||
fontWeight: FontWeight.w500,
|
||||
),
|
||||
),
|
||||
),
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@ import 'package:frosty/screens/home/widgets/streams_list.dart';
|
|||
import 'package:frosty/screens/settings/settings.dart';
|
||||
import 'package:frosty/screens/settings/stores/settings_store.dart';
|
||||
import 'package:frosty/widgets/button.dart';
|
||||
import 'package:frosty/widgets/dialog.dart';
|
||||
import 'package:package_info_plus/package_info_plus.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import 'package:shared_preferences/shared_preferences.dart';
|
||||
|
|
@ -36,14 +37,8 @@ class _HomeState extends State<Home> {
|
|||
return showDialog(
|
||||
barrierDismissible: false,
|
||||
context: context,
|
||||
builder: (context) => AlertDialog(
|
||||
scrollable: true,
|
||||
title: Text(
|
||||
'Frosty v${packageInfo.version} (${packageInfo.buildNumber})',
|
||||
style: const TextStyle(
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
),
|
||||
builder: (context) => FrostyDialog(
|
||||
title: 'Frosty v${packageInfo.version} (${packageInfo.buildNumber})',
|
||||
content: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ import 'package:frosty/core/auth/auth_store.dart';
|
|||
import 'package:frosty/screens/settings/stores/settings_store.dart';
|
||||
import 'package:frosty/widgets/block_button.dart';
|
||||
import 'package:frosty/widgets/button.dart';
|
||||
import 'package:frosty/widgets/dialog.dart';
|
||||
import 'package:webview_flutter/webview_flutter.dart';
|
||||
|
||||
class AccountSettings extends StatelessWidget {
|
||||
|
|
@ -132,45 +133,24 @@ class ProfileCard extends StatelessWidget {
|
|||
Future<void> _showLogoutDialog(BuildContext context) {
|
||||
return showDialog(
|
||||
context: context,
|
||||
builder: (context) => AlertDialog(
|
||||
title: const Text(
|
||||
'Log Out',
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.bold,
|
||||
builder: (context) => FrostyDialog(
|
||||
title: 'Log Out',
|
||||
content: const Text('Are you sure you want to log out?'),
|
||||
actions: [
|
||||
Button(
|
||||
onPressed: () {
|
||||
authStore.logout();
|
||||
Navigator.pop(context);
|
||||
},
|
||||
child: const Text('Yes'),
|
||||
),
|
||||
),
|
||||
content: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
const Text('Are you sure you want to log out?'),
|
||||
const SizedBox(height: 50.0),
|
||||
Column(
|
||||
children: [
|
||||
SizedBox(
|
||||
width: double.infinity,
|
||||
child: Button(
|
||||
fontSize: 16.0,
|
||||
onPressed: () {
|
||||
authStore.logout();
|
||||
Navigator.pop(context);
|
||||
},
|
||||
child: const Text('Yes'),
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 10.0),
|
||||
SizedBox(
|
||||
width: double.infinity,
|
||||
child: Button(
|
||||
fontSize: 16.0,
|
||||
onPressed: Navigator.of(context).pop,
|
||||
color: Colors.red.withOpacity(0.8),
|
||||
child: const Text('Cancel'),
|
||||
),
|
||||
),
|
||||
],
|
||||
)
|
||||
],
|
||||
),
|
||||
Button(
|
||||
fill: true,
|
||||
onPressed: Navigator.of(context).pop,
|
||||
color: Colors.red.withOpacity(0.8),
|
||||
child: const Text('Cancel'),
|
||||
)
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
|
@ -257,8 +237,16 @@ class BlockedUsers extends StatelessWidget {
|
|||
children: authStore.user.blockedUsers.map(
|
||||
(user) {
|
||||
final displayName = regexEnglish.hasMatch(user.displayName) ? user.displayName : '${user.displayName} (${user.userLogin})';
|
||||
|
||||
return ListTile(
|
||||
title: Text(displayName),
|
||||
title: Tooltip(
|
||||
preferBelow: false,
|
||||
message: displayName,
|
||||
child: Text(
|
||||
displayName,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
),
|
||||
trailing: BlockButton(
|
||||
authStore: authStore,
|
||||
targetUser: displayName,
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ import 'package:flutter_svg/flutter_svg.dart';
|
|||
import 'package:frosty/constants/constants.dart';
|
||||
import 'package:frosty/screens/settings/stores/settings_store.dart';
|
||||
import 'package:frosty/widgets/button.dart';
|
||||
import 'package:frosty/widgets/dialog.dart';
|
||||
import 'package:package_info_plus/package_info_plus.dart';
|
||||
import 'package:sentry_flutter/sentry_flutter.dart';
|
||||
import 'package:url_launcher/url_launcher.dart';
|
||||
|
|
@ -25,15 +26,10 @@ class _OtherSettingsState extends State<OtherSettings> {
|
|||
Future<void> _showConfirmDialog(BuildContext context) {
|
||||
return showDialog(
|
||||
context: context,
|
||||
builder: (context) => AlertDialog(
|
||||
title: const Text('Reset All Settings'),
|
||||
builder: (context) => FrostyDialog(
|
||||
title: 'Reset All Settings',
|
||||
content: const Text('Are you sure you want to reset all settings?'),
|
||||
actions: [
|
||||
Button(
|
||||
onPressed: Navigator.of(context).pop,
|
||||
color: Colors.red,
|
||||
child: const Text('Cancel'),
|
||||
),
|
||||
Button(
|
||||
onPressed: () {
|
||||
widget.settingsStore.resetAllSettings();
|
||||
|
|
@ -47,6 +43,12 @@ class _OtherSettingsState extends State<OtherSettings> {
|
|||
},
|
||||
child: const Text('Yes'),
|
||||
),
|
||||
Button(
|
||||
fill: true,
|
||||
onPressed: Navigator.of(context).pop,
|
||||
color: Colors.red,
|
||||
child: const Text('Cancel'),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
|
|
@ -55,6 +57,7 @@ class _OtherSettingsState extends State<OtherSettings> {
|
|||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return ExpansionTile(
|
||||
childrenPadding: const EdgeInsets.only(bottom: 10.0),
|
||||
leading: const Icon(Icons.help),
|
||||
title: const Text(
|
||||
'Other',
|
||||
|
|
@ -102,10 +105,8 @@ class _OtherSettingsState extends State<OtherSettings> {
|
|||
},
|
||||
),
|
||||
),
|
||||
Container(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 15.0),
|
||||
width: double.infinity,
|
||||
child: Button(
|
||||
...[
|
||||
Button(
|
||||
icon: const Icon(Icons.delete_sweep),
|
||||
child: const Text('Clear Image Cache'),
|
||||
onPressed: () async {
|
||||
|
|
@ -120,14 +121,19 @@ class _OtherSettingsState extends State<OtherSettings> {
|
|||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
Container(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 15.0),
|
||||
width: double.infinity,
|
||||
child: Button(
|
||||
Button(
|
||||
onPressed: () => _showConfirmDialog(context),
|
||||
icon: const Icon(Icons.restore),
|
||||
child: const Text('Reset All Settings'),
|
||||
)
|
||||
].map(
|
||||
(button) => Container(
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: 15.0,
|
||||
vertical: 5.0,
|
||||
),
|
||||
width: double.infinity,
|
||||
child: button,
|
||||
),
|
||||
),
|
||||
],
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ import 'package:flutter/material.dart';
|
|||
import 'package:flutter_mobx/flutter_mobx.dart';
|
||||
import 'package:frosty/core/auth/auth_store.dart';
|
||||
import 'package:frosty/widgets/button.dart';
|
||||
import 'package:frosty/widgets/dialog.dart';
|
||||
|
||||
class BlockButton extends StatelessWidget {
|
||||
final AuthStore authStore;
|
||||
|
|
@ -25,16 +26,11 @@ class BlockButton extends StatelessWidget {
|
|||
}) {
|
||||
return showDialog(
|
||||
context: context,
|
||||
builder: (context) => AlertDialog(
|
||||
title: isBlocked ? const Text('Unblock') : const Text('Block'),
|
||||
builder: (context) => FrostyDialog(
|
||||
title: isBlocked ? 'Unblock' : 'Block',
|
||||
content: Text(
|
||||
'Are you sure you want to ${isBlocked ? 'unblock $targetUser?' : 'block $targetUser? This will remove them from channel lists, search results, and chat messages.'}'),
|
||||
actions: [
|
||||
Button(
|
||||
onPressed: Navigator.of(context).pop,
|
||||
color: Colors.red,
|
||||
child: const Text('Cancel'),
|
||||
),
|
||||
Button(
|
||||
onPressed: () {
|
||||
if (isBlocked) {
|
||||
|
|
@ -50,6 +46,12 @@ class BlockButton extends StatelessWidget {
|
|||
},
|
||||
child: const Text('Yes'),
|
||||
),
|
||||
Button(
|
||||
fill: true,
|
||||
onPressed: Navigator.of(context).pop,
|
||||
color: Colors.red,
|
||||
child: const Text('Cancel'),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue