Created
May 22, 2022 08:23
-
-
Save Jahidul007/ed31d42b7f938fde13783b0cdbce530a 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'; | |
void main() { | |
runApp( | |
const MaterialApp( | |
title: 'Returning Data', | |
home: HomeScreen(), | |
), | |
); | |
} | |
class HomeScreen extends StatelessWidget { | |
const HomeScreen({Key? key}) : super(key: key); | |
@override | |
Widget build(BuildContext context) { | |
return Scaffold( | |
appBar: AppBar( | |
title: const Text('Returning Data Demo'), | |
), | |
body: Center( | |
child: SummaryPayment(), | |
), | |
); | |
} | |
} | |
class SummaryPayment extends StatefulWidget { | |
@override | |
State<SummaryPayment> createState() => _SummaryPaymentState(); | |
} | |
class _SummaryPaymentState extends State<SummaryPayment> { | |
int index = 0; | |
int _count = 1; | |
String? dropdownvalue; | |
Widget build(BuildContext context) { | |
return DropdownButton<String>( | |
value: dropdownvalue, | |
items: <String>['A', 'B', 'C', 'D'].map((String value) { | |
return DropdownMenuItem<String>( | |
value: value, | |
child: Text(value), | |
); | |
}).toList(), | |
onChanged: (value) => setState( | |
() => dropdownvalue = value, | |
)); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment