use persistent_bottom_nav_bar_v2 replace native bottom_nav_bar
This commit is contained in:
@@ -5,6 +5,8 @@ import 'package:topic/HomePage.dart';
|
||||
import 'package:topic/HistoricalRecord.dart';
|
||||
import 'package:topic/PersonalInfo.dart';
|
||||
import 'package:topic/MessagePage.dart';
|
||||
|
||||
import 'BottomNavBar.dart';
|
||||
/*void main() {
|
||||
runApp(MaterialApp(
|
||||
home: KnowledgePage(),
|
||||
@@ -36,104 +38,56 @@ class KnowledgePage extends StatelessWidget {
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
child:ListView.builder(
|
||||
padding: EdgeInsets.symmetric(vertical: 5), // 调整列表视图的 padding
|
||||
itemCount: 3,
|
||||
itemBuilder: (context, idx) {
|
||||
return InkWell(
|
||||
onTap: () {
|
||||
Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(builder: (context) => HomePage(
|
||||
email: email,
|
||||
)),
|
||||
);
|
||||
},
|
||||
child: Card(
|
||||
//margin: EdgeInsets.all(10),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Image.asset(
|
||||
'lib/images/456.jpg',
|
||||
height: 180,
|
||||
width: double.infinity,
|
||||
fit: BoxFit.cover,
|
||||
child: ListView.builder(
|
||||
padding: EdgeInsets.symmetric(vertical: 5), // 调整列表视图的 padding
|
||||
itemCount: 3,
|
||||
itemBuilder: (context, idx) {
|
||||
return InkWell(
|
||||
onTap: () {
|
||||
Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(
|
||||
builder: (context) => HomePage(
|
||||
email: email,
|
||||
)),
|
||||
);
|
||||
},
|
||||
child: Card(
|
||||
//margin: EdgeInsets.all(10),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Image.asset(
|
||||
'lib/images/456.jpg',
|
||||
height: 180,
|
||||
width: double.infinity,
|
||||
fit: BoxFit.cover,
|
||||
),
|
||||
Padding(
|
||||
padding: EdgeInsets.all(10.0),
|
||||
child: Text(
|
||||
'文章標題 $idx',
|
||||
style: TextStyle(
|
||||
fontSize: 18, fontWeight: FontWeight.bold),
|
||||
),
|
||||
Padding(
|
||||
padding: EdgeInsets.all(10.0),
|
||||
child: Text(
|
||||
'文章標題 $idx',
|
||||
style: TextStyle(fontSize: 18, fontWeight: FontWeight.bold),
|
||||
),
|
||||
),
|
||||
Padding(
|
||||
padding: EdgeInsets.symmetric(horizontal: 10.0),
|
||||
child: Text(
|
||||
'這是文章的簡短描述...',
|
||||
style: TextStyle(fontSize: 16),
|
||||
),
|
||||
Padding(
|
||||
padding: EdgeInsets.symmetric(horizontal: 10.0),
|
||||
child: Text(
|
||||
'這是文章的簡短描述...',
|
||||
style: TextStyle(fontSize: 16),
|
||||
),
|
||||
),
|
||||
SizedBox(height: 10),
|
||||
],
|
||||
),
|
||||
),
|
||||
SizedBox(height: 10),
|
||||
],
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
bottomNavigationBar: BottomNavigationBar(
|
||||
items: [
|
||||
BottomNavigationBarItem(icon: Icon(Icons.home), label: '首頁'),
|
||||
BottomNavigationBarItem(icon: Icon(Icons.history_edu), label: '跌倒紀錄'),
|
||||
BottomNavigationBarItem(icon: Icon(Icons.lightbulb_outline), label: '知識補充'),
|
||||
BottomNavigationBarItem(icon: Icon(Icons.monitor_outlined), label: '切換畫面'),
|
||||
BottomNavigationBarItem(icon: Icon(Icons.person_sharp), label: '個人資料'),
|
||||
],
|
||||
currentIndex: 2,
|
||||
selectedItemColor: Colors.orange,
|
||||
unselectedItemColor: Colors.grey,
|
||||
onTap: (index) {
|
||||
if (index == 0) {
|
||||
Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(builder: (context) => HomePage(
|
||||
email: email,
|
||||
)),
|
||||
);
|
||||
} else if (index == 1) {
|
||||
Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(builder: (context) => HistoricalRecord(
|
||||
email: email,
|
||||
)),
|
||||
);
|
||||
} else if (index == 2) {
|
||||
Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(builder: (context) => KnowledgePage(
|
||||
email: email,
|
||||
)),
|
||||
);
|
||||
} else if (index == 3) {
|
||||
Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(builder: (context) => MessagePage(
|
||||
email: email,
|
||||
)),
|
||||
);
|
||||
} else if (index == 4) {
|
||||
Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(builder: (context) => PersonalInfo(
|
||||
email: email,
|
||||
)),
|
||||
);
|
||||
}
|
||||
},
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user