import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:yumi/app_localizations.dart';
import 'package:yumi/modules/room/them/custom/room_theme_custom_page.dart';
import 'package:yumi/modules/user/my_items/theme/bags_theme_page.dart';

///背包-房间主题
class BagsTabThemePage extends StatefulWidget {


  @override
  _BagsTabThemePageState createState() => _BagsTabThemePageState();
}

class _BagsTabThemePageState extends State<BagsTabThemePage>
    with SingleTickerProviderStateMixin {
  late TabController _tabController;
  final List<Widget> _pages = [];
  final List<Widget> _tabs = [];

  @override
  void initState() {
    super.initState();
    _pages.add(
      BagsThemePage(),
    );
    _pages.add(RoomThemeCustomPage());
    _tabController = TabController(length: _pages.length, vsync: this);
    _tabController.addListener(() {}); // 监听切换
  }

  @override
  Widget build(BuildContext context) {
    _tabs.clear();
    _tabs.add(Tab(text: SCAppLocalizations.of(context)!.all));
    _tabs.add(Tab(text: SCAppLocalizations.of(context)!.custom));
    return Scaffold(
      resizeToAvoidBottomInset: false,
      backgroundColor: Colors.transparent,
      body: Column(
        children: [
          TabBar(
            tabAlignment: TabAlignment.center,
            labelPadding: EdgeInsets.symmetric(horizontal: 18.w),
            labelColor: Colors.white,
            isScrollable: true,
            indicator: BoxDecoration(),
            unselectedLabelColor: Colors.white54,
            labelStyle: TextStyle(
              fontSize: 15.sp,
              fontFamily: 'MyCustomFont',
              fontWeight: FontWeight.w600,
            ),
            unselectedLabelStyle: TextStyle(
              fontSize: 13.sp,
              fontFamily: 'MyCustomFont',
              fontWeight: FontWeight.w500,
            ),
            indicatorColor: Colors.transparent,
            dividerColor: Colors.transparent,
            controller: _tabController,
            tabs: _tabs,
          ),
          Expanded(
            child: TabBarView(controller: _tabController, children: _pages),
          ),
        ],
      ),
    );
  }
}
