mirror of
https://github.com/simon-ding/polaris.git
synced 2026-05-28 05:27:41 +08:00
feat: change layout and periodically refresh api
This commit is contained in:
@@ -11,6 +11,8 @@ var activitiesDataProvider =
|
|||||||
class ActivityData extends AutoDisposeAsyncNotifier<List<Activity>> {
|
class ActivityData extends AutoDisposeAsyncNotifier<List<Activity>> {
|
||||||
@override
|
@override
|
||||||
FutureOr<List<Activity>> build() async {
|
FutureOr<List<Activity>> build() async {
|
||||||
|
Timer(const Duration(seconds: 5), ref.invalidateSelf);//Periodically Refresh
|
||||||
|
|
||||||
final dio = await APIs.getDio();
|
final dio = await APIs.getDio();
|
||||||
var resp = await dio.get(APIs.activityUrl);
|
var resp = await dio.get(APIs.activityUrl);
|
||||||
final sp = ServerResponse.fromJson(resp.data);
|
final sp = ServerResponse.fromJson(resp.data);
|
||||||
|
|||||||
@@ -113,77 +113,85 @@ class _TvDetailsPageState extends ConsumerState<TvDetailsPage> {
|
|||||||
Card(
|
Card(
|
||||||
margin: const EdgeInsets.all(4),
|
margin: const EdgeInsets.all(4),
|
||||||
clipBehavior: Clip.hardEdge,
|
clipBehavior: Clip.hardEdge,
|
||||||
child: Row(
|
child: Padding(
|
||||||
children: <Widget>[
|
padding: const EdgeInsets.all(10),
|
||||||
Flexible(
|
child: Row(
|
||||||
flex: 1,
|
children: <Widget>[
|
||||||
child: Image.network(
|
Flexible(
|
||||||
"${APIs.imagesUrl}/${details.id}/poster.jpg",
|
flex: 1,
|
||||||
fit: BoxFit.contain,
|
child: Padding(
|
||||||
headers: APIs.authHeaders,
|
padding: EdgeInsets.all(10),
|
||||||
|
child: Image.network(
|
||||||
|
"${APIs.imagesUrl}/${details.id}/poster.jpg",
|
||||||
|
fit: BoxFit.contain,
|
||||||
|
headers: APIs.authHeaders,
|
||||||
|
),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
Expanded(
|
||||||
Expanded(
|
flex: 6,
|
||||||
flex: 6,
|
child: Row(
|
||||||
child: Row(
|
children: [
|
||||||
children: [
|
Expanded(
|
||||||
Expanded(
|
child: Column(
|
||||||
child: Column(
|
crossAxisAlignment:
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
Row(
|
Row(
|
||||||
children: [
|
children: [
|
||||||
Text("${details.resolution}"),
|
Text("${details.resolution}"),
|
||||||
const SizedBox(
|
const SizedBox(
|
||||||
width: 30,
|
width: 30,
|
||||||
),
|
),
|
||||||
storage.when(
|
storage.when(
|
||||||
data: (value) {
|
data: (value) {
|
||||||
for (final s in value) {
|
for (final s in value) {
|
||||||
if (s.id == details.storageId) {
|
if (s.id ==
|
||||||
return Text(
|
details.storageId) {
|
||||||
"${s.name}(${s.implementation})");
|
return Text(
|
||||||
|
"${s.name}(${s.implementation})");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
return const Text("未知存储");
|
||||||
return const Text("未知存储");
|
},
|
||||||
},
|
error: (error, stackTrace) =>
|
||||||
error: (error, stackTrace) =>
|
Text("$error"),
|
||||||
Text("$error"),
|
loading: () =>
|
||||||
loading: () =>
|
const MyProgressIndicator()),
|
||||||
const MyProgressIndicator()),
|
],
|
||||||
],
|
),
|
||||||
),
|
const Divider(thickness: 1, height: 1),
|
||||||
const Divider(thickness: 1, height: 1),
|
Text(
|
||||||
Text(
|
"${details.name} (${details.airDate!.split("-")[0]})",
|
||||||
"${details.name} (${details.airDate!.split("-")[0]})",
|
style: const TextStyle(
|
||||||
style: const TextStyle(
|
fontSize: 20,
|
||||||
fontSize: 20,
|
fontWeight: FontWeight.bold),
|
||||||
fontWeight: FontWeight.bold),
|
),
|
||||||
),
|
const Text(""),
|
||||||
const Text(""),
|
Text(
|
||||||
Text(
|
details!.overview!,
|
||||||
details!.overview!,
|
),
|
||||||
),
|
],
|
||||||
],
|
)),
|
||||||
)),
|
Column(
|
||||||
Column(
|
children: [
|
||||||
children: [
|
IconButton(
|
||||||
IconButton(
|
onPressed: () {
|
||||||
onPressed: () {
|
ref
|
||||||
ref
|
.read(seriesDetailsProvider(
|
||||||
.read(seriesDetailsProvider(
|
seriesId)
|
||||||
seriesId)
|
.notifier)
|
||||||
.notifier)
|
.delete();
|
||||||
.delete();
|
context.go(WelcomePage.route);
|
||||||
context.go(WelcomePage.route);
|
},
|
||||||
},
|
icon: const Icon(Icons.delete))
|
||||||
icon: const Icon(Icons.delete))
|
],
|
||||||
],
|
)
|
||||||
)
|
],
|
||||||
],
|
),
|
||||||
),
|
),
|
||||||
),
|
],
|
||||||
],
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
Column(
|
Column(
|
||||||
|
|||||||
Reference in New Issue
Block a user