Implemented constants
All checks were successful
Pull Request Pipeline / test (pull_request) Successful in 2m41s
Pull Request Pipeline / lint (pull_request) Successful in 2m45s

This commit is contained in:
2026-01-16 21:52:58 +01:00
parent b7930d5e2e
commit 783f772da1
5 changed files with 21 additions and 1 deletions

View File

@@ -1,4 +1,5 @@
import 'package:flutter/material.dart';
import 'package:game_tracker/core/constants.dart';
import 'package:game_tracker/core/custom_theme.dart';
class CustomSearchBar extends StatelessWidget {
@@ -49,6 +50,15 @@ class CustomSearchBar extends StatelessWidget {
@override
Widget build(BuildContext context) {
/// Enforce maximum length on the input text
const maxLength = Constants.MAX_PLAYER_NAME_LENGTH;
if (controller.text.length > maxLength) {
controller.text = controller.text.substring(0, maxLength);
controller.selection = TextSelection.fromPosition(
TextPosition(offset: controller.text.length),
);
}
return SearchBar(
controller: controller,
constraints: