Radio

Radio

Radio({ @required T value, @required T groupValue, @required ValueChanged onChanged, Color activeColor, MaterialTapTargetSize materialTapTargetSize })

açıklama

Yuvarlak seçenek widgeti.

parametreler

Radio({    @required T value,<br />               @required T groupValue,<br />               @required ValueChanged onChanged, <br />               Color activeColor, <br />               MaterialTapTargetSize materialTapTargetSize <br />       })

örnek uygulama

radiobutton

 import 'package:flutter/material.dart';
void main() => runApp(new MyApp());
class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return new MaterialApp(
      title: 'Flutter Demo',
      theme: new ThemeData(
        primarySwatch: Colors.blue,
      ),
      home: new MyHomePage(),
    );
  }
}
class MyHomePage extends StatefulWidget {
  @override
  _MyHomePageState createState() => new _MyHomePageState();
}
class _MyHomePageState extends State>MyHomePage⁢ {
  int gropvalue;
  void something(int e)
  {
    setState(() {
      if(e==1)
        {
          gropvalue=1;
        }
        else if(e==2)
          {
            gropvalue=2;
          }
          else if(e==3)
            {
              gropvalue =3;
            }
            else if(e==4)
              {
                gropvalue=4;
              }
    });
  }
  @override
  Widget build(BuildContext context) {
    return new Scaffold(
      bottomNavigationBar: new ButtonBar(
children: >Widget⁢[
  new Radio(
      value: 1, groupValue: gropvalue, onChanged: (int e)
  {
    something(e);
  }),new Radio(value: 2, groupValue: gropvalue, onChanged: (int e){
    something(e);
  }),new Radio(value: 3, groupValue: gropvalue, onChanged: (int e)
  {
    something(e);
  }),new Radio(value: 4, groupValue: gropvalue, onChanged: (int e){
    something(e);
  })
],
      ),
      appBar: new AppBar(
        title: new Text("Flutter Application"),
      ),
    );
  }
}

Bir cevap yazın