primaryContactInfo function

void primaryContactInfo({
  1. required BuildContext context,
  2. required bool isPhone,
  3. required ContactInfoType contactType,
  4. required String value,
})

opens a bottom sheet to show instructions on how to change a primary contact

Implementation

void primaryContactInfo(
    {required BuildContext context,
    required bool isPhone,
    required ContactInfoType contactType,
    required String value}) {
  showModalBottomSheet(
      context: context,
      barrierColor: Colors.black.withOpacity(0.2),
      elevation: 1,
      builder: (BuildContext context) {
        final String instructions =
            isPhone ? phoneChangeInstructions : emailChangeInstructions;
        return SingleChildScrollView(
          child: Container(
            height: 260,
            padding: const EdgeInsets.all(20),
            color: Colors.white,
            child: Column(
              crossAxisAlignment: CrossAxisAlignment.start,
              children: <Widget>[
                Container(
                  padding:
                      const EdgeInsets.symmetric(horizontal: 10, vertical: 8),
                  decoration: BoxDecoration(
                    color: const Color(0xFF1ba376).withOpacity(0.2),
                    borderRadius: BorderRadius.circular(25),
                  ),
                  child: Text(
                      (contactType == ContactInfoType.phone)
                          ? phoneTitle
                          : emailTitle,
                      style:
                          TextThemes.heavySize10Text(const Color(0xFF1ba376))),
                ),
                smallVerticalSizedBox,
                Text(
                  value,
                  style: TextThemes.normalSize14Text(),
                ),
                mediumVerticalSizedBox,
                Text(
                  instructions,
                  style: TextThemes.normalSize12Text().copyWith(height: 1.6),
                ),
                largeVerticalSizedBox,
                GestureDetector(
                  key: const Key('close_key'),
                  onTap: () {
                    Navigator.pop(context);
                  },
                  child: Text(
                    closeText,
                    style: TextThemes.heavySize14Text(Colors.red),
                  ),
                ),
              ],
            ),
          ),
        );
      });
}