-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: refactor to be a bit more picky in directory structure + flutt…
…er 3.27.2
- Loading branch information
1 parent
e2e4a9c
commit 73fdd51
Showing
96 changed files
with
1,069 additions
and
802 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,101 @@ | ||
import 'package:flutter/material.dart'; | ||
import 'package:watch_it/watch_it.dart'; | ||
import 'package:yaru/yaru.dart'; | ||
|
||
import '../../../common/view/build_context_x.dart'; | ||
import '../../../common/view/common_widgets.dart'; | ||
import '../../../common/view/theme.dart'; | ||
import '../../../common/view/ui_constants.dart'; | ||
import '../../../l10n/l10n.dart'; | ||
import '../../common/chat_model.dart'; | ||
import '../../common/rooms_filter.dart'; | ||
import '../../common/search_model.dart'; | ||
import '../../common/view/search_auto_complete.dart'; | ||
import '../../settings/settings_dialog.dart'; | ||
import 'chat_master_list_filter_bar.dart'; | ||
import 'chat_master_title_bar.dart'; | ||
import 'chat_rooms_list.dart'; | ||
import 'chat_space_control_panel.dart'; | ||
import 'chat_space_filter.dart'; | ||
|
||
class ChatMasterSidePanel extends StatelessWidget with WatchItMixin { | ||
const ChatMasterSidePanel({super.key}); | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
final l10n = context.l10n; | ||
final searchModel = di<SearchModel>(); | ||
final searchActive = watchPropertyValue((SearchModel m) => m.searchActive); | ||
final searchType = watchPropertyValue((SearchModel m) => m.searchType); | ||
final archiveActive = watchPropertyValue((ChatModel m) => m.archiveActive); | ||
final loadingArchive = | ||
watchPropertyValue((ChatModel m) => m.loadingArchive); | ||
final roomsFilter = watchPropertyValue((ChatModel m) => m.roomsFilter); | ||
|
||
final suffix = IconButton( | ||
padding: EdgeInsets.zero, | ||
style: textFieldSuffixStyle, | ||
onPressed: () => searchModel.setSearchType( | ||
switch (searchType) { | ||
SearchType.profiles => SearchType.rooms, | ||
SearchType.rooms => SearchType.spaces, | ||
SearchType.spaces => SearchType.profiles, | ||
}, | ||
), | ||
icon: switch (searchType) { | ||
SearchType.profiles => const Icon(YaruIcons.user), | ||
SearchType.rooms => const Icon(YaruIcons.users), | ||
SearchType.spaces => const Icon(YaruIcons.globe) | ||
}, | ||
); | ||
|
||
return Material( | ||
color: getPanelBg(context.theme), | ||
child: Column( | ||
children: [ | ||
const ChatMasterTitleBar(), | ||
if (searchActive && !archiveActive) | ||
Padding( | ||
padding: const EdgeInsets.only( | ||
left: kMediumPlusPadding, | ||
right: kMediumPlusPadding, | ||
bottom: kMediumPadding, | ||
), | ||
child: switch (searchType) { | ||
SearchType.profiles => ChatUserSearchAutoComplete( | ||
suffix: suffix, | ||
), | ||
_ => RoomsAutoComplete( | ||
suffix: suffix, | ||
) | ||
}, | ||
), | ||
const ChatMasterListFilterBar(), | ||
if (roomsFilter == RoomsFilter.spaces && !archiveActive) | ||
const ChatSpaceFilter(), | ||
if (roomsFilter == RoomsFilter.spaces && !archiveActive) | ||
const ChatSpaceControlPanel(), | ||
if (loadingArchive) | ||
const Expanded( | ||
child: Center(child: Progress()), | ||
) | ||
else | ||
const Expanded( | ||
child: ChatRoomsList(), | ||
), | ||
Padding( | ||
padding: const EdgeInsets.symmetric(vertical: kMediumPadding), | ||
child: YaruMasterTile( | ||
leading: const Icon(YaruIcons.settings), | ||
title: Text(l10n.settings), | ||
onTap: () => showDialog( | ||
context: context, | ||
builder: (context) => const SettingsDialog(), | ||
), | ||
), | ||
), | ||
], | ||
), | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
import 'package:flutter/material.dart'; | ||
import 'package:watch_it/watch_it.dart'; | ||
import 'package:yaru/yaru.dart'; | ||
|
||
import '../../../common/view/build_context_x.dart'; | ||
import '../../../common/view/space.dart'; | ||
import '../../../common/view/theme.dart'; | ||
import '../../../common/view/ui_constants.dart'; | ||
import '../../../l10n/l10n.dart'; | ||
import '../../common/chat_model.dart'; | ||
import '../../common/search_model.dart'; | ||
import 'chat_new_chat_popup_menu_button.dart'; | ||
|
||
class ChatMasterTitleBar extends StatelessWidget with WatchItMixin { | ||
const ChatMasterTitleBar({super.key}); | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
final l10n = context.l10n; | ||
final chatModel = di<ChatModel>(); | ||
final searchModel = di<SearchModel>(); | ||
final searchActive = watchPropertyValue((SearchModel m) => m.searchActive); | ||
final archiveActive = watchPropertyValue((ChatModel m) => m.archiveActive); | ||
return YaruWindowTitleBar( | ||
heroTag: '<Left hero tag>', | ||
title: Text(archiveActive ? l10n.archive : l10n.chats), | ||
border: BorderSide.none, | ||
style: YaruTitleBarStyle.undecorated, | ||
backgroundColor: getMonochromeBg(theme: context.theme, darkFactor: 3), | ||
actions: space( | ||
flex: true, | ||
spaceEnd: true, | ||
widthGap: kSmallPadding, | ||
skip: 0, | ||
children: [ | ||
if (!archiveActive) const ChatNewChatPopupMenuButton(), | ||
if (!archiveActive) | ||
IconButton( | ||
isSelected: searchActive, | ||
onPressed: searchModel.toggleSearch, | ||
icon: const Icon(YaruIcons.search), | ||
), | ||
IconButton( | ||
selectedIcon: const Icon(YaruIcons.bookmark_filled), | ||
isSelected: archiveActive, | ||
onPressed: chatModel.toggleArchive, | ||
icon: const Icon(YaruIcons.bookmark), | ||
), | ||
], | ||
), | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
69 changes: 69 additions & 0 deletions
69
lib/chat/chat_master/view/chat_new_chat_popup_menu_button.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
import 'package:flutter/material.dart'; | ||
import 'package:yaru/yaru.dart'; | ||
|
||
import '../../../l10n/l10n.dart'; | ||
import '../../chat_room/common/view/chat_create_or_edit_room_dialog.dart'; | ||
import '../../chat_room/common/view/chat_new_direct_chat_dialog.dart'; | ||
|
||
class ChatNewChatPopupMenuButton extends StatelessWidget { | ||
const ChatNewChatPopupMenuButton({super.key}); | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
final l10n = context.l10n; | ||
return PopupMenuButton( | ||
tooltip: l10n.newChat, | ||
padding: EdgeInsets.zero, | ||
icon: const Icon(YaruIcons.plus), | ||
itemBuilder: (context) { | ||
return [ | ||
PopupMenuItem( | ||
onTap: () => showDialog( | ||
context: context, | ||
builder: (context) => const ChatNewDirectChatDialog(), | ||
), | ||
child: Row( | ||
mainAxisAlignment: MainAxisAlignment.spaceBetween, | ||
children: [ | ||
Text(l10n.directChat), | ||
const Icon( | ||
YaruIcons.user, | ||
), | ||
], | ||
), | ||
), | ||
PopupMenuItem( | ||
onTap: () => showDialog( | ||
context: context, | ||
builder: (context) => const ChatCreateOrEditRoomDialog(), | ||
), | ||
child: Row( | ||
mainAxisAlignment: MainAxisAlignment.spaceBetween, | ||
children: [ | ||
Text(l10n.newGroup), | ||
const Icon( | ||
YaruIcons.users, | ||
), | ||
], | ||
), | ||
), | ||
PopupMenuItem( | ||
onTap: () => showDialog( | ||
context: context, | ||
builder: (context) => const ChatCreateOrEditRoomDialog( | ||
space: true, | ||
), | ||
), | ||
child: Row( | ||
mainAxisAlignment: MainAxisAlignment.spaceBetween, | ||
children: [ | ||
Text(l10n.newSpace), | ||
const Icon(YaruIcons.globe), | ||
], | ||
), | ||
), | ||
]; | ||
}, | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.