Change search cursor color

This commit is contained in:
stonegate 2020-05-26 15:21:14 +08:00
parent e7c175fef2
commit 8ec1793843
3 changed files with 46 additions and 42 deletions

View File

@ -19,15 +19,17 @@ import '../.env.dart';
class MyHomePageDelegate extends SearchDelegate<int> { class MyHomePageDelegate extends SearchDelegate<int> {
final String searchFieldLabel; final String searchFieldLabel;
MyHomePageDelegate({this.searchFieldLabel}) MyHomePageDelegate({this.searchFieldLabel})
: super(searchFieldLabel: searchFieldLabel); : super(
searchFieldLabel: searchFieldLabel,
);
static Future<List> getList(String searchText) async { static Future<List> getList(String searchText) async {
String apiKey = environment['apiKey']; String apiKey = environment['apiKey'];
String url = String url =
"https://listennotes.p.rapidapi.com/api/v1/search?only_in=title%2Cdescription&q=" + "https://listennotes.p.rapidapi.com/api/v1/search?only_in=title%2Cdescription&q=" +
"$searchText&sort_by_date=0&type=podcast"; "$searchText&type=podcast";
Response response = await Dio().get(url, Response response = await Dio().get(url,
options: Options(headers: { options: Options(headers: {
'X-Mashape-Key': "$apiKey", 'X-RapidAPI-Key': "$apiKey",
'Accept': "application/json" 'Accept': "application/json"
})); }));
Map searchResultMap = jsonDecode(response.toString()); Map searchResultMap = jsonDecode(response.toString());

View File

@ -33,8 +33,9 @@ class Home extends StatefulWidget {
} }
class _HomeState extends State<Home> with SingleTickerProviderStateMixin { class _HomeState extends State<Home> with SingleTickerProviderStateMixin {
final MyHomePageDelegate _delegate = final MyHomePageDelegate _delegate = MyHomePageDelegate(
MyHomePageDelegate(searchFieldLabel: 'Search podcast'); searchFieldLabel: 'Search podcast',
);
final GlobalKey<ScaffoldState> _scaffoldKey = GlobalKey<ScaffoldState>(); final GlobalKey<ScaffoldState> _scaffoldKey = GlobalKey<ScaffoldState>();
TabController _controller; TabController _controller;
@ -456,9 +457,10 @@ class _RecentUpdateState extends State<_RecentUpdate>
if (snapshot.hasError) print(snapshot.error); if (snapshot.hasError) print(snapshot.error);
return (snapshot.hasData) return (snapshot.hasData)
? snapshot.data.length == 0 ? snapshot.data.length == 0
? Center( ? Padding(
padding: EdgeInsets.only(top: 150),
child: Column( child: Column(
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.start,
children: [ children: [
Icon(LineIcons.cloud_download_alt_solid, Icon(LineIcons.cloud_download_alt_solid,
size: 80, color: Colors.grey[500]), size: 80, color: Colors.grey[500]),
@ -748,9 +750,10 @@ class _MyFavoriteState extends State<_MyFavorite>
if (snapshot.hasError) print(snapshot.error); if (snapshot.hasError) print(snapshot.error);
return (snapshot.hasData) return (snapshot.hasData)
? snapshot.data.length == 0 ? snapshot.data.length == 0
? Center( ? Padding(
padding: EdgeInsets.only(top: 150),
child: Column( child: Column(
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.start,
children: [ children: [
Icon(LineIcons.heartbeat_solid, Icon(LineIcons.heartbeat_solid,
size: 80, color: Colors.grey[500]), size: 80, color: Colors.grey[500]),
@ -971,31 +974,29 @@ class _MyDownloadState extends State<_MyDownload>
.toList() .toList()
.reversed .reversed
.toList(); .toList();
return return episodes.length == 0
//episodes.length == 0 ? SliverToBoxAdapter(
// ? SliverToBoxAdapter( child: Padding(
// child: Padding( padding: EdgeInsets.only(top: 110),
// padding: EdgeInsets.only(top: 100), child: Column(
// child: Column( mainAxisAlignment: MainAxisAlignment.start,
// mainAxisAlignment: MainAxisAlignment.center, children: [
// children: [ Icon(LineIcons.download_solid,
// Icon(LineIcons.download_solid, size: 80, color: Colors.grey[500]),
// size: 80, color: Colors.grey[500]), Padding(padding: EdgeInsets.symmetric(vertical: 10)),
// Padding(padding: EdgeInsets.symmetric(vertical: 10)), Text(
// Text( 'No episode downloaded yet',
// 'No episode collected yet', style: TextStyle(color: Colors.grey[500]),
// style: TextStyle(color: Colors.grey[500]), )
// ) ],
// ], ),
// ), ),
// ), )
// ) : EpisodeGrid(
// : episodes: episodes,
EpisodeGrid( layout: _layout,
episodes: episodes, initNum: 0,
layout: _layout, );
initNum: 0,
);
}, },
), ),
], ],

View File

@ -55,16 +55,17 @@ class MyApp extends StatelessWidget {
title: 'Tsacdop', title: 'Tsacdop',
theme: lightTheme.copyWith( theme: lightTheme.copyWith(
accentColor: setting.accentSetColor, accentColor: setting.accentSetColor,
cursorColor: setting.accentSetColor,
toggleableActiveColor: setting.accentSetColor), toggleableActiveColor: setting.accentSetColor),
darkTheme: ThemeData.dark().copyWith( darkTheme: ThemeData.dark().copyWith(
accentColor: setting.accentSetColor, accentColor: setting.accentSetColor,
primaryColorDark: Colors.grey[800], primaryColorDark: Colors.grey[800],
scaffoldBackgroundColor: setting.realDark ? Colors.black87 : null, scaffoldBackgroundColor: setting.realDark ? Colors.black87 : null,
primaryColor: setting.realDark ? Colors.black : null, primaryColor: setting.realDark ? Colors.black : null,
popupMenuTheme: PopupMenuThemeData() popupMenuTheme: PopupMenuThemeData()
.copyWith(color: setting.realDark ? Colors.black87 : null), .copyWith(color: setting.realDark ? Colors.black87 : null),
appBarTheme: AppBarTheme(elevation: 0), appBarTheme: AppBarTheme(elevation: 0),
), cursorColor: setting.accentSetColor),
localizationsDelegates: [ localizationsDelegates: [
S.delegate, S.delegate,
GlobalMaterialLocalizations.delegate, GlobalMaterialLocalizations.delegate,