use persistent_bottom_nav_bar_v2 replace native bottom_nav_bar
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/rendering.dart';
|
||||
import 'package:topic/BottomNavBar.dart';
|
||||
import 'package:topic/main.dart';
|
||||
import 'package:topic/HomePage.dart';
|
||||
import 'package:topic/PersonalInfo.dart';
|
||||
@@ -29,7 +30,7 @@ class _HistoricalRecordState extends State<HistoricalRecord> {
|
||||
|
||||
final conn = await MySQLConnection.createConnection(
|
||||
//host: '203.64.84.154',
|
||||
host:'10.0.2.2',
|
||||
host: '10.0.2.2',
|
||||
//127.0.0.1 10.0.2.2
|
||||
port: 3306,
|
||||
userName: 'root',
|
||||
@@ -48,15 +49,17 @@ class _HistoricalRecordState extends State<HistoricalRecord> {
|
||||
print('No data found in users table.');
|
||||
} else {
|
||||
setState(() {
|
||||
_results = result.rows.map((row) => {
|
||||
'id': row.colAt(0),
|
||||
'name': row.colAt(1),
|
||||
'age':row.colAt(2),
|
||||
'gender':row.colAt(3),
|
||||
'phone':row.colAt(4),
|
||||
'email':row.colAt(5),
|
||||
'password':row.colAt(2)
|
||||
}).toList();
|
||||
_results = result.rows
|
||||
.map((row) => {
|
||||
'id': row.colAt(0),
|
||||
'name': row.colAt(1),
|
||||
'age': row.colAt(2),
|
||||
'gender': row.colAt(3),
|
||||
'phone': row.colAt(4),
|
||||
'email': row.colAt(5),
|
||||
'password': row.colAt(2)
|
||||
})
|
||||
.toList();
|
||||
});
|
||||
}
|
||||
} catch (e) {
|
||||
@@ -93,9 +96,9 @@ class _HistoricalRecordState extends State<HistoricalRecord> {
|
||||
title: Text(_results[index]['name']),
|
||||
subtitle: Text(
|
||||
'age: ${_results[index]['age']}, '
|
||||
'gender: ${_results[index]['gender']}, '
|
||||
'phone: ${_results[index]['phone']}, '
|
||||
'email: ${_results[index]['email']}',
|
||||
'gender: ${_results[index]['gender']}, '
|
||||
'phone: ${_results[index]['phone']}, '
|
||||
'email: ${_results[index]['email']}',
|
||||
),
|
||||
);
|
||||
},
|
||||
@@ -103,63 +106,6 @@ class _HistoricalRecordState extends State<HistoricalRecord> {
|
||||
),
|
||||
],
|
||||
),
|
||||
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: 1,
|
||||
selectedItemColor: Colors.orange,
|
||||
unselectedItemColor: Colors.grey,
|
||||
selectedLabelStyle: TextStyle(color: Colors.orange),
|
||||
unselectedLabelStyle: TextStyle(color: Colors.grey),
|
||||
onTap: (index) {
|
||||
if (index == 0) {
|
||||
Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(
|
||||
builder: (context) => HomePage(
|
||||
email: widget.email,
|
||||
)),
|
||||
);
|
||||
} else if (index == 1) {
|
||||
Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(
|
||||
builder: (context) => HistoricalRecord(
|
||||
email: widget.email,
|
||||
)),
|
||||
);
|
||||
} else if (index == 2) {
|
||||
Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(
|
||||
builder: (context) => KnowledgePage(
|
||||
email: widget.email,
|
||||
)),
|
||||
);
|
||||
} else if (index == 3) {
|
||||
Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(
|
||||
builder: (context) => MessagePage(
|
||||
email: widget.email,
|
||||
)),
|
||||
);
|
||||
} else if (index == 4) {
|
||||
Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(
|
||||
builder: (context) => PersonalInfo(
|
||||
email: widget.email,
|
||||
)),
|
||||
);
|
||||
}
|
||||
},
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user