build method

  1. @override
Widget build(
  1. BuildContext context
)
override

Builds the UI of the AudioModeSelectDialog

Implementation

@override
Widget build(BuildContext context) {
  String message = "Select the audio mode";
  return AlertDialog(
    shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(12)),
    actionsPadding: const EdgeInsets.only(left: 20, right: 20, bottom: 10),
    backgroundColor: themeBottomSheetColor,
    insetPadding: const EdgeInsets.symmetric(horizontal: 20, vertical: 8),
    contentPadding: const EdgeInsets.only(
      top: 20,
      bottom: 15,
      left: 24,
      right: 24,
    ),
    title: Column(
      crossAxisAlignment: CrossAxisAlignment.start,
      children: [
        HMSTitleText(
          text: "Change Audio Mode",
          fontSize: 20,
          letterSpacing: 0.15,
          textColor: themeDefaultColor,
        ),
        const SizedBox(height: 8),
        HMSSubtitleText(text: message, textColor: themeSubHeadingColor),
      ],
    ),
    content: Column(
      crossAxisAlignment: CrossAxisAlignment.start,
      mainAxisSize: MainAxisSize.min,
      children: [
        Container(
          padding: const EdgeInsets.only(left: 10, right: 5),
          decoration: BoxDecoration(
            color: themeSurfaceColor,
            borderRadius: BorderRadius.circular(10.0),
            border: Border.all(
              color: borderColor,
              style: BorderStyle.solid,
              width: 0.80,
            ),
          ),
          child: DropdownButtonHideUnderline(
            child: HMSDropDown(
              dropDownItems: <DropdownMenuItem>[
                ...HMSAudioMode.values
                    .map(
                      (audioMode) => DropdownMenuItem(
                        value: audioMode,
                        child: HMSTitleText(
                          text: audioMode.name,
                          textColor: themeDefaultColor,
                          fontWeight: FontWeight.w400,
                        ),
                      ),
                    )
                    .toList(),
              ],
              iconStyleData: IconStyleData(
                icon: const Icon(Icons.keyboard_arrow_down),
                iconEnabledColor: themeDefaultColor,
              ),
              selectedValue: valueChoose,
              updateSelectedValue: _updateDropDownValue,
            ),
          ),
        ),
      ],
    ),
    actions: [
      Row(
        mainAxisAlignment: MainAxisAlignment.spaceBetween,
        children: [
          ElevatedButton(
            style: ButtonStyle(
              shadowColor: WidgetStateProperty.all(themeSurfaceColor),
              backgroundColor: WidgetStateProperty.all(
                themeBottomSheetColor,
              ),
              shape: WidgetStateProperty.all<RoundedRectangleBorder>(
                RoundedRectangleBorder(
                  side: const BorderSide(
                    width: 1,
                    color: Color.fromRGBO(107, 125, 153, 1),
                  ),
                  borderRadius: BorderRadius.circular(8.0),
                ),
              ),
            ),
            onPressed: () => Navigator.pop(context, false),
            child: Padding(
              padding: const EdgeInsets.symmetric(
                vertical: 12,
                horizontal: 10,
              ),
              child: Text(
                'Cancel',
                style: HMSTextStyle.setTextStyle(
                  color: themeDefaultColor,
                  fontSize: 16,
                  fontWeight: FontWeight.w600,
                  letterSpacing: 0.50,
                ),
              ),
            ),
          ),
          ElevatedButton(
            style: ButtonStyle(
              shadowColor: WidgetStateProperty.all(themeSurfaceColor),
              backgroundColor: WidgetStateProperty.all(hmsdefaultColor),
              shape: WidgetStateProperty.all<RoundedRectangleBorder>(
                RoundedRectangleBorder(
                  side: BorderSide(width: 1, color: hmsdefaultColor),
                  borderRadius: BorderRadius.circular(8.0),
                ),
              ),
            ),
            onPressed: () => {
              if (valueChoose == null)
                {Utilities.showToast("Please select audioMode")}
              else
                {
                  Navigator.pop(context),
                  widget.changeAudioMode(valueChoose!),
                },
            },
            child: Padding(
              padding: const EdgeInsets.symmetric(
                vertical: 12,
                horizontal: 10,
              ),
              child: Text(
                'Change',
                style: HMSTextStyle.setTextStyle(
                  color: themeDefaultColor,
                  fontSize: 16,
                  fontWeight: FontWeight.w600,
                  letterSpacing: 0.50,
                ),
              ),
            ),
          ),
        ],
      ),
    ],
  );
}