getWarnAltCb method

void getWarnAltCb({
  1. double? width,
  2. String? title,
  3. String? msg,
  4. String? lang,
  5. required Function callBack,
})

Implementation

void getWarnAltCb({double? width, String? title, String? msg, String? lang, required Function callBack}) {
  // ignore: no_leading_underscores_for_local_identifiers
  String _tempMsg = '';
  // ignore: no_leading_underscores_for_local_identifiers
  String _tempTitle = '';

  _tempMsg = msg ?? 'Warning';
  _tempTitle = title ?? (lang == 'ko' ? '경고' : 'Warning');

  Get.dialog(AlertDialog(
    title: Text(
      _tempTitle,
      style: const TextStyle(fontSize: 20, fontWeight: FontWeight.w700),
      textAlign: TextAlign.center,
    ),
    content: SingleChildScrollView(
      child: SizedBox(
        width: width ?? 200,
        child: ListBody(
          //List Body를 기준으로 Text 설정a
          children: <Widget>[
            Center(
              child: Image.asset(
                '$kImagePath/icon_warning.png',
                package: 'rflutter_alert',
                width: 50,
                height: 50,
              ),
            ),
            const SizedBox(height: 40),
            Text(
              _tempMsg,
              style: const TextStyle(fontSize: 20, fontWeight: FontWeight.w400),
              textAlign: TextAlign.center,
            ),
          ],
        ),
      ),
    ),
    actions: [
      Column(
        children: [
          Align(
            alignment: Alignment.center,
            child: ElevatedButton(
              style: ElevatedButton.styleFrom(
                elevation: 0,
                minimumSize: const Size(100, 40),
              ),
              child: Text(
                lang == 'ko' ? '확인' : 'Ok',
                textAlign: TextAlign.center,
              ),
              onPressed: () {
                Get.back();
                callBack();
              },
            ),
          ),
          const SizedBox(height: 20),
        ],
      ),
    ],
  ));
}