How can I use 'flutter_screenutil' and 'monarch' together?

53 views Asked by At

I am trying to use Monarch into my new project.

Widget paid() => HistoryItem(Paid(
                orderDate: '2023-11-10',
                subscriptionType: 1,
                orderId: '3YMU5SCEP57H',
                orderPrice: 10000,
                orderProduct: 'Vitamin C'));

However, it doesn't seem work with flutter_screenutil.

It shows

'LateInitializationError: Field '_minTextApdapt@1810084504' has not been initialized. See also: https://flutter.dev/docs/testing/errors

14.sp doesn't work and ScreenUtil().setSp(14) also doesn't work.

So, How can I fix this issue? enabling minTextAdapt doesn't work either.

1

There are 1 answers

0
c-an On

I just wrapped the widget with ScreenUtilInit().

Widget paid() => ScreenUtilInit(
    child: MaterialApp(
        home: Scaffold(
            body: HistoryItem(Paid(
                orderDate: '2023-11-10',
                subscriptionType: 1,
                orderId: '3YMU5SCEP57H',
                orderPrice: 10000,
                orderProduct: 'Vitamin C')))));