import 'dart:ui';

import 'package:diplomaticquarterapp/core/viewModels/feedback/feedback_view_model.dart';
import 'package:diplomaticquarterapp/models/Appointments/AppoimentAllHistoryResultList.dart';
import 'package:diplomaticquarterapp/pages/feedback/send_feedback_page.dart';
import 'package:diplomaticquarterapp/theme/colors.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';

import 'status_feedback_page.dart';

class FeedbackHomePage extends StatefulWidget {
  final AppoitmentAllHistoryResultList appointment;
  final MessageType messageType;
  const FeedbackHomePage({Key key, this.appointment, this.messageType = MessageType.NON}) : super(key: key);

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

class _FeedbackHomePageState extends State<FeedbackHomePage> with SingleTickerProviderStateMixin {
  TabController _tabController;

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

  @override
  void dispose() {
    super.dispose();
    _tabController.dispose();
  }

  @override
  Widget build(BuildContext context) {
    return AppScaffold(
      isShowAppBar: true,
      isBottomBar: false,
      isShowDecPage: false,
      appBarTitle: TranslationBase.of(context).feedbackTitle,
      showNewAppBar: true,
      showNewAppBarTitle: true,
      backgroundColor: CustomColors.appBackgroudGrey2Color,
      body: Column(
        children: <Widget>[
          TabBar(
            controller: _tabController,
            indicatorWeight: 3.0,
            indicatorSize: TabBarIndicatorSize.tab,
            labelColor: Color(0xff2B353E),
            unselectedLabelColor: Color(0xff575757),
            labelPadding: EdgeInsets.only(top: 15, bottom: 13, left: 20, right: 20),
            labelStyle: TextStyle(
              fontSize: 16,
              fontWeight: FontWeight.w600,
              letterSpacing: -0.48,
            ),
            unselectedLabelStyle: TextStyle(
              fontSize: 16,
              fontWeight: FontWeight.w600,
              letterSpacing: -0.48,
            ),
            tabs: [Text(TranslationBase.of(context).send), Text(TranslationBase.of(context).status)],
          ),
          Expanded(
            child: TabBarView(
              physics: BouncingScrollPhysics(),
              controller: _tabController,
              children: <Widget>[
                SendFeedbackPage(
                  appointment: widget.appointment,
                  messageType: widget.messageType,
                ),
                StatusFeedbackPage()
              ],
            ),
          )
        ],
      ),
    );
  }
}
