feat: 播放处理,个人中心,
This commit is contained in:
1 parent
e59ac2177b
commit
4ccea08472
37 files changed
+1425
-115
No files matched your search
@@ -1,6 +1,14 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:skywood/global/client/user_client.dart';
|
||||
import 'package:skywood/main/lib_file.dart';
|
||||
import 'package:skywood/pages/mine/widget/mine_section_view.dart';
|
||||
import 'package:skywood/pages/widgets/pixel_widgets.dart';
|
||||
import 'package:skywood/utils/models/user/skywood_user.dart';
|
||||
import 'package:skywood/utils/tools/app_toast.dart';
|
||||
import 'package:skywood/utils/tools/widgets/sky_common_widget.dart';
|
||||
|
||||
import '../widgets/common_bg_page.dart';
|
||||
|
||||
class MinePage extends StatefulWidget {
|
||||
const MinePage({super.key});
|
||||
@@ -12,32 +20,92 @@ class MinePage extends StatefulWidget {
|
||||
}
|
||||
|
||||
class _MainRootState extends State<MinePage> {
|
||||
|
||||
SkywoodUser? _userInfo;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
|
||||
_getUserData();
|
||||
}
|
||||
|
||||
void _getUserData() {
|
||||
UserClient.getUserInfo().then((value) {
|
||||
setState(() {
|
||||
_userInfo = value;
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
body: PixelPageBackground(
|
||||
child: SafeArea(
|
||||
return CommonBgPage(
|
||||
child: SafeArea(
|
||||
bottom: false,
|
||||
child: CustomScrollView(
|
||||
slivers: [
|
||||
SliverToBoxAdapter(child: SizedBox(height: 12.h)),
|
||||
SliverToBoxAdapter(child: _buildHeader()),
|
||||
SliverToBoxAdapter(child: SizedBox(height: 18.h)),
|
||||
SliverToBoxAdapter(child: _buildPlayerCard()),
|
||||
SliverToBoxAdapter(child: SizedBox(height: 10.h)),
|
||||
SliverToBoxAdapter(child: _buildWalletShop()),
|
||||
SliverToBoxAdapter(child: SizedBox(height: 10.h)),
|
||||
SliverToBoxAdapter(child: _buildCheckpoint()),
|
||||
SliverToBoxAdapter(child: SizedBox(height: 10.h)),
|
||||
SliverToBoxAdapter(child: _buildGameMenu()),
|
||||
SliverToBoxAdapter(child: SizedBox(height: 120.h)),
|
||||
],
|
||||
),
|
||||
),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(15),
|
||||
child: Column(
|
||||
children: [
|
||||
const SizedBox(height: 5),
|
||||
mImgBg(imgName: ConstImg.mineTop),
|
||||
const SizedBox(height: 10),
|
||||
MineSectionView(title: 'PLAYER CARD', imgName: ConstImg.sectionBg2, paddingSpace: 16,
|
||||
child: _userInfo==null ? null : _showUserInfo(),
|
||||
),
|
||||
const SizedBox(height: 6),
|
||||
MineSectionView(title: 'GAME MENU', imgName: ConstImg.sectionBg1),
|
||||
],
|
||||
),
|
||||
)
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _showUserInfo() {
|
||||
String _name = _userInfo!.givingName!.isEmpty || _userInfo!.givingName==''
|
||||
? 'Visitor'
|
||||
: _userInfo!.givingName!;
|
||||
return Column(
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
_userInfo!.avator.isEmpty || _userInfo!.avator==''
|
||||
? HelpImg.asset(ConstImg.defAvatar, width: 60)
|
||||
: HelpImg.asset(ConstImg.defAvatar),
|
||||
const SizedBox(width: 10),
|
||||
Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
const SizedBox(height: 5),
|
||||
SkyText(text: _name, fontSize: 18, fontWeight: FontWeight.bold,
|
||||
color: Colors.white,
|
||||
),
|
||||
const SizedBox(height: 15),
|
||||
Row(
|
||||
children: [
|
||||
SkyText(text: _userInfo!.customerId,
|
||||
fontSize: 10,
|
||||
color: Colors.white.withAlpha(200),
|
||||
),
|
||||
const SizedBox(width: 6),
|
||||
HelpImg.asset(ConstImg.copy, width: 12),
|
||||
],
|
||||
).addInkWell(onTap: () async {
|
||||
// copy
|
||||
if (_userInfo!.customerId.isEmpty) return;
|
||||
await Clipboard.setData(ClipboardData(text: _userInfo!.customerId));
|
||||
AppToast.showSuccess('ID is Copied!');
|
||||
}),
|
||||
const SizedBox(height: 10),
|
||||
],
|
||||
)
|
||||
],
|
||||
)
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildHeader() {
|
||||
return Padding(
|
||||
padding: EdgeInsets.symmetric(horizontal: 15.w),
|
||||
|
||||
@@ -0,0 +1,93 @@
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:skywood/main/lib_file.dart';
|
||||
import 'package:skywood/utils/tools/widgets/sky_common_widget.dart';
|
||||
|
||||
class MineSectionView extends StatelessWidget {
|
||||
|
||||
const MineSectionView({
|
||||
super.key,
|
||||
this.width,
|
||||
this.height,
|
||||
required this.title,
|
||||
required this.imgName,
|
||||
this.type = 1, // 1,2
|
||||
this.paddingSpace = 5,
|
||||
this.child
|
||||
});
|
||||
|
||||
final String title;
|
||||
final double? width;
|
||||
final double? height;
|
||||
final String imgName;
|
||||
final int type;
|
||||
final double paddingSpace;
|
||||
final Widget? child;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Stack(
|
||||
children: [
|
||||
HelpImg.asset(imgName, width: width, height: height, fit: BoxFit.fill),
|
||||
Positioned(
|
||||
left: paddingSpace, right: paddingSpace, top: 8,
|
||||
child: Column(
|
||||
children: [
|
||||
_buildHeader(),
|
||||
const SizedBox(height: 10),
|
||||
child ?? SizedBox()
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildHeader() {
|
||||
return Stack(
|
||||
children: [
|
||||
HelpImg.asset(ConstImg.sectionTopBg, width: width, height: 20.h),
|
||||
Positioned(
|
||||
left: 7, right: 7,
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
HelpImg.asset(ConstImg.littleLeft, width: 7),
|
||||
const SizedBox(width: 2),
|
||||
SkyText(text: title, fontSize: 12, color: Colors.white)
|
||||
],
|
||||
),
|
||||
Row(
|
||||
children: List.generate(3, (i) {
|
||||
return HelpImg.asset(ConstImg.littleRight, width: 5);
|
||||
}),
|
||||
)
|
||||
],
|
||||
),
|
||||
)
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class mImgBg extends StatelessWidget {
|
||||
const mImgBg({super.key,
|
||||
this.width,
|
||||
this.height,
|
||||
this.fit = BoxFit.fill,
|
||||
required this.imgName,
|
||||
});
|
||||
|
||||
final double? width;
|
||||
final double? height;
|
||||
final String imgName;
|
||||
final BoxFit fit;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return HelpImg.asset(imgName, width: width, height: height, fit: fit);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user