Created
June 13, 2019 04:36
-
-
Save SouravKumarPandit/a6c6066b41c135ba148295c4546552a2 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'package:flutter/material.dart'; | |
typedef Widget CLListItemBuilder(BuildContext context, String itemString); | |
class CLCustomItemRow extends StatefulWidget { | |
final CLListItemBuilder clListItemBuilder; | |
final Widget child; | |
final List<String> itemList; | |
CLCustomItemRow({ | |
@required this.clListItemBuilder, | |
@required this.itemList = const [], | |
this.child, | |
}); | |
@override | |
CustomItemRow createState() { | |
return CustomItemRow(); | |
} | |
} | |
class CustomItemRow extends State<CLCustomItemRow> { | |
@override | |
Widget build(BuildContext context) { | |
return Container( | |
padding: const EdgeInsets.all(8.0), | |
child: InkWell( | |
onTap: (){}, | |
child: Column( | |
children: <Widget>[ | |
getItemRow(widget.itemList[0], widget.itemList[1], 1), | |
getItemRow(widget.itemList[2], widget.itemList[3], 2), | |
Divider( | |
color: Theme.of(context).primaryColor, | |
) | |
], | |
), | |
), | |
); | |
} | |
Row getItemRow(String s1, String s2, int iColumNo) { | |
return Row( | |
children: <Widget>[ | |
Expanded( | |
child: Text( | |
s1 ?? '', | |
style: iColumNo == 1 | |
? TextStyle( | |
color: Colors.black, | |
fontWeight: FontWeight.bold, | |
fontSize: 16) | |
: TextStyle(color: Colors.grey, fontSize: 14), | |
maxLines: 2, | |
), | |
flex: 6, | |
), | |
Expanded( | |
flex: 1, | |
child: Container(), | |
), | |
Expanded( | |
flex: 3, | |
child: Text( | |
s2 ?? '', | |
textAlign: TextAlign.end, | |
style: TextStyle( | |
color: Colors.grey, fontWeight: FontWeight.bold, fontSize: 12), | |
), | |
) | |
], | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment