From 40c4d9f7f8f30af9349075f5e45cbc46479a074f Mon Sep 17 00:00:00 2001 From: ewuuwe Date: Mon, 4 Mar 2024 10:40:12 +0100 Subject: [PATCH] Fix code overflowing --- lib/pages/sending_page.dart | 49 ++++++++++++++++----------- lib/pages/settings_page.dart | 64 +++++++++++++++++++----------------- 2 files changed, 63 insertions(+), 50 deletions(-) diff --git a/lib/pages/sending_page.dart b/lib/pages/sending_page.dart index a357ddc..8714176 100644 --- a/lib/pages/sending_page.dart +++ b/lib/pages/sending_page.dart @@ -113,7 +113,7 @@ class _SendingPageState extends State { if (constraints.maxWidth > 600) { return _buildWideContainer(); } else { - return _buildNormaContainer(); + return _buildNormalContainer(); } })), ); @@ -177,7 +177,7 @@ class _SendingPageState extends State { ); } - Widget _buildNormaContainer() { + Widget _buildNormalContainer() { return Center( child: codeText == '' ? Padding( @@ -201,31 +201,42 @@ class _SendingPageState extends State { backgroundColor: Colors.white), ))), const Gap(10), - Card( - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(100), - ), - child: Padding( - padding: const EdgeInsets.fromLTRB(16, 0, 0, 0), - child: Row( - mainAxisSize: MainAxisSize.min, - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Text(codeText, - style: Theme.of(context).textTheme.titleMedium), - IconButton( - onPressed: () { + Padding( + padding: const EdgeInsets.symmetric(horizontal: 8), + child: Column(mainAxisSize: MainAxisSize.min, children: [ + Card( + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(20), + ), + child: InkWell( + borderRadius: BorderRadius.circular(20), + onTap: () { Clipboard.setData(ClipboardData(text: codeText)); ScaffoldMessenger.of(context) .showSnackBar(const SnackBar( content: Text("Copied code to clipboard"), )); }, - icon: const Icon(Icons.copy), + child: Padding( + padding: const EdgeInsets.fromLTRB(15, 15, 15, 15), + child: Text( + codeText, + style: TextStyle( + height: 1.6, + fontSize: Theme.of(context) + .textTheme + .titleMedium! + .fontSize! + + 1.5, + fontWeight: Theme.of(context) + .textTheme + .titleMedium + ?.fontWeight), + ) + ), ), - ], ), - ), + ]), ), ], ), diff --git a/lib/pages/settings_page.dart b/lib/pages/settings_page.dart index 57ff5c9..99131ea 100644 --- a/lib/pages/settings_page.dart +++ b/lib/pages/settings_page.dart @@ -16,7 +16,7 @@ class _SettingsPageState extends State { int _wordCount = 0; static const int minWordCount = 1; - static const int maxWordCount = 5; + static const int maxWordCount = 8; @override Widget build(BuildContext context) { @@ -61,37 +61,39 @@ class _SettingsPageState extends State { .colorScheme .onBackground), ), - Row( - children: [ - - Text( - _wordCount.toString(), - style: TextStyle( - fontSize: 15, - color: Theme.of(context) - .colorScheme - .onBackground), - ), - Expanded( - child: Slider( - value: _wordCountSlider.clamp(1, 5), - min: minWordCount.toDouble(), - max: maxWordCount.toDouble(), - divisions: maxWordCount - minWordCount, - label: _wordCount.toString(), - onChanged: (double value) { - setState(() { - _wordCountSlider = value; - if (_wordCountSlider.round() != - _wordCount) { - _wordCount = _wordCountSlider.round(); - Settings.setWordLength( - _wordCount.round()); - } - }); - }, + Row(children: [ + Text( + _wordCount.toString(), + style: TextStyle( + fontSize: 15, + color: Theme.of(context) + .colorScheme + .onBackground), ), - )]) + Expanded( + child: Slider( + value: _wordCountSlider.clamp( + minWordCount.toDouble(), + maxWordCount.toDouble()), + min: minWordCount.toDouble(), + max: maxWordCount.toDouble(), + divisions: maxWordCount - minWordCount, + label: _wordCount.toString(), + onChanged: (double value) { + setState(() { + _wordCountSlider = value; + if (_wordCountSlider.round() != + _wordCount) { + _wordCount = + _wordCountSlider.round(); + Settings.setWordLength( + _wordCount.round()); + } + }); + }, + ), + ) + ]) ]))), ); }