Skip to content

Instantly share code, notes, and snippets.

@Jahidul007
Created May 22, 2022 08:23
Show Gist options
  • Save Jahidul007/ed31d42b7f938fde13783b0cdbce530a to your computer and use it in GitHub Desktop.
Save Jahidul007/ed31d42b7f938fde13783b0cdbce530a to your computer and use it in GitHub Desktop.
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