body method

  1. @override
Widget body(
  1. BuildContext context,
  2. IPhoneVerificationViewModel viewModel,
  3. Widget? child
)
override

Implementation

@override
Widget body(
  BuildContext context,
  IPhoneVerificationViewModel viewModel,
  Widget? child,
) {
  _expandablePhoneNumberController.expanded =
      _expandInputPhoneNumber(viewModel);
  _expandableCodeController.expanded = _expandInputCode(viewModel);

  return Scaffold(
    key: _scaffoldKey,
    backgroundColor: theme ?? Colors.white,
    appBar: AppBar(
        backgroundColor: theme ?? Colors.white,
        elevation: 1,
        leadingWidth: 0,
        automaticallyImplyLeading: false,
        centerTitle: false,
        toolbarHeight: 40,
        title: FixedScaleText(
          text: Text(
            title,
            style: TextStyle(
              color: theme != null
                  ? complementary(theme!)
                  : Colors.grey.shade800,
              fontSize: 16,
            ),
          ),
        ),
        actions: [
          InkWell(
            onTap: () {
              String? result;
              if (viewModel.state == PhoneVerificationState.verifiedCode) {
                result = viewModel.phoneNumber.phoneNumber;
              }
              Navigator.of(context).pop(result);
            },
            child: Container(
              padding: EdgeInsets.all(8),
              child: Icon(
                Icons.close,
                color: Colors.grey.shade800,
                size: 20,
              ),
            ),
          )
        ]),
    body: SafeArea(
      child: Column(children: [
        _inputPhoneNumber(context, viewModel),
        _inputCode(context),
        _message(context),
        _buttons(context),
      ]),
    ),
  );
}