2026-04-09 21:32:23 +08:00

100 lines
3.5 KiB
Dart
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:yumi/modules/user/level/user/user_level_page.dart';
import 'package:yumi/modules/user/level/wealth/wealth_level_page.dart';
import 'package:yumi/app_localizations.dart';
import 'package:yumi/ui_kit/components/appbar/socialchat_appbar.dart';
import 'package:yumi/ui_kit/theme/socialchat_theme.dart';
class LevelPage extends StatefulWidget {
@override
_LevelPageState createState() => _LevelPageState();
}
class _LevelPageState extends State<LevelPage>
with SingleTickerProviderStateMixin {
late TabController _tabController;
final List<Widget> _pages = [WealthLevelPage(), UserLevelPage()];
int type = 0;
@override
void initState() {
super.initState();
_tabController = TabController(length: _pages.length, vsync: this);
_tabController.addListener(() {
type = _tabController.index;
setState(() {});
});
}
@override
Widget build(BuildContext context) {
return Stack(
children: [
Image.asset(
"sc_images/person/sc_icon_edit_userinfo_bg.png",
width: ScreenUtil().screenWidth,
height: ScreenUtil().screenHeight,
fit: BoxFit.fill,
),
Scaffold(
appBar: SocialChatStandardAppBar(
backButtonColor: Colors.white,
title: SCAppLocalizations.of(context)!.level,
actions: [],
),
backgroundColor: Colors.transparent,
body: SafeArea(
top: false,
child: Column(
children: [
Row(
children: [
SizedBox(width: 10.w),
Expanded(
child: TabBar(
tabs:
[
SCAppLocalizations.of(context)!.wealthLevel,
SCAppLocalizations.of(context)!.userLevel,
].map((e) => Tab(text: e)).toList(),
indicator: BoxDecoration(),
//indicatorColor: Color(0xFF9F44F9),
indicatorSize: TabBarIndicatorSize.label,
labelPadding: EdgeInsets.only(left: 20, right: 20),
//Tab之间的间距默认是kTabLabelPadding
isScrollable: false,
controller: _tabController,
labelColor: SocialChatTheme.primaryLight,
dividerColor: Colors.transparent,
unselectedLabelColor: Colors.white54,
labelStyle: TextStyle(
fontSize: 16.sp,
fontWeight: FontWeight.w500,
),
unselectedLabelStyle: TextStyle(
fontSize: 14.sp,
fontWeight: FontWeight.w500,
),
),
),
SizedBox(width: 10.w),
],
),
Expanded(
child: TabBarView(
controller: _tabController,
children: _pages,
),
),
],
),
),
),
],
);
}
}