upload
This commit is contained in:
@ -21,6 +21,7 @@ class _HomePageState extends ConsumerState<HomePage> {
|
||||
{"path": "/", "title": "相册"},
|
||||
{"path": "/profile", "title": "用户"}
|
||||
];
|
||||
int key = 0;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
@ -58,26 +59,25 @@ class _HomePageState extends ConsumerState<HomePage> {
|
||||
contentType: MediaType(mimeType!.split("/").first,
|
||||
mimeType.split("/").last))
|
||||
});
|
||||
await dio.post("/image/upload", data: data);
|
||||
ScaffoldMessenger.of(context).showSnackBar(SnackBar(
|
||||
content: Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: const [
|
||||
Icon(
|
||||
Icons.check_circle,
|
||||
color: Colors.white,
|
||||
),
|
||||
SizedBox(
|
||||
width: 10,
|
||||
),
|
||||
Text("上传成功")
|
||||
],
|
||||
),
|
||||
backgroundColor: Colors.lightGreen,
|
||||
));
|
||||
await dio.post("/image/upload", data: data).then((value) {
|
||||
ScaffoldMessenger.of(context).showSnackBar(SnackBar(
|
||||
content: Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: const [
|
||||
Icon(
|
||||
Icons.check_circle,
|
||||
color: Colors.white,
|
||||
),
|
||||
SizedBox(
|
||||
width: 10,
|
||||
),
|
||||
Text("上传成功")
|
||||
],
|
||||
),
|
||||
backgroundColor: Colors.lightGreen,
|
||||
));
|
||||
});
|
||||
} else {}
|
||||
|
||||
// context.go("/login");
|
||||
},
|
||||
child: const Icon(Icons.add),
|
||||
)
|
||||
@ -99,7 +99,9 @@ class _HomePageState extends ConsumerState<HomePage> {
|
||||
setState(() {
|
||||
selectedIndex = idx;
|
||||
});
|
||||
context.go(tabList[idx]["path"] ?? "");
|
||||
context.go(Uri(
|
||||
path: tabList[idx]["path"] ?? "",
|
||||
).toString());
|
||||
},
|
||||
destinations: const [
|
||||
NavigationRailDestination(
|
||||
|
Reference in New Issue
Block a user