Related
I am trying to validate the values of password field and confirm password field.
how to validate entered password and confirm password are same in flutter.
The edited text value could not be taken as value so couldn't find the solution.
import 'package:flutter/material.dart';
import 'package:form_field_validator/form_field_validator.dart';
import 'package:loginform_validation_demo/LoginFormWithValidation.dart';
import 'validation.dart';
import 'HomePage.dart';
class SignupPage extends StatelessWidget {
GlobalKey<FormState> formkey = GlobalKey<FormState>();
#override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: Colors.white,
appBar: AppBar(
elevation: 0,
brightness: Brightness.light,
backgroundColor: Colors.white,
leading: IconButton(
onPressed: () {
Navigator.pop(context);
},
icon: Icon(
Icons.arrow_back_ios,
size: 20,
color: Colors.black,
)),
),
body: SafeArea(
child: Form(
autovalidateMode: AutovalidateMode.always,
key: formkey,
child: SingleChildScrollView(
child: Container(
height: MediaQuery.of(context).size.height,
width: double.infinity,
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Column(
children: [
Column(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [
SizedBox(
height: 40,
),
Text(
"Sign up",
style: TextStyle(
fontSize: 30,
fontWeight: FontWeight.bold,
),
),
SizedBox(
height: 20,
),
Text(
"Create an Account,Its free",
style: TextStyle(
fontSize: 15,
color: Colors.grey[700],
),
),
SizedBox(
height: 30,
)
],
),
Padding(
padding: EdgeInsets.symmetric(horizontal: 40),
child: Column(
children: [
usernameMakeInput(label: "User Name"),
passwordMakeInput(label: "Password", obsureText: true),
passwordMakeInput(label: "Confirm Password", obsureText: true)
],
),
),
Padding(
padding: EdgeInsets.symmetric(horizontal: 40),
child: Container(
height: 50,
width: 200,
child: MaterialButton(
minWidth: double.infinity,
height: 50,
onPressed: () {
if (formkey.currentState.validate()) {
Navigator.push(
context,
MaterialPageRoute(
builder: (_) => HomePage()));
print("Validated");
} else {
print("Not Validated");
}
},
color: Colors.blue,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(20)),
child: Text(
"Sign Up",
style: TextStyle(
fontWeight: FontWeight.w600,
fontSize: 18,
color: Colors.white),
),
),
),
),
SizedBox(
height: 20,
),
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text(
"Already have an account?",
style: TextStyle(fontSize: 15),
),
TextButton(
onPressed: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) =>
LoginFormValidation()),
);
},
child: Text(
'Login',
style:
TextStyle(color: Colors.blue, fontSize: 18),
),
),
],
)
],
),
],
),
),
),
),
),
);
}
}
validation:
This is the part where I try to pass the edit text value
Widget passwordMakeInput({label, obsureText = false}) {
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
label,
style: TextStyle(
fontSize: 15, fontWeight: FontWeight.w400, color: Colors.black87),
),
SizedBox(
height: 5,
),
TextFormField(
onChanged: (value){
},
maxLength: 6,
obscureText: obsureText,
decoration: InputDecoration(
contentPadding: EdgeInsets.symmetric(vertical: 0, horizontal: 10),
border: OutlineInputBorder(),
),
validator: MultiValidator([
RequiredValidator(errorText: "* Required"),
MinLengthValidator(6,
errorText: "Password should contain 6 characters"),
])),
SizedBox(
height: 30,
)
],
);
}
I'm new on flutter, I have 2 screens and I have tried a lot to fix the problems and make this code run, the error shows when I tried to push arguments in the constructor to BmiResultScreen
BmiScreen code (which i need to get the values from):
import 'dart:math';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'bmi_result_screen.dart';
class BmiScreen extends StatefulWidget {
#override
_BmiScreenState createState() => _BmiScreenState();
}
class _BmiScreenState extends State<BmiScreen> {
bool isMale = true;
double height = 120.0;
int age = 0;
double weight = 0.0;
#override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: const Text('BMI Calculator'),
),
body: Column(
children: [
Expanded(
child: Padding(
padding: const EdgeInsets.all(20.0),
child: Row(children: [
Expanded(
child: GestureDetector(
onTap: (){
setState(() {
isMale = true;
});
},
child: Container(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: const [
Image(
image: AssetImage('assets/images/male.png'),
height: 90.0,
width: 90.0,
),
SizedBox(
height: 15.0,
),
Text('MALE',
style: TextStyle(
fontSize: 25.0, fontWeight: FontWeight.bold))
],
),
decoration: BoxDecoration(
color: isMale ? Colors.blue : Colors.grey[400],
borderRadius: BorderRadiusDirectional.circular(10.0)),
),
),
),
SizedBox(
width: 20.0,
),
Expanded(
child: GestureDetector(
onTap: () {
setState(() {
isMale = false;
});
},
child: Container(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: const [
Image(
image: AssetImage('assets/images/female.png'),
height: 90,
width: 90,
),
SizedBox(
height: 15.0,
),
Text('FEMALE',
style: TextStyle(
fontSize: 25.0, fontWeight: FontWeight.bold))
],
),
decoration: BoxDecoration(
color: !isMale ? Colors.blue : Colors.grey[400],
borderRadius: BorderRadiusDirectional.circular(10.0)),
),
),
),
]),
)),
Expanded(
child: Padding(
padding: const EdgeInsets.symmetric(
horizontal: 20.0
),
child: Container(
decoration: BoxDecoration(
color: Colors.grey[400],
borderRadius: BorderRadiusDirectional.circular(10.0)
),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text('HEIGHT',
style:
TextStyle(fontSize: 25.0, fontWeight: FontWeight.bold)),
Row(
crossAxisAlignment: CrossAxisAlignment.baseline,
textBaseline: TextBaseline.alphabetic,
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text(
'${height.round()}',
style: TextStyle(
fontSize: 50.0,
fontWeight: FontWeight.w900,
)
),
SizedBox(
width: 5.0,
),
Text(
'cm',
style: TextStyle(
fontSize: 20.0,
fontWeight: FontWeight.w900
),
),
],
),
Slider(
value: height,
max: 220.0,
min: 80.0,
onChanged: (value) {
setState(() {
height = value;
});
},
),
],
),
),
),
),
Expanded(
child: Padding(
padding: const EdgeInsets.all(20.0),
child: Row(
children: [
Expanded(
child: Container(
decoration: BoxDecoration(
color: Colors.grey[400],
borderRadius: BorderRadiusDirectional.circular(10.0)
),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text(
'WEIGHT',
style: TextStyle(
fontSize: 25.0,
fontWeight: FontWeight.bold,
)
),
SizedBox(
height: 15.0,
),
Text(
'${weight}',
style: TextStyle(
fontSize: 50.0,
fontWeight: FontWeight.w900,
)
),
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
FloatingActionButton(
onPressed: () {
setState(() {
if(weight>=0.5){
weight = weight -0.5;
}
});
},
child: Icon(
Icons.remove
),
mini: true,
heroTag: '--weight',
),
FloatingActionButton(
onPressed: () {
setState(() {
weight = weight + 0.5;
});
},
child: Icon(
Icons.add
),
mini: true,
heroTag: '++weight',
),
],
),
],
),
),
),
SizedBox(
width: 20.0,
),
Expanded(
child: Container(
decoration: BoxDecoration(
color: Colors.grey[400],
borderRadius: BorderRadiusDirectional.circular(10.0)
),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text(
'AGE',
style: TextStyle(
fontSize: 25.0,
fontWeight: FontWeight.bold,
)
),
SizedBox(
height: 15.0,
),
Text(
'${age}',
style: TextStyle(
fontSize: 50.0,
fontWeight: FontWeight.w900,
)
),
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
FloatingActionButton(
onPressed: () {
setState(() {
if(age >= 1){
--age;
}
});
},
child: Icon(
Icons.remove
),
mini: true,
heroTag: '--age',
),
FloatingActionButton(
onPressed: () {
setState(() {
++age;
});
},
child: Icon(
Icons.add
),
mini: true,
heroTag: '++age',
),
],
),
],
),
),
),
],
),
),
),
Container(
color: Colors.blue,
width: double.infinity,
height: 50.0,
child: MaterialButton(
onPressed: () {
double result = weight / pow(height/100,2);
print(result.round());
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => BmiResultScreen(
isMale: isMale,
age: age,
result: result.round(),
),
)
);
},
child: const Text('CALCULATE'),
),
),
],
),
);
}
}
BmiResultScreen code(which I'm trying to use the values comes from the last screen):
import 'package:flutter/material.dart';
import 'package:flutter/cupertino.dart';
class BmiResultScreen extends StatelessWidget {
final bool isMale;
final int result;
final int age;
BmiResultScreen({
required this.isMale,
required this.age,
required this.result,
});
#override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text(
'BMI Result'
),
),
body: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text(
'Gender: $isMale',
style: TextStyle(
fontSize: 25.0,
fontWeight: FontWeight.bold,
),
),
Text(
'Result: ${result.round()}',
style: TextStyle(
fontSize: 25.0,
fontWeight: FontWeight.bold,
),
),
Text(
'Age: $age',
style: TextStyle(
fontSize: 25.0,
fontWeight: FontWeight.bold,
),
),
],
),
)
);
}
}
Problems like this can be fixed by upgrading your flutter version or cleaning.
flutter upgrade --force
flutter clean
delete Podfile and Podfile.lock
run pub get
flutter run
Dialog is not working properly with singlechildscrollview and soft keyboard in flutter.
Problems:
Dialog design is gone under the soft keyboard
Scroll is not properly working when open soft keyboard
My dialog is here:-
Future<void> ShowMessageDetail(
BuildContext context, String name, String message, String date, int id) async {
txtController.text = message;
edit = false;
return showDialog(
context: context,
builder: (context) {
return StatefulBuilder(
builder: (BuildContext context, void Function(void Function()) setState) {
return AlertDialog(
contentPadding: EdgeInsets.only(left: 25, right: 25),
content: Wrap(
children: [
Column(
children: [
Container(
height: 50,
width: double.infinity,
color: Colors.blue,
child: Center(
child: Text(
"Detail",
style: TextStyle(color: Colors.white, fontWeight: FontWeight.bold, fontSize: 20),
)),
),
Column(
children: [
Padding(
padding: const EdgeInsets.only(top: 10, bottom: 10),
child: Row(
children: [
Text(
"Name : ",
style: TextStyle(
color: Colors.blue,
),
),
Text(name)
],
),
),
Divider(
color: Colors.grey,
),
Padding(
padding: const EdgeInsets.only(top: 10, bottom: 8),
child: Row(
children: [
Text(
"Date : ",
style: TextStyle(
color: Colors.blue,
),
),
Text(date.substring(0, 10))
],
),
),
Divider(
color: Colors.grey,
),
Padding(
padding: const EdgeInsets.only(top: 8, bottom: 8),
child: Column(
children: [
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Align(
alignment: Alignment.centerLeft,
child: Text(
"Message : ",
style: TextStyle(
color: Colors.blue,
),
),
),
Row(
children: [
Container(
decoration: BoxDecoration(
color: edit ? Colors.blue : Colors.white,
borderRadius: BorderRadius.circular(30),
border: Border.all(color: Colors.blue, width: 2),
),
child: IconButton(
onPressed: () {
setState(() {
edit ? edit = false : edit = true;
});
},
icon: Icon(
Icons.edit_outlined,
color: edit ? Colors.white : Colors.blue,
)),
),
Container(
width: 15,
),
Container(
decoration: BoxDecoration(
color: Colors.blue,
borderRadius: BorderRadius.circular(30),
),
child: IconButton(
onPressed: () {
copy(message);
},
icon: Icon(
Icons.copy,
color: Colors.white,
)),
)
],
),
],
),
ConstrainedBox(
constraints: BoxConstraints(
maxHeight: 300,
),
child: SingleChildScrollView(
scrollDirection: Axis.vertical,
child: Padding(
padding: const EdgeInsets.only(top: 10),
child: Container(
child: TextFormField(
controller: txtController,
textAlign: TextAlign.justify,
focusNode: contentFocus,
decoration: InputDecoration.collapsed(
hintText: 'Start typing...',
hintStyle: TextStyle(
color: Colors.grey.shade400,
fontSize: 16,
fontWeight: FontWeight.w500,
),
border: InputBorder.none,
),
enabled: edit ? true : false,
maxLines: null,
keyboardType: TextInputType.multiline,
style: TextStyle(
fontSize: 15,
height: 1.2,
),
),
),
),
),
)
],
),
),
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Visibility(
visible: edit ? true : false,
child: MaterialButton(
onPressed: () {
updateMessage(name, txtController.text.toString(), id);
},
color: Colors.blue,
child: Text(
"Update",
style: TextStyle(color: Colors.white, fontWeight: FontWeight.bold),
),
),
),
Container(
width: 15,
),
MaterialButton(
onPressed: () {
Navigator.pop(context);
},
color: Colors.blue,
child: Text(
"Cancel",
style: TextStyle(color: Colors.white, fontWeight: FontWeight.bold),
),
),
],
)
],
),
],
),
],
),
);
},
);
});
}
I use scrollController for scrolling but this does not work.
Please help me to solve my dialog design problem.
wrap your Alert Dialog with SingleChildScrollview
SingleChildScrollView(
child: AlertDialog());
I am Trying to build an app. which fetching the user credential data and shows in profile page. I am getting an error => Bad state: cannot get a field on a DocumentSnapshotPlatform which does not exist in the profile section need help
Widget headerProfile(BuildContext context, DocumentSnapshot snapshot) {
return SizedBox(
height: MediaQuery.of(context).size.height * 0.25,
width: MediaQuery.of(context).size.width,
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [
Expanded(
child: Container(
height: 200.0,
width: 180.0,
child: Column(
children: [
GestureDetector(
onTap: () {},
child: CircleAvatar(
backgroundColor: constantColors.transperant,
radius: 60.0,
backgroundImage: NetworkImage(snapshot['userimage']),
),
),
Padding(
padding: const EdgeInsets.only(top: 8.0),
child: Text(snapshot['username'],
style: TextStyle(
color: constantColors.whiteColor,
fontWeight: FontWeight.bold,
fontSize: 16.0)),
),
Padding(
padding: const EdgeInsets.only(top: 8.0),
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Icon(EvaIcons.email, color: constantColors.greenColor),
Padding(
padding: const EdgeInsets.only(left:9.0),
child: Text(snapshot['useremail'],
style: TextStyle(
color: constantColors.whiteColor,
fontWeight: FontWeight.bold,
fontSize: 13.0)),
),
],
),
),
],
),
),
),
Container(
// width: 200.0,
width: 200.0,
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Padding(
padding: const EdgeInsets.only(top:16.0, right: 30.0),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [
Container(
decoration: BoxDecoration(
color: constantColors.darkColor,
borderRadius: BorderRadius.circular(15.0)),
height: 70.0,
width: 80.0,
child: Column(
children: [
Text(
'0',
style: TextStyle(
color: constantColors.whiteColor,
fontWeight: FontWeight.bold,
fontSize: 28.0),
),
Text(
'Followers',
style: TextStyle(
color: constantColors.whiteColor,
fontWeight: FontWeight.bold,
fontSize: 12.0),
),
],
),
),
Container(
decoration: BoxDecoration(
color: constantColors.darkColor,
borderRadius: BorderRadius.circular(15.0)),
height: 70.0,
width: 80.0,
child: Column(
children: [
Text(
'0',
style: TextStyle(
color: constantColors.whiteColor,
fontWeight: FontWeight.bold,
fontSize: 28.0),
),
Text(
'Following',
style: TextStyle(
color: constantColors.whiteColor,
fontWeight: FontWeight.bold,
fontSize: 12.0),
),
],
),
),
],
),
),
Padding(
padding: const EdgeInsets.only(top:16.0),
child: Container(
decoration: BoxDecoration(
color: constantColors.darkColor,
borderRadius: BorderRadius.circular(15.0)),
height: 70.0,
width: 80.0,
child: Column(
children: [
Text(
'0',
style: TextStyle(
color: constantColors.whiteColor,
fontWeight: FontWeight.bold,
fontSize: 28.0),
),
Text(
'Posts',
style: TextStyle(
color: constantColors.whiteColor,
fontWeight: FontWeight.bold,
fontSize: 12.0),
),
],
),
),
),
],
),
)
],
),
);
}
I think the error is coming from the snapshot['username'], snapshot['userimage'] and snapshot['useremail'].....
This is my Profile.dart
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
centerTitle: true,
leading: IconButton(
onPressed: () {},
icon: Icon(
EvaIcons.settings2Outline,
color: constantColors.lightBlueColor,
)),
actions: [
IconButton(
onPressed: () {},
icon: Icon(EvaIcons.logOutOutline,
color: constantColors.greenColor)),
],
backgroundColor: constantColors.blueGreyColor.withOpacity(0.4),
title: RichText(
text: TextSpan(
text: 'My ',
style: TextStyle(
color: constantColors.whiteColor,
fontWeight: FontWeight.bold,
fontSize: 20.0,
),
children: <TextSpan>[
TextSpan(
text: 'Profile',
style: TextStyle(
color: constantColors.blueColor,
fontWeight: FontWeight.bold,
fontSize: 20.0,
),
),
])),
),
body: SingleChildScrollView(
child: Padding(
padding: const EdgeInsets.all(8.0),
child: Container(
height: MediaQuery.of(context).size.height,
width: MediaQuery.of(context).size.width,
child: StreamBuilder<DocumentSnapshot>(
stream: FirebaseFirestore.instance
.collection('users')
.doc(Provider.of<Authentication>(context, listen: false)
.getUserUid)
.snapshots(),
builder: (context, snapshot) {
if (snapshot.connectionState == ConnectionState.waiting) {
return Center(
child: CircularProgressIndicator(),
);
} else {
return new Column(
children: [
Provider.of<ProfileHelpers>(context, listen: false).headerProfile(context, snapshot.data)
],
);
}
},
),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(15.0),
color: constantColors.blueGreyColor.withOpacity(0.6)),
),
),
),
);
}
and below is the FirebaseOperations.dart
Future initUserData(BuildContext context) async {
return FirebaseFirestore.instance
.collection('users')
.doc(Provider.of<Authentication>(context, listen: false).getUserUid)
.get()
.then((doc) {
print('Fetching user data...');
initUserName = doc.data()['username'];
initUserEmail = doc.data()['useremail'];
initUserImage = doc.data()['userimage'];
print(initUserName);
print(initUserEmail);
print(initUserImage);
notifyListeners();
});
String initUserEmail, initUserName, initUserImage;
String get getInitUserName => initUserName;
String get getInitUserEmail => initUserEmail;
String get getInitUserImage => initUserImage;
All my code is this please help and there is user profile circle avatar at the bottom navbar it is also not the the image
Widget bottomNavBar(BuildContext context, int index, PageController pageController) {
return CustomNavigationBar(
currentIndex: index,
bubbleCurve: Curves.bounceIn,
scaleCurve: Curves.decelerate,
selectedColor: constantColors.blueColor,
unSelectedColor: constantColors.whiteColor,
strokeColor: constantColors.blueColor,
scaleFactor: 0.5,
iconSize: 30.0,
onTap: (val) {
index = val;
pageController.jumpToPage(val);
notifyListeners();
},
backgroundColor: Color(0xff040307),
items: [
CustomNavigationBarItem(icon: Icon(EvaIcons.home)),
CustomNavigationBarItem(icon: Icon(Icons.message_rounded)),
CustomNavigationBarItem(
icon: CircleAvatar(
radius: 35.0,
backgroundColor: constantColors.blueGreyColor,
backgroundImage: NetworkImage(Provider.of<FirebaseOperations>(context, listen: false).initUserImage),
)),
]);
}
Homepage.dart
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: constantColors.darkColor,
body: PageView(
controller: homepageController,
children: [
Feed(),
Chatroom(),
Profile(),
],
physics: NeverScrollableScrollPhysics(),
onPageChanged: (page) {
setState(() {
pageIndex = page;
});
},
),
bottomNavigationBar: Provider.of<HomepageHelpers>(context, listen: false)
.bottomNavBar(context, pageIndex, homepageController),
);
}
Please Help
I have a ListView which consists of 3 Cards. Each Card has a Text and different fontSize. How can I write a single code for one Card and call it in the ListView for the remaining 2 Cards with different Text and fontSize.
This will help me save extra lines of Code. The code below
Widget homeBody = Container(
child: ListView(
children: <Widget>[
SizedBox(
height: 200.0,
child: Card(
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(8.0),
),
margin: EdgeInsets.all(8.0),
child: InkWell(
splashColor: Colors.blueGrey,
onTap: () {},
child: Column(
// crossAxisAlignment: CrossAxisAlignment.stretch,
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Text(
'About',
style: TextStyle(
fontSize: 32.0, fontWeight: FontWeight.bold),
),
Text(
'Vishwapreneur',
style: TextStyle(
fontSize: 32.0, fontWeight: FontWeight.bold),
),
],
),
),
),
),
SizedBox(
height: 200.0,
child: Card(
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(8.0),
),
margin: EdgeInsets.all(8.0),
child: InkWell(
splashColor: Colors.blueGrey,
onTap: () {},
child: Row(
// crossAxisAlignment: CrossAxisAlignment.stretch,
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Text(
'Smart Sociothon',
style: TextStyle(
fontSize: 32.0, fontWeight: FontWeight.bold),
),
// Text(
// 'Sociothon',
// style: TextStyle(
// fontSize: 32.0, fontWeight: FontWeight.bold),
// ),
],
),
),
),
),
SizedBox(
height: 200.0,
child: Card(
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(8.0),
),
margin: EdgeInsets.all(8.0),
child: InkWell(
splashColor: Colors.blueGrey,
onTap: () {},
child: Column(
// crossAxisAlignment: CrossAxisAlignment.stretch,
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Text(
'Entrepreneurship',
style: TextStyle(
fontSize: 30.0, fontWeight: FontWeight.bold),
),
Text(
'Development Cell',
style: TextStyle(
fontSize: 30.0, fontWeight: FontWeight.bold),
),
],
),
),
),
),
],
),
);
Thank you in Advance.
Pass your text along with textSize to your card.
The example below will give you an idea
ListView list(){
Map<String, double> items = new Map();
items["A"] = 14.0;
items["B"] = 24.0;
items["C"] = 32.0;
return new ListView.builder(
itemCount: items.length,
itemBuilder: (context, index) {
return myCard(items.keys.toList()[index], items.values.toList()[index]);
},
);
}
Card myCard(String text, double textSize){
return new Card(
child: Padding(
padding: const EdgeInsets.all(12.0),
child: Text(text, style: TextStyle(fontSize: textSize),),
),
);
}