mirror of
https://gitlab.com/veilid/veilidchat.git
synced 2025-05-02 22:34:56 -04:00
debugging and cleanup
This commit is contained in:
parent
604ec9cfdd
commit
d460a0388c
69 changed files with 2306 additions and 790 deletions
|
@ -1,6 +1,7 @@
|
|||
import 'package:awesome_extensions/awesome_extensions.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:motion_toast/motion_toast.dart';
|
||||
import 'package:toastification/toastification.dart';
|
||||
|
||||
import '../../theme/theme.dart';
|
||||
import '../notifications.dart';
|
||||
|
@ -43,46 +44,47 @@ class NotificationsWidget extends StatelessWidget {
|
|||
////////////////////////////////////////////////////////////////////////////
|
||||
// Private Implementation
|
||||
|
||||
void _toast(
|
||||
{required BuildContext context,
|
||||
required String text,
|
||||
required ScaleToastTheme toastTheme,
|
||||
String? title}) {
|
||||
toastification.show(
|
||||
context: context,
|
||||
title: title != null
|
||||
? Text(title)
|
||||
.copyWith(style: toastTheme.titleTextStyle)
|
||||
.paddingLTRB(0, 0, 0, 8)
|
||||
: null,
|
||||
description: Text(text).copyWith(style: toastTheme.descriptionTextStyle),
|
||||
icon: toastTheme.icon,
|
||||
primaryColor: toastTheme.primaryColor,
|
||||
backgroundColor: toastTheme.backgroundColor,
|
||||
foregroundColor: toastTheme.foregroundColor,
|
||||
padding: toastTheme.padding,
|
||||
borderRadius: toastTheme.borderRadius,
|
||||
borderSide: toastTheme.borderSide,
|
||||
autoCloseDuration: const Duration(seconds: 2),
|
||||
animationDuration: const Duration(milliseconds: 500),
|
||||
);
|
||||
}
|
||||
|
||||
void _info(
|
||||
{required BuildContext context, required String text, String? title}) {
|
||||
final theme = Theme.of(context);
|
||||
final scale = theme.extension<ScaleScheme>()!;
|
||||
final scaleConfig = theme.extension<ScaleConfig>()!;
|
||||
final toastTheme =
|
||||
theme.extension<ScaleTheme>()!.toastTheme(ScaleToastKind.info);
|
||||
|
||||
MotionToast(
|
||||
title: title != null ? Text(title) : null,
|
||||
description: Text(text),
|
||||
constraints: BoxConstraints.loose(const Size(400, 100)),
|
||||
contentPadding: const EdgeInsets.all(16),
|
||||
primaryColor: scale.tertiaryScale.elementBackground,
|
||||
secondaryColor: scale.tertiaryScale.calloutBackground,
|
||||
borderRadius: 12 * scaleConfig.borderRadiusScale,
|
||||
toastDuration: const Duration(seconds: 2),
|
||||
animationDuration: const Duration(milliseconds: 500),
|
||||
displayBorder: scaleConfig.useVisualIndicators,
|
||||
icon: Icons.info,
|
||||
).show(context);
|
||||
_toast(context: context, text: text, toastTheme: toastTheme, title: title);
|
||||
}
|
||||
|
||||
void _error(
|
||||
{required BuildContext context, required String text, String? title}) {
|
||||
final theme = Theme.of(context);
|
||||
final scale = theme.extension<ScaleScheme>()!;
|
||||
final scaleConfig = theme.extension<ScaleConfig>()!;
|
||||
final toastTheme =
|
||||
theme.extension<ScaleTheme>()!.toastTheme(ScaleToastKind.error);
|
||||
|
||||
MotionToast(
|
||||
title: title != null ? Text(title) : null,
|
||||
description: Text(text),
|
||||
constraints: BoxConstraints.loose(const Size(400, 100)),
|
||||
contentPadding: const EdgeInsets.all(16),
|
||||
primaryColor: scale.errorScale.elementBackground,
|
||||
secondaryColor: scale.errorScale.calloutBackground,
|
||||
borderRadius: 12 * scaleConfig.borderRadiusScale,
|
||||
toastDuration: const Duration(seconds: 4),
|
||||
animationDuration: const Duration(milliseconds: 1000),
|
||||
displayBorder: scaleConfig.useVisualIndicators,
|
||||
icon: Icons.error,
|
||||
).show(context);
|
||||
_toast(context: context, text: text, toastTheme: toastTheme, title: title);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue