refactor: New private chat

krille/remove-unused-translations
Krille 3 years ago
parent abd9afed7e
commit 6fc8aaa1bb

@ -26,78 +26,80 @@ class NewPrivateChatView extends StatelessWidget {
title: Text(L10n.of(context)!.newChat), title: Text(L10n.of(context)!.newChat),
backgroundColor: Theme.of(context).scaffoldBackgroundColor, backgroundColor: Theme.of(context).scaffoldBackgroundColor,
actions: [ actions: [
TextButton( Padding(
onPressed: () => VRouter.of(context).to('/newgroup'), padding: const EdgeInsets.all(8.0),
child: Text( child: TextButton(
L10n.of(context)!.createNewGroup, onPressed: () => VRouter.of(context).to('/newgroup'),
style: TextStyle(color: Theme.of(context).colorScheme.secondary), child: Text(
L10n.of(context)!.createNewGroup,
style:
TextStyle(color: Theme.of(context).colorScheme.secondary),
),
), ),
) )
], ],
), ),
body: MaxWidthBody( body: MaxWidthBody(
withScrolling: true, withScrolling: true,
child: Column( child: Container(
children: [ margin: const EdgeInsets.all(_qrCodePadding),
Padding( alignment: Alignment.center,
padding: const EdgeInsets.symmetric(horizontal: 12), padding: const EdgeInsets.all(_qrCodePadding * 2),
child: Form( child: Material(
key: controller.formKey, borderRadius: BorderRadius.circular(12),
child: TextFormField( elevation: 10,
controller: controller.controller, color: Colors.white,
autocorrect: false, shadowColor: Theme.of(context).appBarTheme.shadowColor,
autofocus: !PlatformInfos.isMobile, clipBehavior: Clip.hardEdge,
textInputAction: TextInputAction.go, child: Column(
focusNode: controller.textFieldFocus, mainAxisSize: MainAxisSize.min,
onFieldSubmitted: controller.submitAction, children: [
validator: controller.validateForm, QrImage(
inputFormatters: controller.removeMatrixToFormatters, data:
decoration: InputDecoration( 'https://matrix.to/#/${Matrix.of(context).client.userID}',
contentPadding: const EdgeInsets.symmetric( version: QrVersions.auto,
horizontal: 12, size: min(MediaQuery.of(context).size.width - 16, 200),
vertical: 6,
),
labelText: L10n.of(context)!.typeInInviteLinkManually,
hintText: '@username',
prefixText: NewPrivateChatController.prefixNoProtocol,
suffixIcon: IconButton(
icon: const Icon(Icons.send_outlined),
onPressed: controller.submitAction,
),
),
), ),
), TextButton.icon(
icon: Icon(Icons.adaptive.share_outlined),
label: Text(L10n.of(context)!.shareYourInviteLink),
onPressed: controller.inviteAction,
),
const SizedBox(height: 8),
],
), ),
Container( ),
margin: const EdgeInsets.all(_qrCodePadding), ),
alignment: Alignment.center, ),
padding: const EdgeInsets.all(_qrCodePadding * 2), bottomNavigationBar: MaxWidthBody(
child: Material( withScrolling: false,
borderRadius: BorderRadius.circular(12), child: Padding(
elevation: 10, padding: const EdgeInsets.all(12.0),
color: Colors.white, child: Form(
shadowColor: Theme.of(context).appBarTheme.shadowColor, key: controller.formKey,
clipBehavior: Clip.hardEdge, child: TextFormField(
child: Column( controller: controller.controller,
mainAxisSize: MainAxisSize.min, autocorrect: false,
children: [ textInputAction: TextInputAction.go,
QrImage( focusNode: controller.textFieldFocus,
data: onFieldSubmitted: controller.submitAction,
'https://matrix.to/#/${Matrix.of(context).client.userID}', validator: controller.validateForm,
version: QrVersions.auto, inputFormatters: controller.removeMatrixToFormatters,
size: min(MediaQuery.of(context).size.width - 16, 200), decoration: InputDecoration(
), contentPadding: const EdgeInsets.symmetric(
TextButton.icon( horizontal: 12,
icon: Icon(Icons.adaptive.share_outlined), vertical: 6,
label: Text(L10n.of(context)!.shareYourInviteLink), ),
onPressed: controller.inviteAction, labelText: L10n.of(context)!.typeInInviteLinkManually,
), hintText: '@username',
const SizedBox(height: 8), prefixText: NewPrivateChatController.prefixNoProtocol,
], suffixIcon: IconButton(
icon: const Icon(Icons.send_outlined),
onPressed: controller.submitAction,
), ),
), ),
), ),
], ),
), ),
), ),
floatingActionButtonLocation: FloatingActionButtonLocation.centerFloat, floatingActionButtonLocation: FloatingActionButtonLocation.centerFloat,

@ -11,7 +11,6 @@ class ContentBanner extends StatelessWidget {
final void Function()? onEdit; final void Function()? onEdit;
final Client? client; final Client? client;
final double opacity; final double opacity;
final String heroTag;
const ContentBanner( const ContentBanner(
{this.mxContent, {this.mxContent,
@ -20,7 +19,6 @@ class ContentBanner extends StatelessWidget {
this.onEdit, this.onEdit,
this.client, this.client,
this.opacity = 0.75, this.opacity = 0.75,
this.heroTag = 'content_banner',
Key? key}) Key? key})
: super(key: key); : super(key: key);
@ -42,27 +40,23 @@ class ContentBanner extends StatelessWidget {
bottom: 0, bottom: 0,
child: Opacity( child: Opacity(
opacity: opacity, opacity: opacity,
child: Hero( child: mxContent == null
tag: heroTag, ? Center(
child: mxContent == null child: Icon(
? Center( defaultIcon,
child: Icon( color:
defaultIcon, Theme.of(context).colorScheme.onSecondaryContainer,
color: Theme.of(context) size: 128,
.colorScheme
.onSecondaryContainer,
size: 128,
),
)
: MxcImage(
key: Key(mxContent?.toString() ?? 'NoKey'),
uri: mxContent,
animated: true,
fit: BoxFit.cover,
height: 400,
width: 800,
), ),
), )
: MxcImage(
key: Key(mxContent?.toString() ?? 'NoKey'),
uri: mxContent,
animated: true,
fit: BoxFit.cover,
height: 400,
width: 800,
),
), ),
), ),
if (onEdit != null) if (onEdit != null)
@ -71,6 +65,7 @@ class ContentBanner extends StatelessWidget {
alignment: Alignment.bottomRight, alignment: Alignment.bottomRight,
child: FloatingActionButton( child: FloatingActionButton(
mini: true, mini: true,
heroTag: null,
onPressed: onEdit, onPressed: onEdit,
backgroundColor: Theme.of(context).backgroundColor, backgroundColor: Theme.of(context).backgroundColor,
foregroundColor: Theme.of(context).textTheme.bodyText1?.color, foregroundColor: Theme.of(context).textTheme.bodyText1?.color,

Loading…
Cancel
Save