0

Widget doesn't work properly in the release version of Flutter,

In the debug mode: the widget works properly as I desired.

In release mode: the widget of the card is a bit messy when launching the app for the first time, it only works when I navigate other tab and I get back to that tab.

Command used : flutter build apk


Code provided below:

import 'package:course_app/constants.dart';
import 'package:flutter/material.dart';
import 'package:percent_indicator/circular_percent_indicator.dart';

class CategoryCard extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    Size size = MediaQuery.of(context).size;
    return Container(
      height: size.height * 0.18,
      width: size.width * 0.3,
      decoration: BoxDecoration(
          color: Colors.white,
          borderRadius: BorderRadius.circular(4),
          boxShadow: [
            BoxShadow(
                offset: const Offset(1, 1),
                blurRadius: 5,
                color: Colors.grey.withOpacity(0.3)),
          ]),
      child: Column(children: [
        SizedBox(
          height: size.height * 16 / 780,
        ),
        CircularPercentIndicator(
          radius: size.height * 30/780,
          lineWidth: 5.0,
          percent: 0.5,
          center: Text("100%", style: TextStyle(fontSize: size.height * 14/780),),
          animation: true,
          progressColor: kPrimaryColor,
        ),
        SizedBox(
          height: size.height * 14 / 780,
        ),
        Text(
          "Makanan",
          style: TextStyle(fontSize: size.height * 16 / 780),
        ),
        SizedBox(
          height: size.height * 4 / 780,
        ),
        Text(
          "Rp. 30.000",
          style: TextStyle(fontSize: size.height * 14 / 780, color: Colors.black.withOpacity(0.6)),
        ),
      ]),
    );
  }
}


Release version:


Debug version:

Francesco - FL
  • 603
  • 1
  • 4
  • 25

1 Answers1

0

When we run the code in debug mode the code might run even with some issues or conflicts. That is not the case in release mode. I would suggest you to check your logs when you are running the code in debug mode. That might help you identify where the problem is.

You can share the error log with us so we can try to figure out where the issue is.

Anusha
  • 1
  • 2