1
This commit is contained in:
@@ -1,4 +1,8 @@
|
||||
import 'package:app/providers/user_store.dart';
|
||||
import 'package:app/router/route_paths.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:go_router/go_router.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import 'package:remixicon/remixicon.dart';
|
||||
|
||||
class UserHeader extends StatelessWidget implements PreferredSizeWidget {
|
||||
@@ -34,7 +38,28 @@ class UserHeader extends StatelessWidget implements PreferredSizeWidget {
|
||||
],
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 15),
|
||||
PopupMenuButton(
|
||||
color: Colors.white,
|
||||
padding: EdgeInsets.zero,
|
||||
position: PopupMenuPosition.under,
|
||||
onSelected: (value) {
|
||||
if (value == 1) {
|
||||
UserStore userStore = context.read<UserStore>();
|
||||
userStore.logout();
|
||||
context.go(RoutePaths.login);
|
||||
}
|
||||
},
|
||||
itemBuilder: (context) => [
|
||||
PopupMenuItem(
|
||||
value: 1,
|
||||
child: Text("退出登录", textAlign: TextAlign.center),
|
||||
),
|
||||
],
|
||||
child: IconButton(
|
||||
onPressed: null,
|
||||
icon: Icon(RemixIcons.user_line),
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user