mirror of
https://github.com/krille-chan/fluffychat
synced 2024-09-10 09:45:14 +00:00
refactor: New private chat
This commit is contained in:
parent
abd9afed7e
commit
6fc8aaa1bb
2 changed files with 82 additions and 85 deletions
|
@ -26,78 +26,80 @@ class NewPrivateChatView extends StatelessWidget {
|
|||
title: Text(L10n.of(context)!.newChat),
|
||||
backgroundColor: Theme.of(context).scaffoldBackgroundColor,
|
||||
actions: [
|
||||
TextButton(
|
||||
onPressed: () => VRouter.of(context).to('/newgroup'),
|
||||
child: Text(
|
||||
L10n.of(context)!.createNewGroup,
|
||||
style: TextStyle(color: Theme.of(context).colorScheme.secondary),
|
||||
Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: TextButton(
|
||||
onPressed: () => VRouter.of(context).to('/newgroup'),
|
||||
child: Text(
|
||||
L10n.of(context)!.createNewGroup,
|
||||
style:
|
||||
TextStyle(color: Theme.of(context).colorScheme.secondary),
|
||||
),
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
body: MaxWidthBody(
|
||||
withScrolling: true,
|
||||
child: Column(
|
||||
children: [
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 12),
|
||||
child: Form(
|
||||
key: controller.formKey,
|
||||
child: TextFormField(
|
||||
controller: controller.controller,
|
||||
autocorrect: false,
|
||||
autofocus: !PlatformInfos.isMobile,
|
||||
textInputAction: TextInputAction.go,
|
||||
focusNode: controller.textFieldFocus,
|
||||
onFieldSubmitted: controller.submitAction,
|
||||
validator: controller.validateForm,
|
||||
inputFormatters: controller.removeMatrixToFormatters,
|
||||
decoration: InputDecoration(
|
||||
contentPadding: const EdgeInsets.symmetric(
|
||||
horizontal: 12,
|
||||
vertical: 6,
|
||||
),
|
||||
labelText: L10n.of(context)!.typeInInviteLinkManually,
|
||||
hintText: '@username',
|
||||
prefixText: NewPrivateChatController.prefixNoProtocol,
|
||||
suffixIcon: IconButton(
|
||||
icon: const Icon(Icons.send_outlined),
|
||||
onPressed: controller.submitAction,
|
||||
),
|
||||
),
|
||||
child: Container(
|
||||
margin: const EdgeInsets.all(_qrCodePadding),
|
||||
alignment: Alignment.center,
|
||||
padding: const EdgeInsets.all(_qrCodePadding * 2),
|
||||
child: Material(
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
elevation: 10,
|
||||
color: Colors.white,
|
||||
shadowColor: Theme.of(context).appBarTheme.shadowColor,
|
||||
clipBehavior: Clip.hardEdge,
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
QrImage(
|
||||
data:
|
||||
'https://matrix.to/#/${Matrix.of(context).client.userID}',
|
||||
version: QrVersions.auto,
|
||||
size: min(MediaQuery.of(context).size.width - 16, 200),
|
||||
),
|
||||
TextButton.icon(
|
||||
icon: Icon(Icons.adaptive.share_outlined),
|
||||
label: Text(L10n.of(context)!.shareYourInviteLink),
|
||||
onPressed: controller.inviteAction,
|
||||
),
|
||||
const SizedBox(height: 8),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
bottomNavigationBar: MaxWidthBody(
|
||||
withScrolling: false,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(12.0),
|
||||
child: Form(
|
||||
key: controller.formKey,
|
||||
child: TextFormField(
|
||||
controller: controller.controller,
|
||||
autocorrect: false,
|
||||
textInputAction: TextInputAction.go,
|
||||
focusNode: controller.textFieldFocus,
|
||||
onFieldSubmitted: controller.submitAction,
|
||||
validator: controller.validateForm,
|
||||
inputFormatters: controller.removeMatrixToFormatters,
|
||||
decoration: InputDecoration(
|
||||
contentPadding: const EdgeInsets.symmetric(
|
||||
horizontal: 12,
|
||||
vertical: 6,
|
||||
),
|
||||
labelText: L10n.of(context)!.typeInInviteLinkManually,
|
||||
hintText: '@username',
|
||||
prefixText: NewPrivateChatController.prefixNoProtocol,
|
||||
suffixIcon: IconButton(
|
||||
icon: const Icon(Icons.send_outlined),
|
||||
onPressed: controller.submitAction,
|
||||
),
|
||||
),
|
||||
),
|
||||
Container(
|
||||
margin: const EdgeInsets.all(_qrCodePadding),
|
||||
alignment: Alignment.center,
|
||||
padding: const EdgeInsets.all(_qrCodePadding * 2),
|
||||
child: Material(
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
elevation: 10,
|
||||
color: Colors.white,
|
||||
shadowColor: Theme.of(context).appBarTheme.shadowColor,
|
||||
clipBehavior: Clip.hardEdge,
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
QrImage(
|
||||
data:
|
||||
'https://matrix.to/#/${Matrix.of(context).client.userID}',
|
||||
version: QrVersions.auto,
|
||||
size: min(MediaQuery.of(context).size.width - 16, 200),
|
||||
),
|
||||
TextButton.icon(
|
||||
icon: Icon(Icons.adaptive.share_outlined),
|
||||
label: Text(L10n.of(context)!.shareYourInviteLink),
|
||||
onPressed: controller.inviteAction,
|
||||
),
|
||||
const SizedBox(height: 8),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
floatingActionButtonLocation: FloatingActionButtonLocation.centerFloat,
|
||||
|
|
|
@ -11,7 +11,6 @@ class ContentBanner extends StatelessWidget {
|
|||
final void Function()? onEdit;
|
||||
final Client? client;
|
||||
final double opacity;
|
||||
final String heroTag;
|
||||
|
||||
const ContentBanner(
|
||||
{this.mxContent,
|
||||
|
@ -20,7 +19,6 @@ class ContentBanner extends StatelessWidget {
|
|||
this.onEdit,
|
||||
this.client,
|
||||
this.opacity = 0.75,
|
||||
this.heroTag = 'content_banner',
|
||||
Key? key})
|
||||
: super(key: key);
|
||||
|
||||
|
@ -42,27 +40,23 @@ class ContentBanner extends StatelessWidget {
|
|||
bottom: 0,
|
||||
child: Opacity(
|
||||
opacity: opacity,
|
||||
child: Hero(
|
||||
tag: heroTag,
|
||||
child: mxContent == null
|
||||
? Center(
|
||||
child: Icon(
|
||||
defaultIcon,
|
||||
color: Theme.of(context)
|
||||
.colorScheme
|
||||
.onSecondaryContainer,
|
||||
size: 128,
|
||||
),
|
||||
)
|
||||
: MxcImage(
|
||||
key: Key(mxContent?.toString() ?? 'NoKey'),
|
||||
uri: mxContent,
|
||||
animated: true,
|
||||
fit: BoxFit.cover,
|
||||
height: 400,
|
||||
width: 800,
|
||||
child: mxContent == null
|
||||
? Center(
|
||||
child: Icon(
|
||||
defaultIcon,
|
||||
color:
|
||||
Theme.of(context).colorScheme.onSecondaryContainer,
|
||||
size: 128,
|
||||
),
|
||||
),
|
||||
)
|
||||
: MxcImage(
|
||||
key: Key(mxContent?.toString() ?? 'NoKey'),
|
||||
uri: mxContent,
|
||||
animated: true,
|
||||
fit: BoxFit.cover,
|
||||
height: 400,
|
||||
width: 800,
|
||||
),
|
||||
),
|
||||
),
|
||||
if (onEdit != null)
|
||||
|
@ -71,6 +65,7 @@ class ContentBanner extends StatelessWidget {
|
|||
alignment: Alignment.bottomRight,
|
||||
child: FloatingActionButton(
|
||||
mini: true,
|
||||
heroTag: null,
|
||||
onPressed: onEdit,
|
||||
backgroundColor: Theme.of(context).backgroundColor,
|
||||
foregroundColor: Theme.of(context).textTheme.bodyText1?.color,
|
||||
|
|
Loading…
Reference in a new issue