opt: 登录逻辑

This commit is contained in:
guozhigq
2023-06-23 00:11:56 +08:00
parent e3d3b29779
commit fccd21e8b6
7 changed files with 66 additions and 20 deletions

View File

@ -3,7 +3,12 @@ import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
import 'package:get/get.dart';
import 'package:hive/hive.dart';
import 'package:pilipala/common/widgets/network_img_layer.dart';
import 'package:pilipala/pages/mine/view.dart';
import 'package:pilipala/utils/storage.dart';
Box userInfoCache = GStrorage.userInfo;
class HomeAppBar extends StatelessWidget {
const HomeAppBar({super.key});
@ -49,21 +54,40 @@ class HomeAppBar extends StatelessWidget {
// onPressed: () {},
// icon: const Icon(CupertinoIcons.bell, size: 22),
// ),
IconButton(
onPressed: () {
Get.bottomSheet(
Builder(builder: (context) {
return const SizedBox(
height: 450,
child: MinePage(),
);
}),
/// TODO
if (userInfoCache.get('userInfoCache') != null) ...[
GestureDetector(
onTap: () => showModalBottomSheet(
context: context,
builder: (_) => const SizedBox(
height: 450,
child: MinePage(),
),
clipBehavior: Clip.hardEdge,
isScrollControlled: true,
);
},
icon: const Icon(CupertinoIcons.person, size: 22),
),
),
child: NetworkImgLayer(
type: 'avatar',
width: 32,
height: 32,
src: userInfoCache.get('userInfoCache').face,
),
),
] else ...[
IconButton(
onPressed: () => showModalBottomSheet(
context: context,
builder: (_) => const SizedBox(
height: 450,
child: MinePage(),
),
clipBehavior: Clip.hardEdge,
isScrollControlled: true,
),
icon: const Icon(CupertinoIcons.person, size: 22),
),
],
const SizedBox(width: 10)
],
elevation: 0,