Compare commits
10 Commits
7024699a61
...
feature/11
| Author | SHA1 | Date | |
|---|---|---|---|
| 58d8d07b63 | |||
| c983ca22dd | |||
| 45b11359b3 | |||
| 57fb8dbcc8 | |||
| 5a30538aa5 | |||
| 1e18105ce0 | |||
| 94c3bad02b | |||
| ed2d672dee | |||
| fa2706395c | |||
| 3addaa0f9d |
@@ -48,6 +48,7 @@ class _CreateGroupViewState extends State<CreateGroupView> {
|
|||||||
final loc = AppLocalizations.of(context);
|
final loc = AppLocalizations.of(context);
|
||||||
return ScaffoldMessenger(
|
return ScaffoldMessenger(
|
||||||
child: Scaffold(
|
child: Scaffold(
|
||||||
|
resizeToAvoidBottomInset: false,
|
||||||
backgroundColor: CustomTheme.backgroundColor,
|
backgroundColor: CustomTheme.backgroundColor,
|
||||||
appBar: AppBar(title: Text(loc.create_new_group)),
|
appBar: AppBar(title: Text(loc.create_new_group)),
|
||||||
body: SafeArea(
|
body: SafeArea(
|
||||||
|
|||||||
@@ -46,6 +46,7 @@ class _ChooseGameViewState extends State<ChooseGameView> {
|
|||||||
final loc = AppLocalizations.of(context);
|
final loc = AppLocalizations.of(context);
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
backgroundColor: CustomTheme.backgroundColor,
|
backgroundColor: CustomTheme.backgroundColor,
|
||||||
|
resizeToAvoidBottomInset: false,
|
||||||
appBar: AppBar(
|
appBar: AppBar(
|
||||||
leading: IconButton(
|
leading: IconButton(
|
||||||
icon: const Icon(Icons.arrow_back_ios),
|
icon: const Icon(Icons.arrow_back_ios),
|
||||||
|
|||||||
@@ -43,6 +43,7 @@ class _ChooseGroupViewState extends State<ChooseGroupView> {
|
|||||||
final loc = AppLocalizations.of(context);
|
final loc = AppLocalizations.of(context);
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
backgroundColor: CustomTheme.backgroundColor,
|
backgroundColor: CustomTheme.backgroundColor,
|
||||||
|
resizeToAvoidBottomInset: false,
|
||||||
appBar: AppBar(
|
appBar: AppBar(
|
||||||
leading: IconButton(
|
leading: IconButton(
|
||||||
icon: const Icon(Icons.arrow_back_ios),
|
icon: const Icon(Icons.arrow_back_ios),
|
||||||
|
|||||||
@@ -108,6 +108,7 @@ class _CreateMatchViewState extends State<CreateMatchView> {
|
|||||||
final loc = AppLocalizations.of(context);
|
final loc = AppLocalizations.of(context);
|
||||||
return ScaffoldMessenger(
|
return ScaffoldMessenger(
|
||||||
child: Scaffold(
|
child: Scaffold(
|
||||||
|
resizeToAvoidBottomInset: false,
|
||||||
backgroundColor: CustomTheme.backgroundColor,
|
backgroundColor: CustomTheme.backgroundColor,
|
||||||
appBar: AppBar(title: Text(loc.create_new_match)),
|
appBar: AppBar(title: Text(loc.create_new_match)),
|
||||||
body: SafeArea(
|
body: SafeArea(
|
||||||
|
|||||||
@@ -113,6 +113,7 @@ class _CreateGameViewState extends State<CreateGameView> {
|
|||||||
minLines: 6,
|
minLines: 6,
|
||||||
maxLines: 6,
|
maxLines: 6,
|
||||||
maxLength: Constants.MAX_GAME_DESCRIPTION_LENGTH,
|
maxLength: Constants.MAX_GAME_DESCRIPTION_LENGTH,
|
||||||
|
showCounterText: true,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
const Spacer(),
|
const Spacer(),
|
||||||
|
|||||||
@@ -84,6 +84,7 @@ class _PlayerSelectionState extends State<PlayerSelection> {
|
|||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
CustomSearchBar(
|
CustomSearchBar(
|
||||||
|
maxLength: Constants.MAX_PLAYER_NAME_LENGTH,
|
||||||
controller: _searchBarController,
|
controller: _searchBarController,
|
||||||
constraints: const BoxConstraints(maxHeight: 45, minHeight: 45),
|
constraints: const BoxConstraints(maxHeight: 45, minHeight: 45),
|
||||||
hintText: loc.search_for_players,
|
hintText: loc.search_for_players,
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:game_tracker/core/constants.dart';
|
|
||||||
import 'package:game_tracker/core/custom_theme.dart';
|
import 'package:game_tracker/core/custom_theme.dart';
|
||||||
|
|
||||||
class CustomSearchBar extends StatelessWidget {
|
class CustomSearchBar extends StatelessWidget {
|
||||||
@@ -22,6 +21,7 @@ class CustomSearchBar extends StatelessWidget {
|
|||||||
this.onTrailingButtonPressed,
|
this.onTrailingButtonPressed,
|
||||||
this.onChanged,
|
this.onChanged,
|
||||||
this.constraints,
|
this.constraints,
|
||||||
|
this.maxLength,
|
||||||
});
|
});
|
||||||
|
|
||||||
/// The controller for the search bar's text input.
|
/// The controller for the search bar's text input.
|
||||||
@@ -48,16 +48,20 @@ class CustomSearchBar extends StatelessWidget {
|
|||||||
/// The constraints for the search bar.
|
/// The constraints for the search bar.
|
||||||
final BoxConstraints? constraints;
|
final BoxConstraints? constraints;
|
||||||
|
|
||||||
|
/// Optional parameter for maximum length of the input text.
|
||||||
|
final int? maxLength;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
/// Enforce maximum length on the input text
|
/// Enforce maximum length on the input text
|
||||||
const maxLength = Constants.MAX_PLAYER_NAME_LENGTH;
|
if (maxLength != null) {
|
||||||
if (controller.text.length > maxLength) {
|
if (controller.text.length > maxLength!) {
|
||||||
controller.text = controller.text.substring(0, maxLength);
|
controller.text = controller.text.substring(0, maxLength);
|
||||||
controller.selection = TextSelection.fromPosition(
|
controller.selection = TextSelection.fromPosition(
|
||||||
TextPosition(offset: controller.text.length),
|
TextPosition(offset: controller.text.length),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return SearchBar(
|
return SearchBar(
|
||||||
controller: controller,
|
controller: controller,
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter/services.dart';
|
||||||
import 'package:game_tracker/core/custom_theme.dart';
|
import 'package:game_tracker/core/custom_theme.dart';
|
||||||
|
|
||||||
class TextInputField extends StatelessWidget {
|
class TextInputField extends StatelessWidget {
|
||||||
@@ -9,6 +10,7 @@ class TextInputField extends StatelessWidget {
|
|||||||
/// - [maxLength]: Optional parameter for maximum length of the input text.
|
/// - [maxLength]: Optional parameter for maximum length of the input text.
|
||||||
/// - [maxLines]: The maximum number of lines for the text input field. Defaults to 1.
|
/// - [maxLines]: The maximum number of lines for the text input field. Defaults to 1.
|
||||||
/// - [minLines]: The minimum number of lines for the text input field. Defaults to 1.
|
/// - [minLines]: The minimum number of lines for the text input field. Defaults to 1.
|
||||||
|
/// - [showCounterText]: Whether to show the counter text in the text input field. Defaults to false.
|
||||||
const TextInputField({
|
const TextInputField({
|
||||||
super.key,
|
super.key,
|
||||||
required this.controller,
|
required this.controller,
|
||||||
@@ -16,7 +18,8 @@ class TextInputField extends StatelessWidget {
|
|||||||
this.onChanged,
|
this.onChanged,
|
||||||
this.maxLength,
|
this.maxLength,
|
||||||
this.maxLines = 1,
|
this.maxLines = 1,
|
||||||
this.minLines = 1
|
this.minLines = 1,
|
||||||
|
this.showCounterText = false
|
||||||
});
|
});
|
||||||
|
|
||||||
/// The controller for the text input field.
|
/// The controller for the text input field.
|
||||||
@@ -37,6 +40,8 @@ class TextInputField extends StatelessWidget {
|
|||||||
/// The minimum number of lines for the text input field.
|
/// The minimum number of lines for the text input field.
|
||||||
final int? minLines;
|
final int? minLines;
|
||||||
|
|
||||||
|
/// Whether to show the counter text in the text input field.
|
||||||
|
final bool showCounterText;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
@@ -44,6 +49,7 @@ class TextInputField extends StatelessWidget {
|
|||||||
controller: controller,
|
controller: controller,
|
||||||
onChanged: onChanged,
|
onChanged: onChanged,
|
||||||
maxLength: maxLength,
|
maxLength: maxLength,
|
||||||
|
maxLengthEnforcement: MaxLengthEnforcement.truncateAfterCompositionEnds,
|
||||||
maxLines: maxLines,
|
maxLines: maxLines,
|
||||||
minLines: minLines,
|
minLines: minLines,
|
||||||
decoration: InputDecoration(
|
decoration: InputDecoration(
|
||||||
@@ -51,6 +57,7 @@ class TextInputField extends StatelessWidget {
|
|||||||
fillColor: CustomTheme.boxColor,
|
fillColor: CustomTheme.boxColor,
|
||||||
hintText: hintText,
|
hintText: hintText,
|
||||||
hintStyle: const TextStyle(fontSize: 18),
|
hintStyle: const TextStyle(fontSize: 18),
|
||||||
|
counterText: showCounterText ? null : '',
|
||||||
enabledBorder: OutlineInputBorder(
|
enabledBorder: OutlineInputBorder(
|
||||||
borderRadius: const BorderRadius.all(Radius.circular(12)),
|
borderRadius: const BorderRadius.all(Radius.circular(12)),
|
||||||
borderSide: BorderSide(color: CustomTheme.boxBorder),
|
borderSide: BorderSide(color: CustomTheme.boxBorder),
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
name: game_tracker
|
name: game_tracker
|
||||||
description: "Game Tracking App for Card Games"
|
description: "Game Tracking App for Card Games"
|
||||||
publish_to: 'none'
|
publish_to: 'none'
|
||||||
version: 0.0.9+247
|
version: 0.0.10+248
|
||||||
|
|
||||||
environment:
|
environment:
|
||||||
sdk: ^3.8.1
|
sdk: ^3.8.1
|
||||||
|
|||||||
Reference in New Issue
Block a user