Add adaptive widgets & icons
This commit is contained in:
parent
a6688a992c
commit
9007cd9d9f
5 changed files with 22 additions and 19 deletions
|
|
@ -21,14 +21,14 @@ class Settings extends StatelessWidget {
|
|||
return ListView(
|
||||
children: [
|
||||
ProfileCard(authStore: context.read<AuthStore>()),
|
||||
SwitchListTile(
|
||||
SwitchListTile.adaptive(
|
||||
title: const Text('Enable Video'),
|
||||
value: settingsStore.videoEnabled,
|
||||
onChanged: (newValue) => settingsStore.videoEnabled = newValue,
|
||||
),
|
||||
ListTile(
|
||||
title: const Text('Chat Message Limit'),
|
||||
subtitle: Slider(
|
||||
title: Text('Chat Message Limit: ${settingsStore.messageLimit}'),
|
||||
subtitle: Slider.adaptive(
|
||||
value: settingsStore.messageLimit,
|
||||
onChanged: (newValue) => settingsStore.messageLimit = newValue,
|
||||
min: 200,
|
||||
|
|
|
|||
|
|
@ -71,7 +71,7 @@ class MyApp extends StatelessWidget {
|
|||
searchStore: SearchStore(authStore: authStore),
|
||||
);
|
||||
}
|
||||
return const Center(child: CircularProgressIndicator());
|
||||
return const Center(child: CircularProgressIndicator.adaptive());
|
||||
},
|
||||
),
|
||||
),
|
||||
|
|
|
|||
|
|
@ -63,7 +63,7 @@ class _ChatState extends State<Chat> {
|
|||
Row(
|
||||
children: [
|
||||
IconButton(
|
||||
icon: const Icon(Icons.stacked_bar_chart),
|
||||
icon: Icon(Icons.adaptive.more),
|
||||
onPressed: () {
|
||||
showModalBottomSheet(
|
||||
context: context,
|
||||
|
|
@ -100,7 +100,7 @@ class _ChatState extends State<Chat> {
|
|||
);
|
||||
}
|
||||
return const Center(
|
||||
child: CircularProgressIndicator(),
|
||||
child: CircularProgressIndicator.adaptive(),
|
||||
);
|
||||
},
|
||||
);
|
||||
|
|
|
|||
|
|
@ -73,7 +73,7 @@ class Home extends StatelessWidget {
|
|||
if (context.read<AuthStore>().isLoggedIn) FollowedStreams(store: followedStreamsStore),
|
||||
TopStreams(store: topStreamsStore),
|
||||
Categories(store: categoriesStore),
|
||||
Search(store: searchStore),
|
||||
Search(searchStore: searchStore),
|
||||
],
|
||||
);
|
||||
},
|
||||
|
|
|
|||
|
|
@ -1,14 +1,16 @@
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_mobx/flutter_mobx.dart';
|
||||
import 'package:frosty/models/channel.dart';
|
||||
import 'package:frosty/screens/channel/video_chat.dart';
|
||||
import 'package:frosty/screens/search/search_store.dart';
|
||||
import 'package:mobx/mobx.dart';
|
||||
|
||||
class Search extends StatefulWidget {
|
||||
final SearchStore store;
|
||||
final SearchStore searchStore;
|
||||
|
||||
const Search({
|
||||
Key? key,
|
||||
required this.store,
|
||||
required this.searchStore,
|
||||
}) : super(key: key);
|
||||
|
||||
@override
|
||||
|
|
@ -18,12 +20,13 @@ class Search extends StatefulWidget {
|
|||
class _SearchState extends State<Search> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final searchStore = widget.searchStore;
|
||||
return Column(
|
||||
children: [
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(vertical: 5.0, horizontal: 10.0),
|
||||
child: TextField(
|
||||
controller: widget.store.textController,
|
||||
controller: searchStore.textController,
|
||||
autocorrect: false,
|
||||
decoration: const InputDecoration(
|
||||
isDense: true,
|
||||
|
|
@ -33,28 +36,28 @@ class _SearchState extends State<Search> {
|
|||
),
|
||||
hintText: 'Search for a channel',
|
||||
),
|
||||
onSubmitted: widget.store.handleQuery,
|
||||
onSubmitted: searchStore.handleQuery,
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
child: RefreshIndicator(
|
||||
onRefresh: () => widget.store.handleQuery(widget.store.textController.text),
|
||||
onRefresh: () => searchStore.handleQuery(searchStore.textController.text),
|
||||
child: Observer(
|
||||
builder: (_) {
|
||||
return ListView.builder(
|
||||
itemCount: widget.store.searchResults.length + 1,
|
||||
itemCount: searchStore.searchResults.length + 1,
|
||||
itemBuilder: (context, index) {
|
||||
if (index == widget.store.searchResults.length) {
|
||||
if (widget.store.textController.text.isEmpty) {
|
||||
if (index == searchStore.searchResults.length) {
|
||||
if (searchStore.textController.text.isEmpty) {
|
||||
return const SizedBox();
|
||||
}
|
||||
return ListTile(
|
||||
title: Text('Go to ${widget.store.textController.text}'),
|
||||
onTap: () => widget.store.handleSearch(widget.store.textController.text, context),
|
||||
title: Text('Go to ${searchStore.textController.text}'),
|
||||
onTap: () => searchStore.handleSearch(searchStore.textController.text, context),
|
||||
);
|
||||
}
|
||||
|
||||
final channel = widget.store.searchResults[index];
|
||||
final channel = searchStore.searchResults[index];
|
||||
return ListTile(
|
||||
title: Text(channel.displayName),
|
||||
trailing: channel.isLive
|
||||
|
|
@ -99,7 +102,7 @@ class _SearchState extends State<Search> {
|
|||
|
||||
@override
|
||||
void dispose() {
|
||||
widget.store.dispose();
|
||||
widget.searchStore.dispose();
|
||||
super.dispose();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue