in the following code i want to extract the value of book,chapter and ver and concatenate from the each drop down menu.So, please do help me on where should I implement the concatenation of three string and get them as one value. For an example : if book= john, chapter=3, and ver=16, I should be able to get "john 3:16".
import 'package:flutter/material.dart';
import 'ExpandedListAnimationWidget.dart';
import 'Scrollbar.dart';
class DropDown extends StatefulWidget {
@override
_DropDownState createState() => _DropDownState();
}
List<String> _book = [
'Genesis',
'Exodus',
'Leviticus',
'Numbers',
'Deuteronomy',
'Joshua',
'Judges',
'Ruth',
'1 Samuel',
'2 Samuel',
'1 Kings',
'2 Kings',
'1 Chronicles',
'2 Chronicles',
'Ezra',
'Nehemiah',
'Esther',
'Job',
'Psalms',
'Proverbs',
'Ecclesiastes',
'Song of Solomon',
'Isaiah',
'Jeremiah',
'Lamentations',
'Ezekiel',
'Daniel',
'Hosea',
'Joel',
'Amos',
'Obadiah',
'Jonah',
'Micah',
'Nahum',
'Habakkuk',
'Zephaniah',
'Haggai',
'Zechariah',
'Malachi',
'Matthew',
'Mark',
'Luke',
'John',
'Acts',
'Romans',
'1 Corinthians',
'2 Corinthians',
'Galatians',
'Ephesians',
'Philippians',
'Colossians',
'1 Thessalonians',
'2 Thessalonians',
'1 Timothy',
'2 Timothy',
'Titus',
'Philemon',
'Hebrew',
'James',
'1 Peter',
'2 Peter',
'1 John',
'2 John',
'3 John',
'Jude',
'Revelation'
];
List<String> _chapter = [
'1',
'2',
'3',
'4',
'5',
'6',
'7',
'8',
'9',
'10',
'11',
'12',
'13',
'14',
'15',
'16',
'17',
'18',
'19',
'20',
'21',
'22',
'23',
'24',
'25',
'26',
'27',
'28',
'29',
'30',
'31',
'32',
'33',
'34',
'35',
'36',
'37',
'38',
'39',
'40',
'41',
'42',
'43',
'44',
'45',
'46',
'47',
'48',
'49',
'50',
'51',
'52',
'53',
'54',
'55',
'56',
'57',
'58',
'59',
'60',
'61',
'62',
'63',
'64',
'65',
'66',
'67',
'68',
'69',
'70',
'71',
'72',
'73',
'74',
'75',
'76',
'77',
'78',
'79',
'80',
'81',
'82',
'83',
'84',
'85',
'86',
'87',
'88',
'89',
'90',
'91',
'92',
'93',
'94',
'95',
'96',
'97',
'98',
'99',
'100',
'101',
'102',
'103',
'104',
'105',
'106',
'107',
'108',
'109',
'110',
'111',
'112',
'113',
'114',
'115',
'116',
'117',
'118',
'119',
'120',
'121',
'122',
'123',
'124',
'125',
'126',
'127',
'128',
'129',
'130',
'131',
'132',
'133',
'134',
'135',
'136',
'137',
'138',
'139',
'140',
'141',
'142',
'143',
'144',
'145',
'146',
'147',
'148',
'149',
'150'
];
List<String> _verse = [
'1',
'2',
'3',
'4',
'5',
'6',
'7',
'8',
'9',
'10',
'11',
'12',
'13',
'14',
'15',
'16',
'17',
'18',
'19',
'20',
'21',
'22',
'23',
'24',
'25',
'26',
'27',
'28',
'29',
'30',
'31',
'32',
'33',
'34',
'35',
'36',
'37',
'38',
'39',
'40',
'41',
'42',
'43',
'44',
'45',
'46',
'47',
'48',
'49',
'50',
'51',
'52',
'53',
'54',
'55',
'56',
'57',
'58',
'59',
'60',
'61',
'62',
'63',
'64',
'65',
'66',
'67',
'68',
'69',
'70',
'71',
'72',
'73',
'74',
'75',
'76',
'77',
'78',
'79',
'80',
'81',
'82',
'83',
'84',
'85',
'86',
'87',
'88',
'89',
'90',
'91',
'92',
'93',
'94',
'95',
'96',
'97',
'98',
'99',
'100',
'101',
'102',
'103',
'104',
'105',
'106',
'107',
'108',
'109',
'110',
'111',
'112',
'113',
'114',
'115',
'116',
'117',
'118',
'119',
'120',
'121',
'122',
'123',
'124',
'125',
'126',
'127',
'128',
'129',
'130',
'131',
'132',
'133',
'134',
'135',
'136',
'137',
'138',
'139',
'140',
'141',
'142',
'143',
'144',
'145',
'146',
'147',
'148',
'149',
'150'
];
class _DropDownState extends State<DropDown> {
bool isStrechedDropDown = false;
String book;
String ver;
String chapter;
int bookValue;
int chapterValue;
int verseValue;
String title = 'Select Book';
@override
Widget build(BuildContext context) {
return Scaffold(
extendBodyBehindAppBar: true,
appBar: AppBar(
title: Text(
"Retrieve Bible Verse ",
style: TextStyle(color: Colors.black),
),
centerTitle: true,
backgroundColor: Colors.transparent,
elevation: 0,
iconTheme: IconThemeData(color: Colors.black),
),
body: SafeArea(
child: Container(
height: double.infinity,
width: double.infinity,
padding: EdgeInsets.symmetric(vertical: 10, horizontal: 20),
child: SingleChildScrollView(
child: Column(children: [
Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Expanded(
child: Container(
decoration: BoxDecoration(
border: Border.all(color: Color(0xffbbbbbb)),
borderRadius: BorderRadius.all(Radius.circular(27))),
child: Column(
children: [
Container(
height: 40,
width: double.infinity,
padding: EdgeInsets.only(right: 10),
decoration: BoxDecoration(
border: Border.all(
color: Color(0xffbbbbbb),
),
borderRadius:
BorderRadius.all(Radius.circular(25))),
constraints: BoxConstraints(
minHeight: 30,
minWidth: double.infinity,
),
alignment: Alignment.center,
child: Row(
mainAxisAlignment:
MainAxisAlignment.spaceBetween,
children: [
Expanded(
child: Padding(
padding: const EdgeInsets.symmetric(
horizontal: 20, vertical: 10),
child: Text(
title,
),
),
),
GestureDetector(
onTap: () {
setState(() {
isStrechedDropDown =
!isStrechedDropDown;
book;
});
},
child: Icon(isStrechedDropDown
? Icons.arrow_upward
: Icons.arrow_downward))
],
)),
ExpandedSection(
expand: isStrechedDropDown,
height: 30,
child: MyScrollbar(
builder: (context, scrollController1) =>
ListView.builder(
padding: EdgeInsets.all(0),
controller: scrollController1,
shrinkWrap: true,
itemCount: _book.length,
itemBuilder: (context, index) {
return RadioListTile(
title: Text(_book.elementAt(index)),
value: index,
groupValue: bookValue,
onChanged: (val) {
setState(() {
bookValue = val;
book = _book.elementAt(index);
print(book);
});
});
}),
),
),
//Text("Please Select Chapter"),
Container(
height: 40,
width: double.infinity,
padding: EdgeInsets.only(right: 10),
decoration: BoxDecoration(
border: Border.all(
color: Color(0xffbbbbbb),
),
borderRadius:
BorderRadius.all(Radius.circular(25))),
constraints: BoxConstraints(
minHeight: 30,
minWidth: double.infinity,
),
alignment: Alignment.center,
child: Row(
mainAxisAlignment:
MainAxisAlignment.spaceBetween,
children: [
Expanded(
child: Padding(
padding: const EdgeInsets.symmetric(
horizontal: 20, vertical: 10),
child: Text("Select Chapter"),
),
),
GestureDetector(
onTap: () {
setState(() {
isStrechedDropDown =
!isStrechedDropDown;
chapter;
});
},
child: Icon(isStrechedDropDown
? Icons.arrow_upward
: Icons.arrow_downward))
],
)),
ExpandedSection(
expand: isStrechedDropDown,
height: 30,
child: MyScrollbar(
builder: (context, scrollController2) =>
ListView.builder(
padding: EdgeInsets.all(0),
controller: scrollController2,
shrinkWrap: true,
itemCount: _chapter.length,
itemBuilder: (context, index) {
return RadioListTile(
title:
Text(_chapter.elementAt(index)),
value: index,
groupValue: chapterValue,
onChanged: (chap) {
setState(() {
chapterValue = chap;
chapter =
_chapter.elementAt(index);
print(chapter);
});
});
}),
),
),
Container(
height: 40,
width: double.infinity,
padding: EdgeInsets.only(right: 10),
decoration: BoxDecoration(
border: Border.all(
color: Color(0xffbbbbbb),
),
borderRadius:
BorderRadius.all(Radius.circular(25))),
constraints: BoxConstraints(
minHeight: 30,
minWidth: double.infinity,
),
alignment: Alignment.center,
child: Row(
mainAxisAlignment:
MainAxisAlignment.spaceBetween,
children: [
Expanded(
child: Padding(
padding: const EdgeInsets.symmetric(
horizontal: 20, vertical: 10),
child: Text("Select Verse"),
),
),
GestureDetector(
onTap: () {
setState(() {
isStrechedDropDown =
!isStrechedDropDown;
ver;
});
},
child: Icon(isStrechedDropDown
? Icons.arrow_upward
: Icons.arrow_downward))
],
)),
ExpandedSection(
expand: isStrechedDropDown,
height: 30,
child: MyScrollbar(
builder: (context, scrollController3) =>
ListView.builder(
padding: EdgeInsets.all(0),
controller: scrollController3,
shrinkWrap: true,
itemCount: _verse.length,
itemBuilder: (context, index) {
return RadioListTile(
title:
Text(_verse.elementAt(index)),
value: index,
groupValue: verseValue,
onChanged: (verse) {
setState(() {
verseValue = verse;
ver = _verse.elementAt(index);
print(ver);
});
});
}),
),
),
],
),
),
),
],
),
]),
),
)));
}
}
CodePudding user response:
Just book " " chapter ":" verse
should do it. It's elementary string concatenation.
CodePudding user response:
Just try with this
"$book $chapter:$verse"