Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
71 changes: 39 additions & 32 deletions lib/pages/exchange_view/edit_trade_note_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -62,15 +62,16 @@ class _EditNoteViewState extends ConsumerState<EditTradeNoteView> {
child: Scaffold(
backgroundColor: Theme.of(context).extension<StackColors>()!.background,
appBar: AppBar(
backgroundColor:
Theme.of(context).extension<StackColors>()!.background,
backgroundColor: Theme.of(
context,
).extension<StackColors>()!.background,
leading: AppBarBackButton(
onPressed: () async {
if (FocusScope.of(context).hasFocus) {
FocusScope.of(context).unfocus();
await Future<void>.delayed(const Duration(milliseconds: 75));
}
if (mounted) {
if (context.mounted) {
Navigator.of(context).pop();
}
},
Expand Down Expand Up @@ -102,41 +103,47 @@ class _EditNoteViewState extends ConsumerState<EditTradeNoteView> {
),
child: TextField(
autocorrect: Util.isDesktop ? false : true,
enableSuggestions:
Util.isDesktop ? false : true,
enableSuggestions: Util.isDesktop
? false
: true,
minLines: 3,
maxLines: 6,
keyboardType: TextInputType.multiline,
textInputAction: TextInputAction.newline,
controller: _noteController,
style: STextStyles.field(context),
focusNode: noteFieldFocusNode,
onChanged: (_) => setState(() {}),
decoration: standardInputDecoration(
"Note",
noteFieldFocusNode,
context,
).copyWith(
suffixIcon:
_noteController.text.isNotEmpty
decoration:
standardInputDecoration(
"Note",
noteFieldFocusNode,
context,
).copyWith(
suffixIcon:
_noteController.text.isNotEmpty
? Padding(
padding: const EdgeInsets.only(
right: 0,
),
child: UnconstrainedBox(
child: Row(
children: [
TextFieldIconButton(
child: const XIcon(),
onTap: () async {
setState(() {
_noteController.text =
"";
});
},
),
],
padding: const EdgeInsets.only(
right: 0,
),
),
)
child: UnconstrainedBox(
child: Row(
children: [
TextFieldIconButton(
child: const XIcon(),
onTap: () async {
setState(() {
_noteController.text =
"";
});
},
),
],
),
),
)
: null,
),
),
),
),
const Spacer(),
Expand All @@ -148,7 +155,7 @@ class _EditNoteViewState extends ConsumerState<EditTradeNoteView> {
tradeId: widget.tradeId,
note: _noteController.text,
);
if (mounted) {
if (context.mounted) {
Navigator.of(context).pop();
}
},
Expand Down
155 changes: 77 additions & 78 deletions lib/pages/wallet_view/transaction_views/edit_note_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -71,34 +71,33 @@ class _EditNoteViewState extends ConsumerState<EditNoteView> {
condition: !isDesktop,
builder: (child) => Background(child: child),
child: Scaffold(
backgroundColor:
isDesktop
? Colors.transparent
: Theme.of(context).extension<StackColors>()!.background,
appBar:
isDesktop
? null
: AppBar(
backgroundColor:
Theme.of(context).extension<StackColors>()!.background,
leading: AppBarBackButton(
onPressed: () async {
if (FocusScope.of(context).hasFocus) {
FocusScope.of(context).unfocus();
await Future<void>.delayed(
const Duration(milliseconds: 75),
);
}
if (mounted) {
Navigator.of(context).pop();
}
},
),
title: Text(
"Edit note",
style: STextStyles.navBarTitle(context),
),
backgroundColor: isDesktop
? Colors.transparent
: Theme.of(context).extension<StackColors>()!.background,
appBar: isDesktop
? null
: AppBar(
backgroundColor: Theme.of(
context,
).extension<StackColors>()!.background,
leading: AppBarBackButton(
onPressed: () async {
if (FocusScope.of(context).hasFocus) {
FocusScope.of(context).unfocus();
await Future<void>.delayed(
const Duration(milliseconds: 75),
);
}
if (context.mounted) {
Navigator.of(context).pop();
}
},
),
title: Text(
"Edit note",
style: STextStyles.navBarTitle(context),
),
),
body: MobileEditNoteScaffold(
child: Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
Expand All @@ -115,72 +114,70 @@ class _EditNoteViewState extends ConsumerState<EditNoteView> {
),
),
Padding(
padding:
isDesktop
? const EdgeInsets.symmetric(horizontal: 32)
: const EdgeInsets.all(0),
padding: isDesktop
? const EdgeInsets.symmetric(horizontal: 32)
: const EdgeInsets.all(0),
child: ClipRRect(
borderRadius: BorderRadius.circular(
Constants.size.circularBorderRadius,
),
child: TextField(
autocorrect: Util.isDesktop ? false : true,
enableSuggestions: Util.isDesktop ? false : true,
minLines: 3,
maxLines: 6,
keyboardType: TextInputType.multiline,
textInputAction: TextInputAction.newline,
controller: _noteController,
style:
isDesktop
? STextStyles.desktopTextExtraSmall(
style: isDesktop
? STextStyles.desktopTextExtraSmall(context).copyWith(
color: Theme.of(
context,
).copyWith(
color:
Theme.of(context)
.extension<StackColors>()!
.textFieldActiveText,
height: 1.8,
)
: STextStyles.field(context),
).extension<StackColors>()!.textFieldActiveText,
height: 1.8,
)
: STextStyles.field(context),
focusNode: noteFieldFocusNode,
decoration: standardInputDecoration(
"Note",
noteFieldFocusNode,
context,
desktopMed: isDesktop,
).copyWith(
contentPadding:
isDesktop
decoration:
standardInputDecoration(
"Note",
noteFieldFocusNode,
context,
desktopMed: isDesktop,
).copyWith(
contentPadding: isDesktop
? const EdgeInsets.only(
left: 16,
top: 11,
bottom: 12,
right: 5,
)
left: 16,
top: 11,
bottom: 12,
right: 5,
)
: null,
suffixIcon:
_noteController.text.isNotEmpty
suffixIcon: _noteController.text.isNotEmpty
? Padding(
padding: const EdgeInsets.only(right: 0),
child: UnconstrainedBox(
child: Row(
children: [
TextFieldIconButton(
child: const XIcon(),
onTap: () async {
setState(() {
_noteController.text = "";
});
},
),
],
padding: const EdgeInsets.only(right: 0),
child: UnconstrainedBox(
child: Row(
children: [
TextFieldIconButton(
child: const XIcon(),
onTap: () async {
setState(() {
_noteController.text = "";
});
},
),
],
),
),
),
)
)
: null,
),
),
),
),
),
// if (!isDesktop)
const Spacer(),
if (!isDesktop) const Spacer(),
if (isDesktop) const SizedBox(height: 12),
if (isDesktop)
Padding(
padding: const EdgeInsets.all(32),
Expand All @@ -198,7 +195,7 @@ class _EditNoteViewState extends ConsumerState<EditNoteView> {
),
);

if (mounted) {
if (context.mounted) {
Navigator.of(context).pop();
}
},
Expand All @@ -217,7 +214,7 @@ class _EditNoteViewState extends ConsumerState<EditNoteView> {
value: _noteController.text,
),
);
if (mounted) {
if (context.mounted) {
Navigator.of(context).pop();
}
},
Expand All @@ -242,7 +239,9 @@ class MobileEditNoteScaffold extends StatelessWidget {
@override
Widget build(BuildContext context) {
if (Util.isDesktop) {
return child;
// Desktop callers host this view in a DesktopDialog of fixed height,
// which a multi-line note field can exceed.
return SingleChildScrollView(child: child);
} else {
return SafeArea(
child: Padding(
Expand Down
Loading
Loading