Add refreshable search & padding tweaks
This commit is contained in:
parent
d1bd25eebf
commit
812ab8a3a3
4 changed files with 56 additions and 55 deletions
|
|
@ -26,7 +26,7 @@ class _SearchState extends State<Search> {
|
|||
return Column(
|
||||
children: [
|
||||
Padding(
|
||||
padding: const EdgeInsets.all(10.0),
|
||||
padding: const EdgeInsets.symmetric(vertical: 5.0, horizontal: 10.0),
|
||||
child: TextField(
|
||||
controller: searchStore.textController,
|
||||
autocorrect: false,
|
||||
|
|
@ -42,56 +42,60 @@ class _SearchState extends State<Search> {
|
|||
),
|
||||
),
|
||||
Expanded(
|
||||
child: Observer(
|
||||
builder: (_) {
|
||||
return ListView.builder(
|
||||
itemCount: searchStore.searchResults.length + 1,
|
||||
itemBuilder: (context, index) {
|
||||
if (index == searchStore.searchResults.length) {
|
||||
if (searchStore.textController.text.isEmpty) {
|
||||
return const SizedBox();
|
||||
}
|
||||
return ListTile(
|
||||
title: Text('Go to ${searchStore.textController.text}'),
|
||||
onTap: () => searchStore.handleSearch(searchStore.textController.text, context),
|
||||
);
|
||||
}
|
||||
|
||||
final channel = searchStore.searchResults[index];
|
||||
return ListTile(
|
||||
title: Text(channel.displayName),
|
||||
trailing: channel.isLive
|
||||
? ClipRRect(
|
||||
borderRadius: BorderRadius.circular(5.0),
|
||||
child: Container(
|
||||
color: Colors.red,
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: const Text(
|
||||
'LIVE',
|
||||
style: TextStyle(fontWeight: FontWeight.bold),
|
||||
),
|
||||
),
|
||||
)
|
||||
: null,
|
||||
subtitle: channel.isLive ? Text('Uptime: ${DateTime.now().difference(DateTime.parse(channel.startedAt)).toString().split('.')[0]}') : null,
|
||||
onTap: () {
|
||||
Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(
|
||||
builder: (_) {
|
||||
return VideoChat(
|
||||
title: channel.title,
|
||||
userName: channel.displayName,
|
||||
userLogin: channel.broadcasterLogin,
|
||||
);
|
||||
},
|
||||
),
|
||||
child: RefreshIndicator(
|
||||
onRefresh: () => searchStore.handleQuery(searchStore.textController.text),
|
||||
child: Observer(
|
||||
builder: (_) {
|
||||
return ListView.builder(
|
||||
itemCount: searchStore.searchResults.length + 1,
|
||||
itemBuilder: (context, index) {
|
||||
if (index == searchStore.searchResults.length) {
|
||||
if (searchStore.textController.text.isEmpty) {
|
||||
return const SizedBox();
|
||||
}
|
||||
return ListTile(
|
||||
title: Text('Go to ${searchStore.textController.text}'),
|
||||
onTap: () => searchStore.handleSearch(searchStore.textController.text, context),
|
||||
);
|
||||
},
|
||||
);
|
||||
},
|
||||
);
|
||||
},
|
||||
}
|
||||
|
||||
final channel = searchStore.searchResults[index];
|
||||
return ListTile(
|
||||
title: Text(channel.displayName),
|
||||
trailing: channel.isLive
|
||||
? ClipRRect(
|
||||
borderRadius: BorderRadius.circular(5.0),
|
||||
child: Container(
|
||||
color: Colors.red,
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: const Text(
|
||||
'LIVE',
|
||||
style: TextStyle(fontWeight: FontWeight.bold),
|
||||
),
|
||||
),
|
||||
)
|
||||
: null,
|
||||
subtitle:
|
||||
channel.isLive ? Text('Uptime: ${DateTime.now().difference(DateTime.parse(channel.startedAt)).toString().split('.')[0]}') : null,
|
||||
onTap: () {
|
||||
Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(
|
||||
builder: (_) {
|
||||
return VideoChat(
|
||||
title: channel.title,
|
||||
userName: channel.displayName,
|
||||
userLogin: channel.broadcasterLogin,
|
||||
);
|
||||
},
|
||||
),
|
||||
);
|
||||
},
|
||||
);
|
||||
},
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
|
|
|
|||
|
|
@ -76,7 +76,7 @@ class _ChatState extends State<Chat> {
|
|||
if (context.read<AuthStore>().isLoggedIn)
|
||||
Expanded(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(5.0),
|
||||
padding: const EdgeInsets.symmetric(vertical: 5.0, horizontal: 10.0),
|
||||
child: TextField(
|
||||
decoration: const InputDecoration(
|
||||
isDense: true,
|
||||
|
|
|
|||
|
|
@ -30,8 +30,6 @@ class StreamCard extends StatelessWidget {
|
|||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(vertical: 10.0, horizontal: 15.0),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
Flexible(
|
||||
flex: 1,
|
||||
|
|
@ -73,7 +71,6 @@ class StreamCard extends StatelessWidget {
|
|||
const SizedBox(height: 5),
|
||||
Text(
|
||||
streamInfo.gameName,
|
||||
style: const TextStyle(fontSize: 12),
|
||||
),
|
||||
const SizedBox(height: 5),
|
||||
Text(
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ class StreamList extends StatelessWidget {
|
|||
if (index > streamListStore.streams(category: category).length / 2 && streamListStore.hasMore(category: category)) {
|
||||
streamListStore.getStreams(category: category);
|
||||
}
|
||||
return StreamCard(streamInfo: streamListStore.streams(category: category).elementAt(index));
|
||||
return StreamCard(streamInfo: streamListStore.streams(category: category)[index]);
|
||||
},
|
||||
);
|
||||
},
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue