Skip to content

Commit

Permalink
small ui changes
Browse files Browse the repository at this point in the history
  • Loading branch information
danemadsen committed May 12, 2024
1 parent c7d7245 commit bb86e39
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 40 deletions.
5 changes: 5 additions & 0 deletions lib/static/utilities.dart
Original file line number Diff line number Diff line change
Expand Up @@ -60,4 +60,9 @@ class Utilities {

return File(path)..writeAsBytesSync(buffer);
}

static String capitalizeFirst(String word) {
if (word.isEmpty) return word;
return word[0].toUpperCase() + word.substring(1).toLowerCase();
}
}
33 changes: 10 additions & 23 deletions lib/ui/mobile/pages/character/character_customization_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import 'dart:convert';

import 'package:flutter/material.dart';
import 'package:maid/providers/character.dart';
import 'package:maid/static/utilities.dart';
import 'package:maid/ui/mobile/pages/character/character_browser_page.dart';
import 'package:maid/ui/mobile/widgets/appbars/generic_app_bar.dart';
import 'package:maid/ui/mobile/widgets/dialogs.dart';
Expand Down Expand Up @@ -244,28 +245,14 @@ class _CharacterCustomizationPageState extends State<CharacterCustomizationPage>
endIndent: 10,
color: Theme.of(context).colorScheme.primary,
),
ListTile(
title: Row(
children: [
const Expanded(
child: Text("Name"),
),
Expanded(
flex: 2,
child: TextField(
cursorColor:
Theme.of(context).colorScheme.secondary,
decoration: const InputDecoration(
labelText: "Name",
),
controller: nameController,
onChanged: (value) {
character.name = value;
},
),
),
],
),
TextFieldListTile(
headingText: 'Name',
labelText: 'Name',
controller: nameController,
onChanged: (value) {
character.name = value;
},
multiline: false,
),
TextFieldListTile(
headingText: 'Description',
Expand Down Expand Up @@ -427,7 +414,7 @@ class _CharacterCustomizationPageState extends State<CharacterCustomizationPage>
for (int i = 0; i < character.examples.length; i++)
TextFieldListTile(
headingText:
'${character.examples[i]["role"]} content',
'${Utilities.capitalizeFirst(character.examples[i]["role"])} Content',
labelText: character.examples[i]["role"],
controller: exampleControllers[i],
onChanged: (value) {
Expand Down
29 changes: 12 additions & 17 deletions lib/ui/mobile/widgets/tiles/text_field_list_tile.dart
Original file line number Diff line number Diff line change
Expand Up @@ -22,25 +22,20 @@ class TextFieldListTile extends StatelessWidget{
@override
Widget build(BuildContext context) {
return ListTile(
title: Row(
title: Column(
children: [
Expanded(
child: Text(headingText),
),
Expanded(
flex: 2,
child: TextField(
keyboardType: multiline ? TextInputType.multiline : TextInputType.text,
maxLines: multiline ? null : 1,
cursorColor: Theme.of(context).colorScheme.secondary,
controller: controller ?? TextEditingController(text: initialValue),
decoration: InputDecoration(
labelText: labelText,
),
onSubmitted: onSubmitted,
onChanged: onChanged,
Text(headingText),
TextField(
keyboardType: multiline ? TextInputType.multiline : TextInputType.text,
maxLines: multiline ? null : 1,
cursorColor: Theme.of(context).colorScheme.secondary,
controller: controller ?? TextEditingController(text: initialValue),
decoration: InputDecoration(
labelText: labelText,
),
),
onSubmitted: onSubmitted,
onChanged: onChanged,
)
],
),
);
Expand Down

0 comments on commit bb86e39

Please sign in to comment.