mirror of
https://gitlab.com/veilid/veilidchat.git
synced 2025-08-11 23:50:19 -04:00
accessibility work
This commit is contained in:
parent
be8014c97a
commit
de691cd778
48 changed files with 862 additions and 551 deletions
64
lib/theme/views/styled_widgets/styled_dialog.dart
Normal file
64
lib/theme/views/styled_widgets/styled_dialog.dart
Normal file
|
@ -0,0 +1,64 @@
|
|||
import 'package:awesome_extensions/awesome_extensions.dart';
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import '../../theme.dart';
|
||||
|
||||
class StyledDialog extends StatelessWidget {
|
||||
const StyledDialog({required this.title, required this.child, super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final theme = Theme.of(context);
|
||||
final scale = theme.extension<ScaleScheme>()!;
|
||||
final scaleConfig = theme.extension<ScaleConfig>()!;
|
||||
final textTheme = theme.textTheme;
|
||||
|
||||
return AlertDialog(
|
||||
elevation: 0,
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.all(
|
||||
Radius.circular(16 * scaleConfig.borderRadiusScale)),
|
||||
),
|
||||
contentPadding: const EdgeInsets.all(4),
|
||||
backgroundColor: scale.primaryScale.border,
|
||||
title: Text(
|
||||
title,
|
||||
style: textTheme.titleMedium!
|
||||
.copyWith(color: scale.primaryScale.borderText),
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
titlePadding: const EdgeInsets.fromLTRB(4, 4, 4, 4),
|
||||
content: DecoratedBox(
|
||||
decoration: ShapeDecoration(
|
||||
color: scale.primaryScale.border,
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(
|
||||
16 * scaleConfig.borderRadiusScale))),
|
||||
child: DecoratedBox(
|
||||
decoration: ShapeDecoration(
|
||||
color: scale.primaryScale.appBackground,
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(
|
||||
12 * scaleConfig.borderRadiusScale))),
|
||||
child: child.paddingAll(0))));
|
||||
}
|
||||
|
||||
static Future<T?> show<T>(
|
||||
{required BuildContext context,
|
||||
required String title,
|
||||
required Widget child}) async =>
|
||||
showDialog<T>(
|
||||
context: context,
|
||||
useRootNavigator: false,
|
||||
builder: (context) => StyledDialog(title: title, child: child));
|
||||
|
||||
final String title;
|
||||
final Widget child;
|
||||
|
||||
@override
|
||||
void debugFillProperties(DiagnosticPropertiesBuilder properties) {
|
||||
super.debugFillProperties(properties);
|
||||
properties.add(StringProperty('title', title));
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue