import 'dart:ui' as ui;

import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
import 'package:yumi/app_localizations.dart';
import 'package:yumi/ui_kit/widgets/room/switch_model/room_seat_number_page.dart';

class RoomMicSwitchPage extends StatefulWidget {
  @override
  _RoomMicSwitchPageState createState() => _RoomMicSwitchPageState();
}

class _RoomMicSwitchPageState extends State<RoomMicSwitchPage>
    with SingleTickerProviderStateMixin {
  TabController? _tabController;
  final List<Widget> _pages = [];
  final List<Widget> _tabs = [];

  @override
  void initState() {
    super.initState();
    _pages.add(RoomSeatNumberPage());
    _tabController = TabController(length: _pages.length, vsync: this);
  }

  @override
  Widget build(BuildContext context) {
    _tabs.clear();
    _tabs.add(Tab(text: SCAppLocalizations.of(context)!.numberOfMic));
    return SafeArea(
      child: ClipRRect(
        borderRadius: BorderRadius.only(
          topLeft: Radius.circular(12.0),
          topRight: Radius.circular(12.0),
        ),
        child: BackdropFilter(
          filter: ui.ImageFilter.blur(sigmaX: 15, sigmaY: 15),
          child: Container(
            width: ScreenUtil().screenWidth,
            height: ScreenUtil().screenHeight * 0.75,
            color: Color(0xff09372E).withOpacity(0.5),
            child: Column(
              children: [
                TabBar(
                  tabAlignment: TabAlignment.center,
                  labelPadding: EdgeInsets.symmetric(horizontal: 18.w),
                  labelColor: Colors.white,
                  isScrollable: true,
                  unselectedLabelColor: Colors.white54,
                  labelStyle: TextStyle(
                    fontSize: 16.sp,
                    fontWeight: FontWeight.bold,
                  ),
                  unselectedLabelStyle: TextStyle(
                    fontSize: 14.sp,
                    fontWeight: FontWeight.w500,
                  ),
                  indicator: BoxDecoration(),
                  dividerColor: Colors.transparent,
                  controller: _tabController,
                  tabs: _tabs,
                ),
                Expanded(
                  child: TabBarView(
                    controller: _tabController,
                    children: _pages,
                  ),
                ),
              ],
            ),
          ),
        ),
      ),
    );
  }
}
