class _MyHomePageState extends State<MyHomePage> { static var _message = "ok."; static var _janken = <String>['グー','チョキ','パー']; @override Widget build(BuildContext context) { return new Scaffold( appBar: new AppBar( title: new Text('App Name'), ), body: new Center( child: Column( mainAxisAlignment: MainAxisAlignment.start, mainAxisSize: MainAxisSize.max, crossAxisAlignment: CrossAxisAlignment.stretch, children: <Widget>[ Padding( padding: EdgeInsets.all(20.0), child: Text( _message, style: TextStyle( fontSize: 32.0, fontWeight: FontWeight.w400, fontFamily:"Robot" ), ), ), TextButton( onPressed: buttonPressed, child: Padding( padding: EdgeInsets.all(10.0), child: Text( "Push me!", style: TextStyle( fontSize: 32.0, color: const Color(0xff000000), fontWeight: FontWeight.w400, fontFamily: "Robot"), ) ) ) ] ), ), ); } void buttonPressed(){ setState((){ _message = (_janken..shuffle()).first; }); } }
TextButton( onPressed: buttonPressed, child: Padding( padding: EdgeInsets.all(10.0), child: Icon( Icons.android, size: 50.0, ) ) )
elevatedbutton, iconButtonなどがある