Created
July 1, 2019 19:54
-
-
Save HudsonAfonso/4acbeba9ad9be960ab75bd9f8253343f to your computer and use it in GitHub Desktop.
Radio
This file contains hidden or 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(new MyApp()); | |
class MyApp extends StatefulWidget { | |
@override | |
_MyAppState createState() => new _MyAppState(); | |
} | |
class _MyAppState extends State<MyApp> { | |
int _radioValue1 = -1; | |
void _handleRadioValueChange1(int value) { | |
setState(() { | |
_radioValue1 = value; | |
}); | |
} | |
@override | |
Widget build(BuildContext context) { | |
return MaterialApp( | |
debugShowCheckedModeBanner: false, | |
home: Scaffold( | |
appBar: AppBar( | |
title: Text('Radio'), | |
), | |
body: Container( | |
child: new Row( | |
mainAxisAlignment: MainAxisAlignment.center, | |
children: <Widget>[ | |
new Radio( | |
value: 0, | |
groupValue: _radioValue1, | |
onChanged: _handleRadioValueChange1, | |
), | |
new Text( | |
'Valor 1', | |
style: new TextStyle(fontSize: 16.0), | |
), | |
new Radio( | |
value: 1, | |
groupValue: _radioValue1, | |
onChanged: _handleRadioValueChange1, | |
), | |
new Text( | |
'Valor 2', | |
style: new TextStyle( | |
fontSize: 16.0, | |
), | |
), | |
new Radio( | |
value: 2, | |
groupValue: _radioValue1, | |
onChanged: _handleRadioValueChange1, | |
), | |
new Text( | |
'Valor 3', | |
style: new TextStyle(fontSize: 16.0), | |
), | |
], | |
), | |
), | |
), | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment