Skip to content

Commit

Permalink
feat: add text to empty screen
Browse files Browse the repository at this point in the history
  • Loading branch information
simon-ding committed Jul 28, 2024
1 parent 7f025a6 commit 961d762
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 44 deletions.
2 changes: 1 addition & 1 deletion db/db.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ func (c *Client) generateDefaultLocalStorage() error {
func (c *Client) GetSetting(key string) string {
v, err := c.ent.Settings.Query().Where(settings.Key(key)).Only(context.TODO())
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 v.Value
Expand Down
93 changes: 50 additions & 43 deletions ui/lib/welcome_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -29,50 +29,57 @@ class WelcomePage extends ConsumerWidget {
child: Wrap(
spacing: 10,
runSpacing: 20,
children: List.generate(value.length, (i) {
var item = value[i];
return Card(
margin: const EdgeInsets.all(4),
clipBehavior: Clip.hardEdge,
child: InkWell(
//splashColor: Colors.blue.withAlpha(30),
onTap: () {
if (uri == routeMoivie) {
context.go(MovieDetailsPage.toRoute(item.id!));
} else {
context.go(TvDetailsPage.toRoute(item.id!));
}
},
child: Column(
children: <Widget>[
SizedBox(
width: 140,
height: 210,
child: Image.network(
"${APIs.imagesUrl}/${item.id}/poster.jpg",
fit: BoxFit.fill,
headers: APIs.authHeaders,
children: value.isEmpty
? [
Container(
height: MediaQuery.of(context).size.height * 0.6,
alignment: Alignment.center,
child: const Text("啥都没有...", style: TextStyle(fontSize: 16),))
]
: List.generate(value.length, (i) {
var item = value[i];
return Card(
margin: const EdgeInsets.all(4),
clipBehavior: Clip.hardEdge,
child: InkWell(
//splashColor: Colors.blue.withAlpha(30),
onTap: () {
if (uri == routeMoivie) {
context.go(MovieDetailsPage.toRoute(item.id!));
} else {
context.go(TvDetailsPage.toRoute(item.id!));
}
},
child: Column(
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(),
Expand Down

0 comments on commit 961d762

Please sign in to comment.