chore: update

This commit is contained in:
Simon Ding
2024-07-09 19:22:49 +08:00
parent 3970d66158
commit 54de83730a
4 changed files with 36 additions and 35 deletions

View File

@@ -54,6 +54,10 @@ class MyApp extends StatelessWidget {
);
},
routes: [
GoRoute(
path: "/",
redirect: (context, state) => WelcomePage.route,
),
GoRoute(
path: WelcomePage.route,
builder: (context, state) => const WelcomePage(),

View File

@@ -1,21 +1,23 @@
import 'package:flutter/material.dart';
import 'package:dio/dio.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:ui/APIs.dart';
import 'package:ui/providers/welcome_data.dart';
import 'package:ui/server_response.dart';
import 'package:ui/utils.dart';
class SearchPage extends StatefulWidget {
class SearchPage extends ConsumerStatefulWidget {
const SearchPage({super.key});
static const route = "/search";
@override
State<StatefulWidget> createState() {
ConsumerState<ConsumerStatefulWidget> createState() {
return _SearchPageState();
}
}
class _SearchPageState extends State<SearchPage> {
class _SearchPageState extends ConsumerState<SearchPage> {
List<dynamic> list = List.empty();
void _queryResults(BuildContext context, String q) async {
@@ -140,6 +142,7 @@ class _SearchPageState extends State<SearchPage> {
if (sp.code != 0 && context.mounted) {
Utils.showAlertDialog(context, sp.message);
}
ref.refresh(welcomePageDataProvider);
}
}

View File

@@ -172,7 +172,7 @@ class _SystemSettingsPageState extends ConsumerState<SystemSettingsPage> {
tilePadding: const EdgeInsets.fromLTRB(10, 0, 10, 0),
childrenPadding: const EdgeInsets.fromLTRB(50, 0, 50, 0),
initiallyExpanded: true,
title: const Text("下载设置"),
title: const Text("下载客户端设置"),
children: [downloadSetting],
),
],
@@ -277,7 +277,7 @@ class _SystemSettingsPageState extends ConsumerState<SystemSettingsPage> {
barrierDismissible: true, // user must tap button!
builder: (BuildContext context) {
return AlertDialog(
title: const Text('下载'),
title: const Text('下载客户端'),
content: SingleChildScrollView(
child: ListBody(
children: <Widget>[

View File

@@ -6,7 +6,7 @@ import 'package:ui/providers/welcome_data.dart';
import 'package:ui/tv_details.dart';
class WelcomePage extends ConsumerWidget {
static const route = "/welcome";
static const route = "/series";
const WelcomePage({super.key});
@@ -16,45 +16,39 @@ class WelcomePage extends ConsumerWidget {
return switch (data) {
AsyncData(:final value) => GridView.builder(
itemCount: value.length,
gridDelegate:
const SliverGridDelegateWithFixedCrossAxisCount(crossAxisCount: 6),
itemBuilder: (context, i) {
var item = value[i];
return Card(
margin: const EdgeInsets.all(4),
clipBehavior: Clip.hardEdge,
child: InkWell(
//splashColor: Colors.blue.withAlpha(30),
onTap: () {
context.go(TvDetailsPage.toRoute(item.id!));
//showDialog(context: context, builder: builder)
},
child: Column(
children: <Widget>[
Flexible(
child: SizedBox(
width: 300,
height: 600,
padding: const EdgeInsets.all(30),
itemCount: value.length,
gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount(
crossAxisCount: 6),
itemBuilder: (context, i) {
var item = value[i];
return Card(
margin: const EdgeInsets.all(4),
clipBehavior: Clip.hardEdge,
child: InkWell(
//splashColor: Colors.blue.withAlpha(30),
onTap: () {
context.go(TvDetailsPage.toRoute(item.id!));
//showDialog(context: context, builder: builder)
},
child: Column(
children: <Widget>[
Flexible(
child: Image.network(
APIs.tmdbImgBaseUrl + item.posterPath!,
fit: BoxFit.contain,
),
),
),
Flexible(
child: Text(
Text(
item.name!,
style: const TextStyle(
fontSize: 14, fontWeight: FontWeight.bold),
),
)
],
),
));
}),
],
),
));
}),
_ => const CircularProgressIndicator(),
};
}
}