created widgets for search bar list tile, selected tile and text input field in create groups view

This commit is contained in:
2025-11-18 20:09:57 +01:00
parent 05c41707ca
commit 1882d0007b
4 changed files with 160 additions and 0 deletions

View File

@@ -0,0 +1,36 @@
import 'package:flutter/material.dart';
import 'package:game_tracker/core/custom_theme.dart';
class CustomSearchBar extends StatelessWidget {
final TextEditingController controller;
final String hintText;
final ValueChanged<String>? onChanged;
final BoxConstraints? constraints;
const CustomSearchBar({
super.key,
required this.controller,
required this.hintText,
this.onChanged,
this.constraints,
});
@override
Widget build(BuildContext context) {
return SearchBar(
controller: controller,
constraints:
constraints ?? const BoxConstraints(maxHeight: 45, minHeight: 45),
hintText: hintText,
onChanged: onChanged,
hintStyle: MaterialStateProperty.all(const TextStyle(fontSize: 16)),
leading: const Icon(Icons.search),
backgroundColor: MaterialStateProperty.all(CustomTheme.boxColor),
side: MaterialStateProperty.all(BorderSide(color: CustomTheme.boxBorder)),
shape: MaterialStateProperty.all(
RoundedRectangleBorder(borderRadius: BorderRadius.circular(12)),
),
elevation: MaterialStateProperty.all(0),
);
}
}

View File

@@ -0,0 +1,38 @@
import 'package:flutter/material.dart';
import 'package:game_tracker/core/custom_theme.dart';
class TextInputField extends StatelessWidget {
final TextEditingController controller;
final ValueChanged<String>? onChanged;
final String hintText;
const TextInputField({
super.key,
required this.controller,
required this.hintText,
this.onChanged,
});
@override
Widget build(BuildContext context) {
return TextField(
controller: controller,
onChanged: onChanged,
decoration: InputDecoration(
filled: true,
fillColor: CustomTheme.boxColor,
hintText: hintText,
hintStyle: const TextStyle(fontSize: 18),
enabledBorder: OutlineInputBorder(
borderRadius: const BorderRadius.all(Radius.circular(12)),
borderSide: BorderSide(color: CustomTheme.boxBorder),
),
focusedBorder: OutlineInputBorder(
borderRadius: const BorderRadius.all(Radius.circular(12)),
borderSide: BorderSide(color: CustomTheme.boxBorder),
),
floatingLabelBehavior: FloatingLabelBehavior.never,
),
);
}
}

View File

@@ -0,0 +1,42 @@
import 'package:flutter/material.dart';
import 'package:game_tracker/core/custom_theme.dart';
class IconListTile extends StatelessWidget {
final String text;
final IconData icon;
final VoidCallback onPressed;
const IconListTile({
super.key,
required this.text,
required this.icon,
required this.onPressed,
});
@override
Widget build(BuildContext context) {
return Container(
margin: const EdgeInsets.symmetric(horizontal: 5, vertical: 5),
padding: const EdgeInsets.symmetric(horizontal: 10),
decoration: BoxDecoration(
color: CustomTheme.boxColor,
border: Border.all(color: CustomTheme.boxBorder),
borderRadius: BorderRadius.circular(12),
),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
mainAxisSize: MainAxisSize.max,
children: [
Flexible(
child: Text(
text,
overflow: TextOverflow.ellipsis,
style: const TextStyle(fontSize: 16, fontWeight: FontWeight.w500),
),
),
IconButton(icon: Icon(icon, size: 20), onPressed: onPressed),
],
),
);
}
}

View File

@@ -0,0 +1,44 @@
import 'package:flutter/material.dart';
import 'package:game_tracker/core/custom_theme.dart';
class TextIconTile extends StatelessWidget {
final String text;
final IconData? icon;
final VoidCallback? onIconTap;
const TextIconTile({
super.key,
required this.text,
this.icon,
this.onIconTap,
});
@override
Widget build(BuildContext context) {
return Container(
padding: const EdgeInsets.all(5),
decoration: BoxDecoration(
color: CustomTheme.onBoxColor,
borderRadius: BorderRadius.circular(12),
),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
mainAxisSize: MainAxisSize.min,
children: [
if (icon != null) const SizedBox(width: 3),
Flexible(
child: Text(
text,
overflow: TextOverflow.ellipsis,
style: const TextStyle(fontSize: 14, fontWeight: FontWeight.w500),
),
),
if (icon != null) ...<Widget>[
const SizedBox(width: 3),
GestureDetector(onTap: onIconTap, child: Icon(icon, size: 20)),
],
],
),
);
}
}