Skip to content

Commit

Permalink
Merge pull request #15 from iyox-studios/code-overflow
Browse files Browse the repository at this point in the history
Fix code overflowing
  • Loading branch information
EwuUwe authored Mar 4, 2024
2 parents be7385a + 40c4d9f commit d330201
Show file tree
Hide file tree
Showing 2 changed files with 63 additions and 50 deletions.
49 changes: 30 additions & 19 deletions lib/pages/sending_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ class _SendingPageState extends State<SendingPage> {
if (constraints.maxWidth > 600) {
return _buildWideContainer();
} else {
return _buildNormaContainer();
return _buildNormalContainer();
}
})),
);
Expand Down Expand Up @@ -177,7 +177,7 @@ class _SendingPageState extends State<SendingPage> {
);
}

Widget _buildNormaContainer() {
Widget _buildNormalContainer() {
return Center(
child: codeText == ''
? Padding(
Expand All @@ -201,31 +201,42 @@ class _SendingPageState extends State<SendingPage> {
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),
)
),
),
],
),
),
]),
),
],
),
Expand Down
64 changes: 33 additions & 31 deletions lib/pages/settings_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class _SettingsPageState extends State<SettingsPage> {
int _wordCount = 0;

static const int minWordCount = 1;
static const int maxWordCount = 5;
static const int maxWordCount = 8;

@override
Widget build(BuildContext context) {
Expand Down Expand Up @@ -61,37 +61,39 @@ class _SettingsPageState extends State<SettingsPage> {
.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());
}
});
},
),
)
])
]))),
);
}
Expand Down

0 comments on commit d330201

Please sign in to comment.