refactor: New private chat

This commit is contained in:
Krille 2022-12-30 14:37:13 +01:00
parent 1e1e591d27
commit fff3dc9946
2 changed files with 82 additions and 85 deletions

View File

@ -26,49 +26,22 @@ class NewPrivateChatView extends StatelessWidget {
title: Text(L10n.of(context)!.newChat),
backgroundColor: Theme.of(context).scaffoldBackgroundColor,
actions: [
TextButton(
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),
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,
),
),
),
),
),
Container(
child: Container(
margin: const EdgeInsets.all(_qrCodePadding),
alignment: Alignment.center,
padding: const EdgeInsets.all(_qrCodePadding * 2),
@ -97,7 +70,36 @@ class NewPrivateChatView extends StatelessWidget {
),
),
),
],
),
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,
),
),
),
),
),
),
floatingActionButtonLocation: FloatingActionButtonLocation.centerFloat,

View File

@ -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,15 +40,12 @@ 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,
color:
Theme.of(context).colorScheme.onSecondaryContainer,
size: 128,
),
)
@ -64,13 +59,13 @@ class ContentBanner extends StatelessWidget {
),
),
),
),
if (onEdit != null)
Container(
margin: const EdgeInsets.all(8),
alignment: Alignment.bottomRight,
child: FloatingActionButton(
mini: true,
heroTag: null,
onPressed: onEdit,
backgroundColor: Theme.of(context).backgroundColor,
foregroundColor: Theme.of(context).textTheme.bodyText1?.color,