Skip to content

Commit

Permalink
fix: 首页无记录显示异常
Browse files Browse the repository at this point in the history
  • Loading branch information
MiaoMint committed Jul 20, 2023
1 parent 3fe2d74 commit 692a2b0
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 28 deletions.
57 changes: 29 additions & 28 deletions lib/pages/home/view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -23,32 +23,33 @@ class _HomePageState extends State<HomePage> {
}

Widget _buildContent() {
return SingleChildScrollView(
child: Padding(
padding: const EdgeInsets.all(16),
child: Obx(
() {
if (c.resents.isEmpty && c.favorites.isEmpty) {
return Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
mainAxisSize: MainAxisSize.min,
children: [
const SizedBox(height: 200),
const Image(
image: AssetImage("assets/icon/logo.png"),
width: 100,
),
const SizedBox(height: 16),
Text(
"home.no-record".i18n,
),
],
return Obx(
() {
if (c.resents.isEmpty && c.favorites.isEmpty) {
return Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
const Text(
"(>人<;)",
style: TextStyle(
fontSize: 50,
fontWeight: FontWeight.bold,
),
),
const SizedBox(height: 20),
Text(
"home.no-record".i18n,
),
);
}
],
),
);
}

return Column(
return SingleChildScrollView(
child: Padding(
padding: const EdgeInsets.all(16),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
if (c.resents.isNotEmpty) ...[
Expand All @@ -62,10 +63,10 @@ class _HomePageState extends State<HomePage> {
data: c.favorites,
),
],
);
},
),
),
),
),
);
},
);
}

Expand Down
1 change: 1 addition & 0 deletions lib/pages/main/view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,7 @@ class _AndroidMainPageState extends fluent.State<AndroidMainPage> {
selectedIcon: const Icon(Icons.settings),
),
],
labelBehavior: NavigationDestinationLabelBehavior.onlyShowSelected,
selectedIndex: c.selectedTab.value,
onDestinationSelected: c.changeTab,
),
Expand Down

0 comments on commit 692a2b0

Please sign in to comment.