Change dropdown menu UI with custom dropdown widget.

Add scrollbar in libried page.
This commit is contained in:
stonegate 2020-07-09 00:18:32 +08:00
parent c9de380180
commit f1989a0565
10 changed files with 1695 additions and 82 deletions

View File

@ -74,7 +74,7 @@ If no api key added, the search function in the app won't work. But you can stil
* Local storage
- sqflite
- share_preference
- shared_preferences
* Audio
- just_audio
- audio_service

View File

@ -16,7 +16,7 @@ import '../util/pageroute.dart';
import '../util/colorize.dart';
import '../util/context_extension.dart';
import '../util/custompaint.dart';
import '../util/customslider.dart';
import '../util/custom_slider.dart';
import '../episodes/episode_detail.dart';
import 'playlist.dart';
import 'audiopanel.dart';

View File

@ -11,7 +11,7 @@ import 'package:tuple/tuple.dart';
import '../state/audio_state.dart';
import '../util/context_extension.dart';
import '../util/customslider.dart';
import '../util/custom_slider.dart';
import '../util/pageroute.dart';
final List<BoxShadow> _customShadow = [

View File

@ -49,6 +49,7 @@ class _LanguagesSettingState extends State<LanguagesSetting> {
await S.load(Locale(Intl.systemLocale));
setState(() {});
},
contentPadding: const EdgeInsets.only(left: 75, right: 20),
trailing: Radio<Locale>(
value: Locale(Intl.systemLocale),
groupValue: Locale(Intl.getCurrentLocale()),
@ -64,6 +65,7 @@ class _LanguagesSettingState extends State<LanguagesSetting> {
await S.load(Locale('en'));
setState(() {});
},
contentPadding: const EdgeInsets.only(left: 75, right: 20),
trailing: Radio<Locale>(
value: Locale('en'),
groupValue: Locale(Intl.getCurrentLocale()),
@ -79,6 +81,7 @@ class _LanguagesSettingState extends State<LanguagesSetting> {
await S.load(Locale('zh_Hans'));
setState(() {});
},
contentPadding: const EdgeInsets.only(left: 75, right: 20),
trailing: Radio<Locale>(
value: Locale('zh_Hans'),
groupValue: Locale(Intl.getCurrentLocale()),
@ -91,6 +94,7 @@ class _LanguagesSettingState extends State<LanguagesSetting> {
ListTile(
onTap: () => _launchUrl(
'mailto:<tsacdop.app@gmail.com>?subject=Tsacdop localization project'),
contentPadding: const EdgeInsets.only(left: 75, right: 20),
subtitle: Text(
"If you'd like to contribute to support more languages, please contact me."),
trailing: IconButton(

View File

@ -29,84 +29,87 @@ class Libries extends StatelessWidget {
backgroundColor: Theme.of(context).primaryColor,
),
body: SafeArea(
child: SingleChildScrollView(
scrollDirection: Axis.vertical,
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
mainAxisSize: MainAxisSize.min,
children: <Widget>[
Padding(
padding: EdgeInsets.all(10.0),
),
Container(
height: 30.0,
padding: EdgeInsets.symmetric(horizontal: 70),
alignment: Alignment.centerLeft,
child: Text('Google',
style: Theme.of(context)
.textTheme
.bodyText1
.copyWith(color: Theme.of(context).accentColor)),
),
Column(
children: google.map<Widget>(
(e) {
return ListTile(
contentPadding: EdgeInsets.symmetric(horizontal: 80),
onTap: () => _launchUrl(e.link),
title: Text(e.name),
subtitle: Text(e.license),
);
},
).toList(),
),
Container(
height: 30.0,
padding: EdgeInsets.symmetric(horizontal: 70),
alignment: Alignment.centerLeft,
child: Text(context.s.fonts,
style: Theme.of(context)
.textTheme
.bodyText1
.copyWith(color: Theme.of(context).accentColor)),
),
Column(
children: fonts.map<Widget>(
(e) {
return ListTile(
contentPadding: EdgeInsets.symmetric(horizontal: 80),
onTap: () => _launchUrl(e.link),
title: Text(e.name),
subtitle: Text(e.license),
);
},
).toList(),
),
Container(
height: 30.0,
padding: EdgeInsets.symmetric(horizontal: 70),
alignment: Alignment.centerLeft,
child: Text(context.s.plugins,
style: Theme.of(context)
.textTheme
.bodyText1
.copyWith(color: Theme.of(context).accentColor)),
),
Container(
child: Column(
children: plugins.map<Widget>(
child: Scrollbar(
child: SingleChildScrollView(
scrollDirection: Axis.vertical,
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
mainAxisSize: MainAxisSize.min,
children: <Widget>[
Padding(
padding: EdgeInsets.all(10.0),
),
Container(
height: 30.0,
padding: EdgeInsets.symmetric(horizontal: 70),
alignment: Alignment.centerLeft,
child: Text('Google',
style: Theme.of(context)
.textTheme
.bodyText1
.copyWith(color: Theme.of(context).accentColor)),
),
Column(
children: google.map<Widget>(
(e) {
return ListTile(
onTap: () => _launchUrl(e.link),
contentPadding: EdgeInsets.symmetric(horizontal: 80),
onTap: () => _launchUrl(e.link),
title: Text(e.name),
subtitle: Text(e.license),
);
},
).toList(),
),
),
],
Container(
height: 30.0,
padding: EdgeInsets.symmetric(horizontal: 70),
alignment: Alignment.centerLeft,
child: Text(context.s.fonts,
style: Theme.of(context)
.textTheme
.bodyText1
.copyWith(color: Theme.of(context).accentColor)),
),
Column(
children: fonts.map<Widget>(
(e) {
return ListTile(
contentPadding: EdgeInsets.symmetric(horizontal: 80),
onTap: () => _launchUrl(e.link),
title: Text(e.name),
subtitle: Text(e.license),
);
},
).toList(),
),
Container(
height: 30.0,
padding: EdgeInsets.symmetric(horizontal: 70),
alignment: Alignment.centerLeft,
child: Text(context.s.plugins,
style: Theme.of(context)
.textTheme
.bodyText1
.copyWith(color: Theme.of(context).accentColor)),
),
Container(
child: Column(
children: plugins.map<Widget>(
(e) {
return ListTile(
onTap: () => _launchUrl(e.link),
contentPadding:
EdgeInsets.symmetric(horizontal: 80),
title: Text(e.name),
subtitle: Text(e.license),
);
},
).toList(),
),
),
],
),
),
),
),

View File

@ -12,6 +12,7 @@ import '../state/setting_state.dart';
import '../home/audioplayer.dart';
import '../util/general_dialog.dart';
import '../util/context_extension.dart';
import '../util/custom_dropdown.dart';
String stringForMins(int mins) {
if (mins == null) return null;
@ -320,10 +321,11 @@ class PlaySetting extends StatelessWidget {
subtitle: Text(s.settingsSTDefautTimeDes),
trailing: Selector<SettingState, int>(
selector: (_, settings) => settings.defaultSleepTimer,
builder: (_, data, __) => DropdownButton(
builder: (_, data, __) => MyDropdownButton(
hint: Text(s.minsCount(data)),
underline: Center(),
elevation: 1,
displayItemCount: 5,
isDense: true,
value: data,
onChanged: (int value) =>

View File

@ -5,6 +5,7 @@ import 'package:tuple/tuple.dart';
import '../state/setting_state.dart';
import '../util/context_extension.dart';
import '../util/custom_dropdown.dart';
class SyncingSetting extends StatelessWidget {
@override
@ -91,10 +92,11 @@ class SyncingSetting extends StatelessWidget {
const EdgeInsets.only(left: 80.0, right: 20),
title: Text(s.settingsUpdateInterval),
subtitle: Text(s.settingsUpdateIntervalDes),
trailing: DropdownButton(
trailing: MyDropdownButton(
hint: Text(s.hoursCount(data.item2)),
underline: Center(),
elevation: 1,
displayItemCount: 5,
value: data.item2,
onChanged: data.item1
? (value) async {

View File

@ -111,14 +111,14 @@ class GroupList extends ChangeNotifier {
}
}
_initGroup() async {
storage.getGroups().then((loadgroups) async {
_groups.addAll(loadgroups.map((e) => PodcastGroup.fromEntity(e)));
await Future.forEach(_groups, (group) async {
await group.getPodcasts();
});
});
}
// _initGroup() async {
// storage.getGroups().then((loadgroups) async {
// _groups.addAll(loadgroups.map((e) => PodcastGroup.fromEntity(e)));
// await Future.forEach(_groups, (group) async {
// await group.getPodcasts();
// });
// });
// }
@override
void addListener(VoidCallback listener) {

File diff suppressed because it is too large Load Diff