feat: add text to empty screen

This commit is contained in:
Simon Ding
2024-07-28 16:43:59 +08:00
parent 7f025a6246
commit 961d762f35
2 changed files with 51 additions and 44 deletions

View File

@@ -98,7 +98,7 @@ func (c *Client) generateDefaultLocalStorage() error {
func (c *Client) GetSetting(key string) string { func (c *Client) GetSetting(key string) string {
v, err := c.ent.Settings.Query().Where(settings.Key(key)).Only(context.TODO()) v, err := c.ent.Settings.Query().Where(settings.Key(key)).Only(context.TODO())
if err != nil { if err != nil {
log.Errorf("get setting by key: %s error: %v", key, err) log.Warnf("get setting by key: %s error: %v", key, err)
return "" return ""
} }
return v.Value return v.Value

View File

@@ -29,50 +29,57 @@ class WelcomePage extends ConsumerWidget {
child: Wrap( child: Wrap(
spacing: 10, spacing: 10,
runSpacing: 20, runSpacing: 20,
children: List.generate(value.length, (i) { children: value.isEmpty
var item = value[i]; ? [
return Card( Container(
margin: const EdgeInsets.all(4), height: MediaQuery.of(context).size.height * 0.6,
clipBehavior: Clip.hardEdge, alignment: Alignment.center,
child: InkWell( child: const Text("啥都没有...", style: TextStyle(fontSize: 16),))
//splashColor: Colors.blue.withAlpha(30), ]
onTap: () { : List.generate(value.length, (i) {
if (uri == routeMoivie) { var item = value[i];
context.go(MovieDetailsPage.toRoute(item.id!)); return Card(
} else { margin: const EdgeInsets.all(4),
context.go(TvDetailsPage.toRoute(item.id!)); clipBehavior: Clip.hardEdge,
} child: InkWell(
}, //splashColor: Colors.blue.withAlpha(30),
child: Column( onTap: () {
children: <Widget>[ if (uri == routeMoivie) {
SizedBox( context.go(MovieDetailsPage.toRoute(item.id!));
width: 140, } else {
height: 210, context.go(TvDetailsPage.toRoute(item.id!));
child: Image.network( }
"${APIs.imagesUrl}/${item.id}/poster.jpg", },
fit: BoxFit.fill, child: Column(
headers: APIs.authHeaders, children: <Widget>[
SizedBox(
width: 140,
height: 210,
child: Image.network(
"${APIs.imagesUrl}/${item.id}/poster.jpg",
fit: BoxFit.fill,
headers: APIs.authHeaders,
),
),
SizedBox(
width: 140,
child: LinearProgressIndicator(
value: 1,
color: item.status == "downloaded"
? Colors.green
: Colors.blue,
)),
Text(
item.name!,
style: const TextStyle(
fontSize: 14,
fontWeight: FontWeight.bold,
height: 2.5),
),
],
), ),
), ));
SizedBox( }),
width: 140,
child: LinearProgressIndicator(
value: 1,
color: item.status == "downloaded"
? Colors.green
: Colors.blue,
)),
Text(
item.name!,
style: const TextStyle(
fontSize: 14,
fontWeight: FontWeight.bold,
height: 2.5),
),
],
),
));
}),
), ),
), ),
_ => const MyProgressIndicator(), _ => const MyProgressIndicator(),