107 lines
3.6 KiB
Dart
107 lines
3.6 KiB
Dart
import 'package:flutter/cupertino.dart';
|
||
import 'package:flutter/material.dart';
|
||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||
import 'package:aslan/chatvibe_features/user/level/user/user_level_page.dart';
|
||
import 'package:aslan/chatvibe_features/user/level/wealth/wealth_level_page.dart';
|
||
|
||
import 'package:aslan/app_localizations.dart';
|
||
import 'package:aslan/chatvibe_ui/components/appbar/chatvibe_appbar.dart';
|
||
|
||
import '../../../chatvibe_domain/usecases/at_fixed_width_tabIndicator.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(
|
||
type == 0
|
||
? "atu_images/level/at_icon_wealth_level_bg.png"
|
||
: "atu_images/level/at_icon_user_level_bg.png",
|
||
width: ScreenUtil().screenWidth,
|
||
height: ScreenUtil().screenHeight,
|
||
fit: BoxFit.fill,
|
||
),
|
||
Scaffold(
|
||
appBar: ChatVibeStandardAppBar(
|
||
backButtonColor: Colors.white,
|
||
title: ATAppLocalizations.of(context)!.level,
|
||
actions: [],
|
||
),
|
||
backgroundColor: Colors.transparent,
|
||
body: SafeArea(
|
||
top: false,
|
||
child: Column(
|
||
children: [
|
||
Row(
|
||
children: [
|
||
SizedBox(width: 10.w),
|
||
Expanded(
|
||
child: TabBar(
|
||
tabs:
|
||
[
|
||
ATAppLocalizations.of(context)!.wealthLevel,
|
||
ATAppLocalizations.of(context)!.userLevel,
|
||
].map((e) => Tab(text: e)).toList(),
|
||
indicator: ATFixedWidthTabIndicator(
|
||
width: 20.w,
|
||
height: 4.w,
|
||
color: Colors.white,
|
||
),
|
||
//indicatorColor: Color(0xFF9F44F9),
|
||
indicatorSize: TabBarIndicatorSize.label,
|
||
labelPadding: EdgeInsets.only(left: 20, right: 20),
|
||
//Tab之间的间距,默认是kTabLabelPadding
|
||
isScrollable: false,
|
||
controller: _tabController,
|
||
labelColor: Colors.white,
|
||
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,
|
||
),
|
||
),
|
||
],
|
||
),
|
||
),
|
||
),
|
||
],
|
||
);
|
||
}
|
||
}
|