Added searchbar for choose_group_view
This commit is contained in:
@@ -1,6 +1,7 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:game_tracker/core/custom_theme.dart';
|
import 'package:game_tracker/core/custom_theme.dart';
|
||||||
import 'package:game_tracker/data/dto/group.dart';
|
import 'package:game_tracker/data/dto/group.dart';
|
||||||
|
import 'package:game_tracker/presentation/widgets/text_input/custom_search_bar.dart';
|
||||||
import 'package:game_tracker/presentation/widgets/tiles/group_tile.dart';
|
import 'package:game_tracker/presentation/widgets/tiles/group_tile.dart';
|
||||||
|
|
||||||
class ChooseGroupView extends StatefulWidget {
|
class ChooseGroupView extends StatefulWidget {
|
||||||
@@ -19,6 +20,8 @@ class ChooseGroupView extends StatefulWidget {
|
|||||||
|
|
||||||
class _ChooseGroupViewState extends State<ChooseGroupView> {
|
class _ChooseGroupViewState extends State<ChooseGroupView> {
|
||||||
late int selectedGroupIndex;
|
late int selectedGroupIndex;
|
||||||
|
final TextEditingController controller = TextEditingController();
|
||||||
|
final String hintText = 'Group Name';
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
@@ -49,26 +52,36 @@ class _ChooseGroupViewState extends State<ChooseGroupView> {
|
|||||||
),
|
),
|
||||||
centerTitle: true,
|
centerTitle: true,
|
||||||
),
|
),
|
||||||
body: ListView.builder(
|
body: Column(
|
||||||
padding: const EdgeInsets.only(bottom: 85),
|
children: [
|
||||||
itemCount: widget.groups.length,
|
Padding(
|
||||||
itemBuilder: (BuildContext context, int index) {
|
padding: const EdgeInsets.symmetric(horizontal: 10),
|
||||||
return GestureDetector(
|
child: CustomSearchBar(controller: controller, hintText: hintText),
|
||||||
onTap: () {
|
),
|
||||||
setState(() {
|
Expanded(
|
||||||
if (selectedGroupIndex == index) {
|
child: ListView.builder(
|
||||||
selectedGroupIndex = -1;
|
padding: const EdgeInsets.only(bottom: 85),
|
||||||
} else {
|
itemCount: widget.groups.length,
|
||||||
selectedGroupIndex = index;
|
itemBuilder: (BuildContext context, int index) {
|
||||||
}
|
return GestureDetector(
|
||||||
});
|
onTap: () {
|
||||||
},
|
setState(() {
|
||||||
child: GroupTile(
|
if (selectedGroupIndex == index) {
|
||||||
group: widget.groups[index],
|
selectedGroupIndex = -1;
|
||||||
isHighlighted: selectedGroupIndex == index,
|
} else {
|
||||||
|
selectedGroupIndex = index;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
child: GroupTile(
|
||||||
|
group: widget.groups[index],
|
||||||
|
isHighlighted: selectedGroupIndex == index,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
},
|
||||||
),
|
),
|
||||||
);
|
),
|
||||||
},
|
],
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user