[flutter] flutter toast custom

박망키·2022년 5월 24일
0

Flutter 야금야금 먹기

목록 보기
50/97
post-custom-banner
<script>


import 'package:flutter/material.dart';
import 'package:fluttertoast/fluttertoast.dart';
import '../../theme/color.dart';

//사용  - toast(context,'촤대 2개까지 선택 가능합니다');

void toast(context,text) {
  final fToast = FToast();
  fToast.init(context);
  Widget toast = Container(
    padding: const EdgeInsets.symmetric(horizontal: 24.0, vertical: 12.0),
    decoration: BoxDecoration(
      borderRadius: BorderRadius.circular(8.0),
      color: Colors.black,
    ),
    child: Text(text,style: TextStyle(color:Colors.white)),
  );

  fToast.showToast(
    child: toast,
    toastDuration: const Duration(seconds: 1),
      positionedToastBuilder: (context, child) {
        return Stack(
          alignment: Alignment.center,
          children: [
            Positioned(
              child: child,
              bottom: 100,
            ),
          ],
        );
      }
  );
}


</script>

profile
무럭무럭 자라는 망키
post-custom-banner

0개의 댓글