mirror of
https://github.com/KRTirtho/spotube.git
synced 2025-12-06 23:39:42 +00:00
fix: alternative track source textfield safe area
This commit is contained in:
parent
5a563ef428
commit
b8c6d7eb6a
@ -122,112 +122,114 @@ class SiblingTracksSheet extends HookConsumerWidget {
|
|||||||
]);
|
]);
|
||||||
|
|
||||||
var mediaQuery = MediaQuery.of(context);
|
var mediaQuery = MediaQuery.of(context);
|
||||||
return BackdropFilter(
|
return SafeArea(
|
||||||
filter: ImageFilter.blur(
|
child: BackdropFilter(
|
||||||
sigmaX: 12.0,
|
filter: ImageFilter.blur(
|
||||||
sigmaY: 12.0,
|
sigmaX: 12.0,
|
||||||
),
|
sigmaY: 12.0,
|
||||||
child: AnimatedSize(
|
),
|
||||||
duration: const Duration(milliseconds: 300),
|
child: AnimatedSize(
|
||||||
child: Container(
|
duration: const Duration(milliseconds: 300),
|
||||||
height: isSearching.value && mediaQuery.smAndDown
|
child: Container(
|
||||||
? mediaQuery.size.height
|
height: isSearching.value && mediaQuery.smAndDown
|
||||||
: mediaQuery.size.height * .6,
|
? mediaQuery.size.height
|
||||||
margin: const EdgeInsets.all(8.0),
|
: mediaQuery.size.height * .6,
|
||||||
decoration: BoxDecoration(
|
margin: const EdgeInsets.all(8.0),
|
||||||
borderRadius: borderRadius,
|
decoration: BoxDecoration(
|
||||||
color: theme.scaffoldBackgroundColor.withOpacity(.3),
|
borderRadius: borderRadius,
|
||||||
),
|
color: theme.scaffoldBackgroundColor.withOpacity(.3),
|
||||||
child: Scaffold(
|
|
||||||
backgroundColor: Colors.transparent,
|
|
||||||
appBar: AppBar(
|
|
||||||
centerTitle: true,
|
|
||||||
title: AnimatedSwitcher(
|
|
||||||
duration: const Duration(milliseconds: 300),
|
|
||||||
child: !isSearching.value
|
|
||||||
? Text(
|
|
||||||
context.l10n.alternative_track_sources,
|
|
||||||
style: theme.textTheme.headlineSmall,
|
|
||||||
)
|
|
||||||
: TextField(
|
|
||||||
autofocus: true,
|
|
||||||
controller: searchController,
|
|
||||||
decoration: InputDecoration(
|
|
||||||
hintText: context.l10n.search,
|
|
||||||
hintStyle: theme.textTheme.headlineSmall,
|
|
||||||
border: InputBorder.none,
|
|
||||||
),
|
|
||||||
style: theme.textTheme.headlineSmall,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
automaticallyImplyLeading: false,
|
|
||||||
backgroundColor: Colors.transparent,
|
|
||||||
actions: [
|
|
||||||
if (!isSearching.value)
|
|
||||||
IconButton(
|
|
||||||
icon: const Icon(SpotubeIcons.search, size: 18),
|
|
||||||
onPressed: () {
|
|
||||||
isSearching.value = true;
|
|
||||||
},
|
|
||||||
)
|
|
||||||
else ...[
|
|
||||||
if (preferences.youtubeApiType == YoutubeApiType.piped)
|
|
||||||
PopupMenuButton(
|
|
||||||
icon: const Icon(SpotubeIcons.filter, size: 18),
|
|
||||||
onSelected: (SearchMode mode) {
|
|
||||||
searchMode.value = mode;
|
|
||||||
},
|
|
||||||
initialValue: searchMode.value,
|
|
||||||
itemBuilder: (context) => SearchMode.values
|
|
||||||
.map(
|
|
||||||
(e) => PopupMenuItem(
|
|
||||||
value: e,
|
|
||||||
child: Text(e.label),
|
|
||||||
),
|
|
||||||
)
|
|
||||||
.toList(),
|
|
||||||
),
|
|
||||||
IconButton(
|
|
||||||
icon: const Icon(SpotubeIcons.close, size: 18),
|
|
||||||
onPressed: () {
|
|
||||||
isSearching.value = false;
|
|
||||||
},
|
|
||||||
),
|
|
||||||
]
|
|
||||||
],
|
|
||||||
),
|
),
|
||||||
body: Padding(
|
child: Scaffold(
|
||||||
padding: const EdgeInsets.all(8.0),
|
backgroundColor: Colors.transparent,
|
||||||
child: AnimatedSwitcher(
|
appBar: AppBar(
|
||||||
duration: const Duration(milliseconds: 300),
|
centerTitle: true,
|
||||||
transitionBuilder: (child, animation) =>
|
title: AnimatedSwitcher(
|
||||||
FadeTransition(opacity: animation, child: child),
|
duration: const Duration(milliseconds: 300),
|
||||||
child: switch (isSearching.value) {
|
child: !isSearching.value
|
||||||
false => ListView.builder(
|
? Text(
|
||||||
itemCount: siblings.length,
|
context.l10n.alternative_track_sources,
|
||||||
itemBuilder: (context, index) =>
|
style: theme.textTheme.headlineSmall,
|
||||||
itemBuilder(siblings[index]),
|
)
|
||||||
),
|
: TextField(
|
||||||
true => FutureBuilder(
|
autofocus: true,
|
||||||
future: searchRequest,
|
controller: searchController,
|
||||||
builder: (context, snapshot) {
|
decoration: InputDecoration(
|
||||||
if (snapshot.hasError) {
|
hintText: context.l10n.search,
|
||||||
return Center(
|
hintStyle: theme.textTheme.headlineSmall,
|
||||||
child: Text(snapshot.error.toString()),
|
border: InputBorder.none,
|
||||||
);
|
),
|
||||||
} else if (!snapshot.hasData) {
|
style: theme.textTheme.headlineSmall,
|
||||||
return const Center(
|
),
|
||||||
child: CircularProgressIndicator());
|
),
|
||||||
}
|
automaticallyImplyLeading: false,
|
||||||
|
backgroundColor: Colors.transparent,
|
||||||
return ListView.builder(
|
actions: [
|
||||||
itemCount: snapshot.data!.length,
|
if (!isSearching.value)
|
||||||
itemBuilder: (context, index) =>
|
IconButton(
|
||||||
itemBuilder(snapshot.data![index]),
|
icon: const Icon(SpotubeIcons.search, size: 18),
|
||||||
);
|
onPressed: () {
|
||||||
|
isSearching.value = true;
|
||||||
|
},
|
||||||
|
)
|
||||||
|
else ...[
|
||||||
|
if (preferences.youtubeApiType == YoutubeApiType.piped)
|
||||||
|
PopupMenuButton(
|
||||||
|
icon: const Icon(SpotubeIcons.filter, size: 18),
|
||||||
|
onSelected: (SearchMode mode) {
|
||||||
|
searchMode.value = mode;
|
||||||
|
},
|
||||||
|
initialValue: searchMode.value,
|
||||||
|
itemBuilder: (context) => SearchMode.values
|
||||||
|
.map(
|
||||||
|
(e) => PopupMenuItem(
|
||||||
|
value: e,
|
||||||
|
child: Text(e.label),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
.toList(),
|
||||||
|
),
|
||||||
|
IconButton(
|
||||||
|
icon: const Icon(SpotubeIcons.close, size: 18),
|
||||||
|
onPressed: () {
|
||||||
|
isSearching.value = false;
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
},
|
]
|
||||||
|
],
|
||||||
|
),
|
||||||
|
body: Padding(
|
||||||
|
padding: const EdgeInsets.all(8.0),
|
||||||
|
child: AnimatedSwitcher(
|
||||||
|
duration: const Duration(milliseconds: 300),
|
||||||
|
transitionBuilder: (child, animation) =>
|
||||||
|
FadeTransition(opacity: animation, child: child),
|
||||||
|
child: switch (isSearching.value) {
|
||||||
|
false => ListView.builder(
|
||||||
|
itemCount: siblings.length,
|
||||||
|
itemBuilder: (context, index) =>
|
||||||
|
itemBuilder(siblings[index]),
|
||||||
|
),
|
||||||
|
true => FutureBuilder(
|
||||||
|
future: searchRequest,
|
||||||
|
builder: (context, snapshot) {
|
||||||
|
if (snapshot.hasError) {
|
||||||
|
return Center(
|
||||||
|
child: Text(snapshot.error.toString()),
|
||||||
|
);
|
||||||
|
} else if (!snapshot.hasData) {
|
||||||
|
return const Center(
|
||||||
|
child: CircularProgressIndicator());
|
||||||
|
}
|
||||||
|
|
||||||
|
return ListView.builder(
|
||||||
|
itemCount: snapshot.data!.length,
|
||||||
|
itemBuilder: (context, index) =>
|
||||||
|
itemBuilder(snapshot.data![index]),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
},
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user