chore: Follow up dialog themes
Signed-off-by: Krille <c.kussowski@famedly.com>
This commit is contained in:
parent
7e8f223eff
commit
8db9a05071
2 changed files with 119 additions and 105 deletions
|
|
@ -1,16 +1,15 @@
|
||||||
import 'package:flutter/material.dart';
|
|
||||||
import 'package:flutter/services.dart';
|
|
||||||
|
|
||||||
import 'package:flutter_gen/gen_l10n/l10n.dart';
|
|
||||||
import 'package:flutter_linkify/flutter_linkify.dart';
|
|
||||||
import 'package:go_router/go_router.dart';
|
|
||||||
import 'package:matrix/matrix.dart';
|
|
||||||
|
|
||||||
import 'package:fluffychat/config/themes.dart';
|
import 'package:fluffychat/config/themes.dart';
|
||||||
import 'package:fluffychat/utils/date_time_extension.dart';
|
import 'package:fluffychat/utils/date_time_extension.dart';
|
||||||
import 'package:fluffychat/widgets/adaptive_dialogs/adaptive_dialog_action.dart';
|
import 'package:fluffychat/widgets/adaptive_dialogs/adaptive_dialog_action.dart';
|
||||||
import 'package:fluffychat/widgets/avatar.dart';
|
import 'package:fluffychat/widgets/avatar.dart';
|
||||||
import 'package:fluffychat/widgets/presence_builder.dart';
|
import 'package:fluffychat/widgets/presence_builder.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter/services.dart';
|
||||||
|
import 'package:flutter_gen/gen_l10n/l10n.dart';
|
||||||
|
import 'package:flutter_linkify/flutter_linkify.dart';
|
||||||
|
import 'package:go_router/go_router.dart';
|
||||||
|
import 'package:matrix/matrix.dart';
|
||||||
|
|
||||||
import '../../utils/url_launcher.dart';
|
import '../../utils/url_launcher.dart';
|
||||||
import '../future_loading_dialog.dart';
|
import '../future_loading_dialog.dart';
|
||||||
import '../hover_builder.dart';
|
import '../hover_builder.dart';
|
||||||
|
|
@ -45,93 +44,105 @@ class UserDialog extends StatelessWidget {
|
||||||
var copied = false;
|
var copied = false;
|
||||||
final theme = Theme.of(context);
|
final theme = Theme.of(context);
|
||||||
return AlertDialog.adaptive(
|
return AlertDialog.adaptive(
|
||||||
title: Center(child: Text(displayname, textAlign: TextAlign.center)),
|
title: ConstrainedBox(
|
||||||
content: SelectionArea(
|
constraints: const BoxConstraints(maxWidth: 256),
|
||||||
child: PresenceBuilder(
|
child: Center(child: Text(displayname, textAlign: TextAlign.center)),
|
||||||
userId: profile.userId,
|
),
|
||||||
client: Matrix.of(context).client,
|
content: ConstrainedBox(
|
||||||
builder: (context, presence) {
|
constraints: const BoxConstraints(maxWidth: 256),
|
||||||
if (presence == null) return const SizedBox.shrink();
|
child: SelectionArea(
|
||||||
final statusMsg = presence.statusMsg;
|
child: Center(
|
||||||
final lastActiveTimestamp = presence.lastActiveTimestamp;
|
child: PresenceBuilder(
|
||||||
final presenceText = presence.currentlyActive == true
|
userId: profile.userId,
|
||||||
? L10n.of(context).currentlyActive
|
client: Matrix.of(context).client,
|
||||||
: lastActiveTimestamp != null
|
builder: (context, presence) {
|
||||||
? L10n.of(context).lastActiveAgo(
|
if (presence == null) return const SizedBox.shrink();
|
||||||
lastActiveTimestamp.localizedTimeShort(context),
|
final statusMsg = presence.statusMsg;
|
||||||
)
|
final lastActiveTimestamp = presence.lastActiveTimestamp;
|
||||||
: null;
|
final presenceText = presence.currentlyActive == true
|
||||||
return Column(
|
? L10n.of(context).currentlyActive
|
||||||
spacing: 8,
|
: lastActiveTimestamp != null
|
||||||
mainAxisSize: MainAxisSize.min,
|
? L10n.of(context).lastActiveAgo(
|
||||||
crossAxisAlignment: CrossAxisAlignment.center,
|
lastActiveTimestamp.localizedTimeShort(context),
|
||||||
children: [
|
)
|
||||||
HoverBuilder(
|
: null;
|
||||||
builder: (context, hovered) => StatefulBuilder(
|
return Column(
|
||||||
builder: (context, setState) => GestureDetector(
|
spacing: 8,
|
||||||
onTap: () {
|
mainAxisSize: MainAxisSize.min,
|
||||||
Clipboard.setData(ClipboardData(text: profile.userId));
|
crossAxisAlignment: CrossAxisAlignment.center,
|
||||||
setState(() {
|
children: [
|
||||||
copied = true;
|
HoverBuilder(
|
||||||
});
|
builder: (context, hovered) => StatefulBuilder(
|
||||||
},
|
builder: (context, setState) => GestureDetector(
|
||||||
child: RichText(
|
onTap: () {
|
||||||
text: TextSpan(
|
Clipboard.setData(
|
||||||
children: [
|
ClipboardData(text: profile.userId));
|
||||||
WidgetSpan(
|
setState(() {
|
||||||
child: Padding(
|
copied = true;
|
||||||
padding: const EdgeInsets.only(right: 4.0),
|
});
|
||||||
child: AnimatedScale(
|
},
|
||||||
duration: FluffyThemes.animationDuration,
|
child: RichText(
|
||||||
curve: FluffyThemes.animationCurve,
|
text: TextSpan(
|
||||||
scale: hovered
|
children: [
|
||||||
? 1.33
|
WidgetSpan(
|
||||||
: copied
|
child: Padding(
|
||||||
? 1.25
|
padding: const EdgeInsets.only(right: 4.0),
|
||||||
: 1.0,
|
child: AnimatedScale(
|
||||||
child: Icon(
|
duration: FluffyThemes.animationDuration,
|
||||||
copied ? Icons.check_circle : Icons.copy,
|
curve: FluffyThemes.animationCurve,
|
||||||
size: 12,
|
scale: hovered
|
||||||
color: copied ? Colors.green : null,
|
? 1.33
|
||||||
|
: copied
|
||||||
|
? 1.25
|
||||||
|
: 1.0,
|
||||||
|
child: Icon(
|
||||||
|
copied
|
||||||
|
? Icons.check_circle
|
||||||
|
: Icons.copy,
|
||||||
|
size: 12,
|
||||||
|
color: copied ? Colors.green : null,
|
||||||
|
),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
TextSpan(text: profile.userId),
|
||||||
|
],
|
||||||
|
style: theme.textTheme.bodyMedium
|
||||||
|
?.copyWith(fontSize: 10),
|
||||||
),
|
),
|
||||||
TextSpan(text: profile.userId),
|
textAlign: TextAlign.center,
|
||||||
],
|
),
|
||||||
style: theme.textTheme.bodyMedium
|
|
||||||
?.copyWith(fontSize: 10),
|
|
||||||
),
|
),
|
||||||
textAlign: TextAlign.center,
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
Avatar(
|
||||||
),
|
mxContent: profile.avatarUrl,
|
||||||
Avatar(
|
name: displayname,
|
||||||
mxContent: profile.avatarUrl,
|
size: Avatar.defaultSize * 2,
|
||||||
name: displayname,
|
|
||||||
size: Avatar.defaultSize * 2,
|
|
||||||
),
|
|
||||||
if (presenceText != null)
|
|
||||||
Text(
|
|
||||||
presenceText,
|
|
||||||
style: const TextStyle(fontSize: 10),
|
|
||||||
),
|
|
||||||
if (statusMsg != null)
|
|
||||||
Linkify(
|
|
||||||
text: statusMsg,
|
|
||||||
textAlign: TextAlign.center,
|
|
||||||
options: const LinkifyOptions(humanize: false),
|
|
||||||
linkStyle: TextStyle(
|
|
||||||
color: theme.colorScheme.primary,
|
|
||||||
decoration: TextDecoration.underline,
|
|
||||||
decorationColor: theme.colorScheme.primary,
|
|
||||||
),
|
),
|
||||||
onOpen: (url) => UrlLauncher(context, url.url).launchUrl(),
|
if (presenceText != null)
|
||||||
),
|
Text(
|
||||||
],
|
presenceText,
|
||||||
);
|
style: const TextStyle(fontSize: 10),
|
||||||
},
|
),
|
||||||
|
if (statusMsg != null)
|
||||||
|
Linkify(
|
||||||
|
text: statusMsg,
|
||||||
|
textAlign: TextAlign.center,
|
||||||
|
options: const LinkifyOptions(humanize: false),
|
||||||
|
linkStyle: TextStyle(
|
||||||
|
color: theme.colorScheme.primary,
|
||||||
|
decoration: TextDecoration.underline,
|
||||||
|
decorationColor: theme.colorScheme.primary,
|
||||||
|
),
|
||||||
|
onOpen: (url) =>
|
||||||
|
UrlLauncher(context, url.url).launchUrl(),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
actions: [
|
actions: [
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,7 @@
|
||||||
import 'package:flutter/material.dart';
|
|
||||||
|
|
||||||
import 'package:flutter_gen/gen_l10n/l10n.dart';
|
|
||||||
|
|
||||||
import 'package:fluffychat/widgets/adaptive_dialogs/adaptive_dialog_action.dart';
|
import 'package:fluffychat/widgets/adaptive_dialogs/adaptive_dialog_action.dart';
|
||||||
import 'package:fluffychat/widgets/adaptive_dialogs/dialog_text_field.dart';
|
import 'package:fluffychat/widgets/adaptive_dialogs/dialog_text_field.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter_gen/gen_l10n/l10n.dart';
|
||||||
|
|
||||||
Future<int?> showPermissionChooser(
|
Future<int?> showPermissionChooser(
|
||||||
BuildContext context, {
|
BuildContext context, {
|
||||||
|
|
@ -16,22 +14,27 @@ Future<int?> showPermissionChooser(
|
||||||
context: context,
|
context: context,
|
||||||
builder: (context) => AlertDialog.adaptive(
|
builder: (context) => AlertDialog.adaptive(
|
||||||
title: Text(L10n.of(context).chatPermissions),
|
title: Text(L10n.of(context).chatPermissions),
|
||||||
content: Column(
|
content: ConstrainedBox(
|
||||||
mainAxisSize: MainAxisSize.min,
|
constraints: const BoxConstraints(maxWidth: 256),
|
||||||
spacing: 12.0,
|
child: Center(
|
||||||
children: [
|
child: Column(
|
||||||
Text(L10n.of(context).setPermissionsLevelDescription),
|
mainAxisSize: MainAxisSize.min,
|
||||||
ValueListenableBuilder(
|
spacing: 12.0,
|
||||||
valueListenable: error,
|
children: [
|
||||||
builder: (context, errorText, _) => DialogTextField(
|
Text(L10n.of(context).setPermissionsLevelDescription),
|
||||||
controller: controller,
|
ValueListenableBuilder(
|
||||||
hintText: currentLevel.toString(),
|
valueListenable: error,
|
||||||
keyboardType: TextInputType.number,
|
builder: (context, errorText, _) => DialogTextField(
|
||||||
labelText: L10n.of(context).custom,
|
controller: controller,
|
||||||
errorText: errorText,
|
hintText: currentLevel.toString(),
|
||||||
),
|
keyboardType: TextInputType.number,
|
||||||
|
labelText: L10n.of(context).custom,
|
||||||
|
errorText: errorText,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
),
|
),
|
||||||
],
|
),
|
||||||
),
|
),
|
||||||
actions: [
|
actions: [
|
||||||
AdaptiveDialogAction(
|
AdaptiveDialogAction(
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue