import 'package:flutter/material.dart';
import 'package:google_fonts/google_fonts.dart';
import 'package:hub/flutter_flow/flutter_flow_theme.dart';
import 'package:hub/shared/utils/limited_text_size.dart';

// ignore: must_be_immutable
class TabViewUtil extends StatelessWidget {
  final BuildContext context;
  final dynamic model;
  String labelTab1;
  String labelTab2;
  final TabController controller;
  final Function(bool) onEditingChanged;
  Widget widget1;
  Widget widget2;

  TabViewUtil({
    super.key,
    required this.onEditingChanged,
    required this.context,
    required this.model,
    required this.labelTab1,
    required this.labelTab2,
    required this.controller,
    required this.widget1,
    required this.widget2,
  });

  @override
  Widget build(BuildContext context) {
    return SafeArea(
      top: true,
      child: Column(
        children: [
          Align(
            alignment: const Alignment(0.0, 0),
            child: TabBar(
              labelColor: FlutterFlowTheme.of(context).primaryText,
              unselectedLabelColor: FlutterFlowTheme.of(context).primaryText,
              labelStyle: FlutterFlowTheme.of(context).titleMedium.override(
                    fontFamily: FlutterFlowTheme.of(context).titleMediumFamily,
                    fontSize: LimitedFontSizeUtil.getBodyFontSize(context),
                    letterSpacing: 0.0,
                    useGoogleFonts: GoogleFonts.asMap().containsKey(
                        FlutterFlowTheme.of(context).titleMediumFamily),
                  ),
              unselectedLabelStyle: const TextStyle(),
              indicatorColor: FlutterFlowTheme.of(context).primary,
              padding: const EdgeInsets.all(4.0),
              tabs: [
                Tab(
                  text: labelTab1,
                ),
                Tab(
                  text: labelTab2,
                ),
              ],
              controller: controller,
              onTap: (i) async {
                if (i == 1) onEditingChanged(false);
                [() async {}, () async {}][i]();
              },
            ),
          ),
          Expanded(
            child: TabBarView(
              controller: controller,
              children: [
                widget1,
                widget2,
              ],
            ),
          ),
          // Adicione o conteúdo do TabBarView aqui
        ],
      ),
    );
  }
}
