mirror of
https://gitlab.com/famedly/fluffychat.git
synced 2024-12-18 02:42:34 +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(
|
snackBarTheme: const SnackBarThemeData(
|
||||||
behavior: SnackBarBehavior.floating,
|
behavior: SnackBarBehavior.floating,
|
||||||
),
|
),
|
||||||
dividerColor: brightness == Brightness.light
|
popupMenuTheme: PopupMenuThemeData(
|
||||||
? Colors.blueGrey.shade50
|
shape: RoundedRectangleBorder(
|
||||||
: Colors.blueGrey.shade900,
|
borderRadius: BorderRadius.circular(AppConfig.borderRadius),
|
||||||
|
),
|
||||||
|
),
|
||||||
inputDecorationTheme: InputDecorationTheme(
|
inputDecorationTheme: InputDecorationTheme(
|
||||||
border: UnderlineInputBorder(
|
border: UnderlineInputBorder(
|
||||||
borderSide: BorderSide.none,
|
borderSide: BorderSide.none,
|
||||||
|
@ -11,7 +11,6 @@ import 'package:fluffychat/utils/platform_infos.dart';
|
|||||||
import 'package:fluffychat/widgets/avatar.dart';
|
import 'package:fluffychat/widgets/avatar.dart';
|
||||||
import 'package:fluffychat/widgets/matrix.dart';
|
import 'package:fluffychat/widgets/matrix.dart';
|
||||||
import '../../config/themes.dart';
|
import '../../config/themes.dart';
|
||||||
import '../../widgets/m2_popup_menu_button.dart';
|
|
||||||
import 'chat.dart';
|
import 'chat.dart';
|
||||||
import 'input_bar.dart';
|
import 'input_bar.dart';
|
||||||
|
|
||||||
@ -92,7 +91,7 @@ class ChatInputRow extends StatelessWidget {
|
|||||||
alignment: Alignment.center,
|
alignment: Alignment.center,
|
||||||
clipBehavior: Clip.hardEdge,
|
clipBehavior: Clip.hardEdge,
|
||||||
decoration: const BoxDecoration(),
|
decoration: const BoxDecoration(),
|
||||||
child: M2PopupMenuButton<String>(
|
child: PopupMenuButton<String>(
|
||||||
icon: const Icon(Icons.add_outlined),
|
icon: const Icon(Icons.add_outlined),
|
||||||
onSelected: controller.onAddPopupMenuButtonSelected,
|
onSelected: controller.onAddPopupMenuButtonSelected,
|
||||||
itemBuilder: (BuildContext context) =>
|
itemBuilder: (BuildContext context) =>
|
||||||
@ -298,7 +297,7 @@ class _ChatAccountPicker extends StatelessWidget {
|
|||||||
padding: const EdgeInsets.all(8.0),
|
padding: const EdgeInsets.all(8.0),
|
||||||
child: FutureBuilder<Profile>(
|
child: FutureBuilder<Profile>(
|
||||||
future: controller.sendingClient!.fetchOwnProfile(),
|
future: controller.sendingClient!.fetchOwnProfile(),
|
||||||
builder: (context, snapshot) => M2PopupMenuButton<String>(
|
builder: (context, snapshot) => PopupMenuButton<String>(
|
||||||
onSelected: _popupMenuButtonSelected,
|
onSelected: _popupMenuButtonSelected,
|
||||||
itemBuilder: (BuildContext context) => clients
|
itemBuilder: (BuildContext context) => clients
|
||||||
.map((client) => PopupMenuItem<String>(
|
.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/matrix.dart';
|
||||||
import 'package:fluffychat/widgets/unread_rooms_badge.dart';
|
import 'package:fluffychat/widgets/unread_rooms_badge.dart';
|
||||||
import '../../utils/stream_extension.dart';
|
import '../../utils/stream_extension.dart';
|
||||||
import '../../widgets/m2_popup_menu_button.dart';
|
|
||||||
import 'chat_emoji_picker.dart';
|
import 'chat_emoji_picker.dart';
|
||||||
import 'chat_input_row.dart';
|
import 'chat_input_row.dart';
|
||||||
|
|
||||||
@ -67,7 +66,7 @@ class ChatView extends StatelessWidget {
|
|||||||
tooltip: L10n.of(context)!.pinMessage,
|
tooltip: L10n.of(context)!.pinMessage,
|
||||||
),
|
),
|
||||||
if (controller.selectedEvents.length == 1)
|
if (controller.selectedEvents.length == 1)
|
||||||
M2PopupMenuButton<_EventContextAction>(
|
PopupMenuButton<_EventContextAction>(
|
||||||
onSelected: (action) {
|
onSelected: (action) {
|
||||||
switch (action) {
|
switch (action) {
|
||||||
case _EventContextAction.info:
|
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/layouts/max_width_body.dart';
|
||||||
import 'package:fluffychat/widgets/matrix.dart';
|
import 'package:fluffychat/widgets/matrix.dart';
|
||||||
import '../../utils/url_launcher.dart';
|
import '../../utils/url_launcher.dart';
|
||||||
import '../../widgets/m2_popup_menu_button.dart';
|
|
||||||
|
|
||||||
class ChatDetailsView extends StatelessWidget {
|
class ChatDetailsView extends StatelessWidget {
|
||||||
final ChatDetailsController controller;
|
final ChatDetailsController controller;
|
||||||
@ -198,7 +197,7 @@ class ChatDetailsView extends StatelessWidget {
|
|||||||
Text(L10n.of(context)!.setCustomEmotes),
|
Text(L10n.of(context)!.setCustomEmotes),
|
||||||
onTap: controller.goToEmoteSettings,
|
onTap: controller.goToEmoteSettings,
|
||||||
),
|
),
|
||||||
M2PopupMenuButton(
|
PopupMenuButton(
|
||||||
onSelected: controller.setJoinRulesAction,
|
onSelected: controller.setJoinRulesAction,
|
||||||
itemBuilder: (BuildContext context) =>
|
itemBuilder: (BuildContext context) =>
|
||||||
<PopupMenuEntry<JoinRules>>[
|
<PopupMenuEntry<JoinRules>>[
|
||||||
@ -232,7 +231,7 @@ class ChatDetailsView extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
M2PopupMenuButton(
|
PopupMenuButton(
|
||||||
onSelected:
|
onSelected:
|
||||||
controller.setHistoryVisibilityAction,
|
controller.setHistoryVisibilityAction,
|
||||||
itemBuilder: (BuildContext context) =>
|
itemBuilder: (BuildContext context) =>
|
||||||
@ -285,7 +284,7 @@ class ChatDetailsView extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
if (room.joinRules == JoinRules.public)
|
if (room.joinRules == JoinRules.public)
|
||||||
M2PopupMenuButton(
|
PopupMenuButton(
|
||||||
onSelected: controller.setGuestAccessAction,
|
onSelected: controller.setGuestAccessAction,
|
||||||
itemBuilder: (BuildContext context) =>
|
itemBuilder: (BuildContext context) =>
|
||||||
<PopupMenuEntry<GuestAccess>>[
|
<PopupMenuEntry<GuestAccess>>[
|
||||||
|
@ -9,7 +9,6 @@ import 'package:vrouter/vrouter.dart';
|
|||||||
import 'package:fluffychat/widgets/avatar.dart';
|
import 'package:fluffychat/widgets/avatar.dart';
|
||||||
import 'package:fluffychat/widgets/matrix.dart';
|
import 'package:fluffychat/widgets/matrix.dart';
|
||||||
import '../../utils/fluffy_share.dart';
|
import '../../utils/fluffy_share.dart';
|
||||||
import '../../widgets/m2_popup_menu_button.dart';
|
|
||||||
import 'chat_list.dart';
|
import 'chat_list.dart';
|
||||||
|
|
||||||
class ClientChooserButton extends StatelessWidget {
|
class ClientChooserButton extends StatelessWidget {
|
||||||
@ -207,7 +206,7 @@ class ClientChooserButton extends StatelessWidget {
|
|||||||
onKeysPressed: () => _previousAccount(matrix, context),
|
onKeysPressed: () => _previousAccount(matrix, context),
|
||||||
child: Container(),
|
child: Container(),
|
||||||
),
|
),
|
||||||
M2PopupMenuButton<Object>(
|
PopupMenuButton<Object>(
|
||||||
onSelected: (o) => _clientSelected(o, context),
|
onSelected: (o) => _clientSelected(o, context),
|
||||||
itemBuilder: _bundleMenuItems,
|
itemBuilder: _bundleMenuItems,
|
||||||
child: Material(
|
child: Material(
|
||||||
|
@ -16,7 +16,6 @@ import 'package:fluffychat/utils/string_color.dart';
|
|||||||
import 'package:fluffychat/utils/url_launcher.dart';
|
import 'package:fluffychat/utils/url_launcher.dart';
|
||||||
import 'package:fluffychat/widgets/avatar.dart';
|
import 'package:fluffychat/widgets/avatar.dart';
|
||||||
import '../../config/themes.dart';
|
import '../../config/themes.dart';
|
||||||
import '../../widgets/m2_popup_menu_button.dart';
|
|
||||||
|
|
||||||
class StoryView extends StatelessWidget {
|
class StoryView extends StatelessWidget {
|
||||||
final StoryPageController controller;
|
final StoryPageController controller;
|
||||||
@ -104,7 +103,7 @@ class StoryView extends StatelessWidget {
|
|||||||
icon: Icon(Icons.adaptive.share_outlined),
|
icon: Icon(Icons.adaptive.share_outlined),
|
||||||
onPressed: controller.share,
|
onPressed: controller.share,
|
||||||
),
|
),
|
||||||
M2PopupMenuButton<PopupStoryAction>(
|
PopupMenuButton<PopupStoryAction>(
|
||||||
color: Colors.white,
|
color: Colors.white,
|
||||||
onSelected: controller.onPopupStoryAction,
|
onSelected: controller.onPopupStoryAction,
|
||||||
icon: Icon(
|
icon: Icon(
|
||||||
|
@ -48,12 +48,7 @@ class Avatar extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
);
|
);
|
||||||
final borderRadius = BorderRadius.circular(size / 2);
|
final borderRadius = BorderRadius.circular(size / 2);
|
||||||
final container = Container(
|
final container = ClipRRect(
|
||||||
decoration: BoxDecoration(
|
|
||||||
border: Border.all(color: Theme.of(context).dividerColor),
|
|
||||||
borderRadius: borderRadius,
|
|
||||||
),
|
|
||||||
child: ClipRRect(
|
|
||||||
borderRadius: borderRadius,
|
borderRadius: borderRadius,
|
||||||
child: Container(
|
child: Container(
|
||||||
width: size,
|
width: size,
|
||||||
@ -73,7 +68,6 @@ class Avatar extends StatelessWidget {
|
|||||||
cacheKey: mxContent.toString(),
|
cacheKey: mxContent.toString(),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
|
||||||
);
|
);
|
||||||
if (onTap == null) return container;
|
if (onTap == null) return container;
|
||||||
return InkWell(
|
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/edit_widgets_dialog.dart';
|
||||||
import 'package:fluffychat/pages/chat/widgets_bottom_sheet.dart';
|
import 'package:fluffychat/pages/chat/widgets_bottom_sheet.dart';
|
||||||
import 'package:fluffychat/utils/adaptive_bottom_sheet.dart';
|
import 'package:fluffychat/utils/adaptive_bottom_sheet.dart';
|
||||||
import 'm2_popup_menu_button.dart';
|
|
||||||
import 'matrix.dart';
|
import 'matrix.dart';
|
||||||
|
|
||||||
class ChatSettingsPopupMenu extends StatefulWidget {
|
class ChatSettingsPopupMenu extends StatefulWidget {
|
||||||
@ -127,7 +126,7 @@ class ChatSettingsPopupMenuState extends State<ChatSettingsPopupMenu> {
|
|||||||
onKeysPressed: _showWidgets,
|
onKeysPressed: _showWidgets,
|
||||||
child: Container(),
|
child: Container(),
|
||||||
),
|
),
|
||||||
M2PopupMenuButton(
|
PopupMenuButton(
|
||||||
onSelected: (String choice) async {
|
onSelected: (String choice) async {
|
||||||
switch (choice) {
|
switch (choice) {
|
||||||
case 'widgets':
|
case 'widgets':
|
||||||
|
@ -2,8 +2,6 @@ import 'package:flutter/material.dart';
|
|||||||
|
|
||||||
import 'package:matrix/matrix.dart';
|
import 'package:matrix/matrix.dart';
|
||||||
|
|
||||||
import 'm2_popup_menu_button.dart';
|
|
||||||
|
|
||||||
class LogViewer extends StatefulWidget {
|
class LogViewer extends StatefulWidget {
|
||||||
const LogViewer({Key? key}) : super(key: key);
|
const LogViewer({Key? key}) : super(key: key);
|
||||||
|
|
||||||
@ -34,7 +32,7 @@ class LogViewerState extends State<LogViewer> {
|
|||||||
icon: const Icon(Icons.zoom_out_outlined),
|
icon: const Icon(Icons.zoom_out_outlined),
|
||||||
onPressed: () => setState(() => fontSize--),
|
onPressed: () => setState(() => fontSize--),
|
||||||
),
|
),
|
||||||
M2PopupMenuButton<Level>(
|
PopupMenuButton<Level>(
|
||||||
itemBuilder: (context) => Level.values
|
itemBuilder: (context) => Level.values
|
||||||
.map((level) => PopupMenuItem(
|
.map((level) => PopupMenuItem(
|
||||||
value: level,
|
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