mirror of
https://gitlab.com/famedly/fluffychat.git
synced 2024-11-23 20:49:26 +01:00
design: Adjust design to new material 3 capabilities of Flutter 3.7
This commit is contained in:
parent
5c10e96a7b
commit
9bad93c2df
@ -55,9 +55,11 @@ abstract class FluffyThemes {
|
||||
snackBarTheme: const SnackBarThemeData(
|
||||
behavior: SnackBarBehavior.floating,
|
||||
),
|
||||
dividerColor: brightness == Brightness.light
|
||||
? Colors.blueGrey.shade50
|
||||
: Colors.blueGrey.shade900,
|
||||
popupMenuTheme: PopupMenuThemeData(
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(AppConfig.borderRadius),
|
||||
),
|
||||
),
|
||||
inputDecorationTheme: InputDecorationTheme(
|
||||
border: UnderlineInputBorder(
|
||||
borderSide: BorderSide.none,
|
||||
|
@ -11,7 +11,6 @@ import 'package:fluffychat/utils/platform_infos.dart';
|
||||
import 'package:fluffychat/widgets/avatar.dart';
|
||||
import 'package:fluffychat/widgets/matrix.dart';
|
||||
import '../../config/themes.dart';
|
||||
import '../../widgets/m2_popup_menu_button.dart';
|
||||
import 'chat.dart';
|
||||
import 'input_bar.dart';
|
||||
|
||||
@ -92,7 +91,7 @@ class ChatInputRow extends StatelessWidget {
|
||||
alignment: Alignment.center,
|
||||
clipBehavior: Clip.hardEdge,
|
||||
decoration: const BoxDecoration(),
|
||||
child: M2PopupMenuButton<String>(
|
||||
child: PopupMenuButton<String>(
|
||||
icon: const Icon(Icons.add_outlined),
|
||||
onSelected: controller.onAddPopupMenuButtonSelected,
|
||||
itemBuilder: (BuildContext context) =>
|
||||
@ -298,7 +297,7 @@ class _ChatAccountPicker extends StatelessWidget {
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: FutureBuilder<Profile>(
|
||||
future: controller.sendingClient!.fetchOwnProfile(),
|
||||
builder: (context, snapshot) => M2PopupMenuButton<String>(
|
||||
builder: (context, snapshot) => PopupMenuButton<String>(
|
||||
onSelected: _popupMenuButtonSelected,
|
||||
itemBuilder: (BuildContext context) => clients
|
||||
.map((client) => PopupMenuItem<String>(
|
||||
|
@ -22,7 +22,6 @@ import 'package:fluffychat/widgets/connection_status_header.dart';
|
||||
import 'package:fluffychat/widgets/matrix.dart';
|
||||
import 'package:fluffychat/widgets/unread_rooms_badge.dart';
|
||||
import '../../utils/stream_extension.dart';
|
||||
import '../../widgets/m2_popup_menu_button.dart';
|
||||
import 'chat_emoji_picker.dart';
|
||||
import 'chat_input_row.dart';
|
||||
|
||||
@ -67,7 +66,7 @@ class ChatView extends StatelessWidget {
|
||||
tooltip: L10n.of(context)!.pinMessage,
|
||||
),
|
||||
if (controller.selectedEvents.length == 1)
|
||||
M2PopupMenuButton<_EventContextAction>(
|
||||
PopupMenuButton<_EventContextAction>(
|
||||
onSelected: (action) {
|
||||
switch (action) {
|
||||
case _EventContextAction.info:
|
||||
|
@ -16,7 +16,6 @@ import 'package:fluffychat/widgets/content_banner.dart';
|
||||
import 'package:fluffychat/widgets/layouts/max_width_body.dart';
|
||||
import 'package:fluffychat/widgets/matrix.dart';
|
||||
import '../../utils/url_launcher.dart';
|
||||
import '../../widgets/m2_popup_menu_button.dart';
|
||||
|
||||
class ChatDetailsView extends StatelessWidget {
|
||||
final ChatDetailsController controller;
|
||||
@ -198,7 +197,7 @@ class ChatDetailsView extends StatelessWidget {
|
||||
Text(L10n.of(context)!.setCustomEmotes),
|
||||
onTap: controller.goToEmoteSettings,
|
||||
),
|
||||
M2PopupMenuButton(
|
||||
PopupMenuButton(
|
||||
onSelected: controller.setJoinRulesAction,
|
||||
itemBuilder: (BuildContext context) =>
|
||||
<PopupMenuEntry<JoinRules>>[
|
||||
@ -232,7 +231,7 @@ class ChatDetailsView extends StatelessWidget {
|
||||
),
|
||||
),
|
||||
),
|
||||
M2PopupMenuButton(
|
||||
PopupMenuButton(
|
||||
onSelected:
|
||||
controller.setHistoryVisibilityAction,
|
||||
itemBuilder: (BuildContext context) =>
|
||||
@ -285,7 +284,7 @@ class ChatDetailsView extends StatelessWidget {
|
||||
),
|
||||
),
|
||||
if (room.joinRules == JoinRules.public)
|
||||
M2PopupMenuButton(
|
||||
PopupMenuButton(
|
||||
onSelected: controller.setGuestAccessAction,
|
||||
itemBuilder: (BuildContext context) =>
|
||||
<PopupMenuEntry<GuestAccess>>[
|
||||
|
@ -9,7 +9,6 @@ import 'package:vrouter/vrouter.dart';
|
||||
import 'package:fluffychat/widgets/avatar.dart';
|
||||
import 'package:fluffychat/widgets/matrix.dart';
|
||||
import '../../utils/fluffy_share.dart';
|
||||
import '../../widgets/m2_popup_menu_button.dart';
|
||||
import 'chat_list.dart';
|
||||
|
||||
class ClientChooserButton extends StatelessWidget {
|
||||
@ -207,7 +206,7 @@ class ClientChooserButton extends StatelessWidget {
|
||||
onKeysPressed: () => _previousAccount(matrix, context),
|
||||
child: Container(),
|
||||
),
|
||||
M2PopupMenuButton<Object>(
|
||||
PopupMenuButton<Object>(
|
||||
onSelected: (o) => _clientSelected(o, context),
|
||||
itemBuilder: _bundleMenuItems,
|
||||
child: Material(
|
||||
|
@ -16,7 +16,6 @@ import 'package:fluffychat/utils/string_color.dart';
|
||||
import 'package:fluffychat/utils/url_launcher.dart';
|
||||
import 'package:fluffychat/widgets/avatar.dart';
|
||||
import '../../config/themes.dart';
|
||||
import '../../widgets/m2_popup_menu_button.dart';
|
||||
|
||||
class StoryView extends StatelessWidget {
|
||||
final StoryPageController controller;
|
||||
@ -104,7 +103,7 @@ class StoryView extends StatelessWidget {
|
||||
icon: Icon(Icons.adaptive.share_outlined),
|
||||
onPressed: controller.share,
|
||||
),
|
||||
M2PopupMenuButton<PopupStoryAction>(
|
||||
PopupMenuButton<PopupStoryAction>(
|
||||
color: Colors.white,
|
||||
onSelected: controller.onPopupStoryAction,
|
||||
icon: Icon(
|
||||
|
@ -48,12 +48,7 @@ class Avatar extends StatelessWidget {
|
||||
),
|
||||
);
|
||||
final borderRadius = BorderRadius.circular(size / 2);
|
||||
final container = Container(
|
||||
decoration: BoxDecoration(
|
||||
border: Border.all(color: Theme.of(context).dividerColor),
|
||||
borderRadius: borderRadius,
|
||||
),
|
||||
child: ClipRRect(
|
||||
final container = ClipRRect(
|
||||
borderRadius: borderRadius,
|
||||
child: Container(
|
||||
width: size,
|
||||
@ -73,7 +68,6 @@ class Avatar extends StatelessWidget {
|
||||
cacheKey: mxContent.toString(),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
if (onTap == null) return container;
|
||||
return InkWell(
|
||||
|
@ -15,7 +15,6 @@ import 'package:fluffychat/pages/chat/cupertino_widgets_bottom_sheet.dart';
|
||||
import 'package:fluffychat/pages/chat/edit_widgets_dialog.dart';
|
||||
import 'package:fluffychat/pages/chat/widgets_bottom_sheet.dart';
|
||||
import 'package:fluffychat/utils/adaptive_bottom_sheet.dart';
|
||||
import 'm2_popup_menu_button.dart';
|
||||
import 'matrix.dart';
|
||||
|
||||
class ChatSettingsPopupMenu extends StatefulWidget {
|
||||
@ -127,7 +126,7 @@ class ChatSettingsPopupMenuState extends State<ChatSettingsPopupMenu> {
|
||||
onKeysPressed: _showWidgets,
|
||||
child: Container(),
|
||||
),
|
||||
M2PopupMenuButton(
|
||||
PopupMenuButton(
|
||||
onSelected: (String choice) async {
|
||||
switch (choice) {
|
||||
case 'widgets':
|
||||
|
@ -2,8 +2,6 @@ import 'package:flutter/material.dart';
|
||||
|
||||
import 'package:matrix/matrix.dart';
|
||||
|
||||
import 'm2_popup_menu_button.dart';
|
||||
|
||||
class LogViewer extends StatefulWidget {
|
||||
const LogViewer({Key? key}) : super(key: key);
|
||||
|
||||
@ -34,7 +32,7 @@ class LogViewerState extends State<LogViewer> {
|
||||
icon: const Icon(Icons.zoom_out_outlined),
|
||||
onPressed: () => setState(() => fontSize--),
|
||||
),
|
||||
M2PopupMenuButton<Level>(
|
||||
PopupMenuButton<Level>(
|
||||
itemBuilder: (context) => Level.values
|
||||
.map((level) => PopupMenuItem(
|
||||
value: level,
|
||||
|
@ -1,51 +0,0 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import 'package:fluffychat/config/app_config.dart';
|
||||
|
||||
class M2PopupMenuButton<T> extends StatelessWidget {
|
||||
final List<PopupMenuEntry<T>> Function(BuildContext) itemBuilder;
|
||||
final T? initialValue;
|
||||
final void Function(T)? onSelected;
|
||||
final void Function()? onCanceled;
|
||||
final Widget? icon;
|
||||
final Color? color;
|
||||
final Widget? child;
|
||||
|
||||
const M2PopupMenuButton({
|
||||
Key? key,
|
||||
required this.itemBuilder,
|
||||
this.initialValue,
|
||||
this.onSelected,
|
||||
this.onCanceled,
|
||||
this.icon,
|
||||
this.color,
|
||||
this.child,
|
||||
}) : super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final theme = Theme.of(context);
|
||||
return Theme(
|
||||
data: theme.copyWith(
|
||||
useMaterial3: false,
|
||||
popupMenuTheme: PopupMenuThemeData(
|
||||
color: theme.colorScheme.surface,
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(AppConfig.borderRadius),
|
||||
),
|
||||
elevation: theme.appBarTheme.scrolledUnderElevation,
|
||||
textStyle: theme.textTheme.bodyLarge,
|
||||
),
|
||||
),
|
||||
child: PopupMenuButton<T>(
|
||||
itemBuilder: itemBuilder,
|
||||
initialValue: initialValue,
|
||||
onSelected: onSelected,
|
||||
onCanceled: onCanceled,
|
||||
icon: icon,
|
||||
color: color,
|
||||
child: child,
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user