import 'package:e_commerce_training/res/R.dart';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';

class UpdatePriceDialog extends StatefulWidget {
  final String label;
  final String hintText;
  final ValueChanged<String> valueChanged;

  const UpdatePriceDialog({Key? key, required this.label, required this.hintText, required this.valueChanged})
      : super(key: key);

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

class _UpdatePriceDialogState extends State<UpdatePriceDialog> {
  late TextEditingController _priceController;
  late String _errorPhone;

  @override
  void initState() {
    // TODO: implement initState
    _priceController = TextEditingController();
    super.initState();
  }

  @override
  Widget build(BuildContext context) {
    return Container(
      width: double.maxFinite,
      padding: EdgeInsets.only(left: 10, right: 10, top: 3, bottom: 3),
      child: Column(
        crossAxisAlignment: CrossAxisAlignment.start,
        mainAxisSize: MainAxisSize.min,
        children: <Widget>[
          Text(
            widget.label.toUpperCase() ?? "",
            style: TextStyle(color: R.color.black, fontSize: 45.sp),
          ),
          SizedBox(
            height: 10,
          ),
          // TextFieldWidget(
          //   controller: _priceController,
          //   keyboardType: TextInputType.number,
          //   errorText: _errorPhone,
          //   textInputAction: TextInputAction.done,
          //   hintText: widget.hintText,
          //   labelText: R.string.update_price,
          //   onChanged: (text) {
          //     if (Utils.isEmpty(text))
          //       setState(() {
          //         _errorPhone = "Xin nhập giá.";
          //       });
          //     else {
          //       setState(() {
          //         try {
          //           int.parse(text);
          //           _errorPhone = null;
          //         } catch (e) {
          //           logger.e(e.toString());
          //           _errorPhone = "Định dạng không chính xác.";
          //         }
          //       });
          //       int priceNumber = Utils.convertPriceToNumber(text!.trim());
          //       widget.valueChanged(text.trim());
          //     }
          //   },
          //   onSubmitted: (text) => FocusNode().unfocus(),
          // )
        ],
      ),
    );
  }
}
