import 'package:boilerplate/core/extensions/date_time_extension.dart';
import 'package:flutter/material.dart';

import '../../../../../core/i18n/translations.g.dart';
import '../../../../../core/styles/my_colors.dart';
import '../../../../../core/styles/my_dimensions.dart';
import '../../../../../core/styles/my_font.dart';
import '../../../../widgets/ipm_textfield.dart';

class TimeMeeting extends StatefulWidget {
  TimeMeeting({Key? key}) : super(key: key);

  @override
  State<TimeMeeting> createState() => _TimeMeetingState();
}

class _TimeMeetingState extends State<TimeMeeting> {
  late final TextEditingController startCtrl;
  late final TextEditingController endCtrl;

  @override
  void initState() {
    super.initState();

    final now = DateTime.now().toFormat('HH:mm');

    startCtrl = TextEditingController(text: now);
    endCtrl = TextEditingController(text: now);
  }

  @override
  void dispose() {
    startCtrl.dispose();
    endCtrl.dispose();

    super.dispose();
  }

  @override
  Widget build(BuildContext context) {
    return Column(
      crossAxisAlignment: CrossAxisAlignment.start,
      children: [
        Text(
          AppLocalizations.products.date_meeting,
          style: MyFont.medium20,
        ),
        SizedBox(height: MyDimens.dimen12),
        SizedBox(
          width: MediaQuery.of(context).size.width,
          child: Row(
            mainAxisSize: MainAxisSize.min,
            children: [
              SizedBox(
                width: MyDimens.dimen80,
                child: IPMTextField(
                  controller: startCtrl,
                  readOnly: true,
                  borderColor: MyColor.borderColor,
                  borderRadius: 10,
                  textColor: Color(0xFF737B7D),
                  textAlign: TextAlign.center,
                  onTap: () {
                    print('tap');
                  },
                ),
              ),
              Container(
                margin: EdgeInsets.symmetric(horizontal: MyDimens.dimen4),
                width: MyDimens.dimen20,
                height: 1,
                color: Color(0xFFCFD2D5),
              ),
              SizedBox(
                width: MyDimens.dimen80,
                child: IPMTextField(
                  controller: startCtrl,
                  readOnly: true,
                  borderColor: MyColor.borderColor,
                  borderRadius: 10,
                  textColor: Color(0xFF737B7D),
                  textAlign: TextAlign.center,
                  onTap: () {
                    print('tap');
                  },
                ),
              ),
            ],
          ),
        ),
      ],
    );
  }
}
