Minor changes
This commit is contained in:
parent
d016ec4106
commit
ec8f4a4b25
2 changed files with 23 additions and 15 deletions
|
@ -41,6 +41,7 @@ class _MainPage extends State<MainPage> {
|
|||
onPressed: () => _key.currentState!.openDrawer(),
|
||||
),
|
||||
),
|
||||
resizeToAvoidBottomInset: false,
|
||||
drawer: Drawer(
|
||||
child: ListView(
|
||||
padding: EdgeInsets.zero,
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:gitea_client/cubit/search_bloc.dart';
|
||||
|
||||
|
@ -10,6 +11,7 @@ class SearchList extends StatefulWidget {
|
|||
final SavedUser user;
|
||||
|
||||
const SearchList({Key? key, required this.user}) : super(key: key);
|
||||
|
||||
@override
|
||||
_SearchListState createState() => _SearchListState();
|
||||
}
|
||||
|
@ -22,12 +24,14 @@ class _SearchListState extends State<SearchList> {
|
|||
super.initState();
|
||||
_scrollController.addListener(_onScroll);
|
||||
}
|
||||
|
||||
BuildContext? blocContex;
|
||||
final search = TextEditingController();
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final media = MediaQuery.of(context).size;
|
||||
final padding = MediaQuery.of(context).viewPadding;
|
||||
return Column(
|
||||
children: [
|
||||
Text(
|
||||
|
@ -40,12 +44,9 @@ class _SearchListState extends State<SearchList> {
|
|||
),
|
||||
controller: search,
|
||||
onChanged: (text) {
|
||||
|
||||
if (blocContex != null) {
|
||||
print("Input: ${search.text}");
|
||||
blocContex!
|
||||
.read<SearchBloc>()
|
||||
.add(SearchInputEvent(search.text));
|
||||
blocContex!.read<SearchBloc>().add(SearchInputEvent(search.text));
|
||||
}
|
||||
},
|
||||
),
|
||||
|
@ -64,13 +65,17 @@ class _SearchListState extends State<SearchList> {
|
|||
context.read<SearchBloc>().add(SearchFetchedEvent());
|
||||
}
|
||||
return SizedBox(
|
||||
height: media.height -kToolbarHeight-130,// Approximate height of search form
|
||||
height: media.height - kToolbarHeight - 130,
|
||||
// Approximate height of search form
|
||||
child: ListView.builder(
|
||||
shrinkWrap: true,
|
||||
itemBuilder: (BuildContext context, int index) {
|
||||
return index >= state.repos.length
|
||||
? BottomLoader()
|
||||
: RepoListItem(repo: state.repos[index],user: widget.user,);
|
||||
: RepoListItem(
|
||||
repo: state.repos[index],
|
||||
user: widget.user,
|
||||
);
|
||||
},
|
||||
itemCount: state.hasReachedMax
|
||||
? state.repos.length
|
||||
|
@ -123,13 +128,14 @@ class BottomLoader extends StatelessWidget {
|
|||
}
|
||||
|
||||
class RepoListItem extends StatelessWidget {
|
||||
const RepoListItem({Key? key, required this.repo, required this.user}) : super(key: key);
|
||||
const RepoListItem({Key? key, required this.repo, required this.user})
|
||||
: super(key: key);
|
||||
|
||||
final Repository repo;
|
||||
final SavedUser user;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
|
||||
return Material(
|
||||
child: Container(
|
||||
color: (repo.private!) ? Colors.yellow[100] : Colors.white,
|
||||
|
@ -157,7 +163,8 @@ class RepoListItem extends StatelessWidget {
|
|||
),
|
||||
dense: true,
|
||||
onTap: () => {
|
||||
Navigator.pushNamed(context, "/repopage",arguments: RepoUser(repo,user))
|
||||
Navigator.pushNamed(context, "/repopage",
|
||||
arguments: RepoUser(repo, user))
|
||||
},
|
||||
),
|
||||
),
|
||||
|
|
Loading…
Reference in a new issue