Reputation: 429
I'am working on a project in which I have to dynamic populate an icon widget with the icon code read from our webservice.
The thing is that when i'm in debug mode, everything works perfectly and the icons are shown as expected, but as soon as I build the production release apk, it does not show some icons anymore. Here is my widget code.
@override
Widget build(BuildContext context) {
var theme = Theme.of(context);
return Scaffold(
backgroundColor: CustomColors.primaryVariant,
appBar: AppBar(
title: Text(widget.title ?? ''),
backgroundColor: CustomColors.primary,
),
body: Container(
color: CustomColors.primary,
height: MediaQuery.of(context).size.height,
child: Stack(
children: [
Visibility(
visible: items.length > 0,
child: ListView.builder(
shrinkWrap: true,
itemCount: items.length,
itemBuilder: (context, index) {
var item = items[index];
return Card(
color: CustomColors.primaryVariant,
elevation: 5.0,
margin: new EdgeInsets.symmetric(vertical: .5),
child: Container(
child: ListTile(
leading: Container(
padding: EdgeInsets.only(right: 12.0),
decoration: new BoxDecoration(
border: new Border(
right: new BorderSide(
width: 1.0, color: Colors.white24))),
child: Icon(CustomIcon(item.code), color: Colors.white),
),
title: Text(
item.detail.capitalize(),
style: TextStyle(color: Colors.white, fontSize: 16),
),
subtitle: Text(
item.item,
style: TextStyle(color: Colors.white70, fontSize: 14),
),
),
),
);
},
),
),
Visibility(
visible: items.length == 0,
child: ListView.builder(
shrinkWrap: true,
itemCount: 4,
itemBuilder: (context, index) {
return Card(
color: CustomColors.primaryVariant,
elevation: 5.0,
margin: new EdgeInsets.symmetric(vertical: .5),
child: Container(
child: ListTile(
leading: Container(
padding: EdgeInsets.only(right: 12.0),
decoration: new BoxDecoration(
border: new Border(
right: new BorderSide(
width: 1.0, color: Colors.white24))),
child: ShimmerSkeleton(
height: 20,
width: 20,
),
),
title: SizedBox(
width: 60,
child: ShimmerSkeleton(
height: 20,
width: 60,
),
),
subtitle: Padding(
padding: EdgeInsets.only(top: 5),
child: ShimmerSkeleton(
width: 90,
),
),
),
),
);
},
),
),
Positioned(
bottom: 0,
left: MediaQuery.of(context).size.width * 0.5 - 130,
child: Container(
margin: EdgeInsets.symmetric(vertical: 25),
child: Opacity(
opacity: .8,
child: SizedBox(
height: 60,
width: MediaQuery.of(context).size.width,
child: ListTile(
leading: CircleAvatar(
radius: 26,
backgroundImage: AssetImage('assets/img/rodal.jpg'),
),
title: Text(
'SUPPORTED BY',
style: theme.textTheme.title.copyWith(
fontWeight: FontWeight.w600, fontSize: 14),
),
subtitle: Text(
'Rodaltech, SRL',
style: theme.textTheme.title.copyWith(
fontWeight: FontWeight.w600, fontSize: 20),
),
),
),
),
),
)
],
),
),
);
}
}
class CustomIcon extends IconData {
CustomIcon(int codePoint) : super(codePoint, fontFamily: 'MaterialIcons');
}
And my ItemDetail Model:
class ItemDetail {
ItemDetail({
this.code,
this.item,
this.detail,
});
int code;
String item;
String detail;
ItemDetail copyWith({
int code,
String item,
String detail,
}) =>
ItemDetail(
code: code ?? this.code,
item: item ?? this.item,
detail: detail ?? this.detail,
);
factory ItemDetail.fromJson(Map<String, dynamic> json) =>
ItemDetail(
code: json["code"] == null ? null : json["code"],
item: json["item"] == null ? null : json["item"],
detail: json["detail"] == null ? null : json["detail"],
);
Map<String, dynamic> toJson() => {
"code": code == null ? null : code,
"item": item == null ? null : item,
"detail": detail == null ? null : detail,
};
}
Also added the screen shots for debug mode and production mode:
Upvotes: 0
Views: 809