I have a list with widget constructors which are strings, that are used in different classes. The list consists of 39 labels and these 39 labels have different text some pages will have only 7 labels, how during iteration can i show only the number of labels that the class displays as a string?
List<String> tests;
// @override
// void initState() {
// super.initState(); tests = [widget.label00, widget.label0]; }
@override
void initState() {
super.initState();
tests = [
widget.label00,
widget.label0,
widget.label1,
widget.label2,
widget.label3,
widget.label4,
widget.label5,
widget.label6,
widget.label7,
widget.label8,
widget.label9,
widget.label10,
widget.label11,
widget.label12,
widget.label13,
widget.label14,
widget.label15,
widget.label16,
widget.label17,
widget.label18,
widget.label19,
widget.label20,
widget.label21,
widget.label22,
widget.label23,
widget.label24,
widget.label25,
widget.label26,
widget.label27,
widget.label28,
widget.label29,
widget.label30,
widget.label31,
widget.label32,
widget.label33,
widget.label34,
widget.label35,
widget.label36,
widget.label37,
widget.label38,
widget.label39
];
// List<ReusableLarge> translationTextsss = [
// ReusableLarge(label00: "test00"),
// ReusableLarge(label0: "test0"),
// ReusableLarge(label1: 'test1'),
// ReusableLarge(label2: 'test2'),
// // ),
// ];
Timer.periodic(Duration(seconds: 5), (Timer timer) {
if (widget.label7 == '') {
setState(() {
tests.length - 1;
});
if (_currentPage < tests.length) {
_currentPage++;
} else {
_currentPage = 0;
}
_pageController.animateToPage(
_currentPage,
duration: Duration(milliseconds: 350),
curve: Curves.easeIn,
);
}
});
}
and one of the classes that show the strings:
how can i do it so the cards that have label: '' to not display?? I tried tests.length-1 but its showing a swiggly lines i want the tests.length to change based on whether that label contains a string or not.
label00: 'Surah Fatiha' + '
' + 'The Opening',
label0: 'In the name of God, the Lord of Mercy, the Giver of Mercy!',
label1: 'AYAH 1: Praise belongs to God, Lord of the Worlds,',
label2: 'AYAH 2: the Lord of Mercy, the Giver of Mercy,',
label3: 'AYAH 3: Master of the Day of Judgement.',
label4: 'AYAH 4: It is You we worship; it is You we ask for help.',
label5: 'AYAH 5: Guide us to the straight path:',
label6:
'AYAH 6: the path of those You have blessed, those who incur no anger and who have not gone astray.',
label7: '',
label8: 'label8',
label9: '',
label10: '',
label11: '',
label12: '',
label13: '',
label14: '',
label15: '',
label16: "",
label17: '',
label18: '',
label19: '',
label20: '',
label21: '',
label22: '',
label23: '',
label24: '',
label25: '',
label26: '',
label27: "",
label28: '',
label29: '',
label30: '',
label31: '',
label32: '',
label33: '',
label34: '',
label35: '',
label36: '',
label37: '',
label38: '',
label39: '',
See Question&Answers more detail:
os