Tambahkan tombol yang mengubah teks dalam flutter
class MyClass extends StatefulWidget {
@override
_MyClassState createState() => _MyClassState();
}
class _MyClassState extends State<MyClass> {
bool pressGeoON = false;
bool cmbscritta = false;
@override
Widget build(BuildContext context) {
return Scaffold(
body: Center(
child: RaisedButton(
shape: new RoundedRectangleBorder(
borderRadius: new BorderRadius.circular(18.0),
side: BorderSide(color: Colors.red)),
color: pressGeoON ? Colors.blue : Colors.red,
textColor: Colors.white,
child: cmbscritta ? Text("GeoOn") : Text("GeoOFF"),
// style: TextStyle(fontSize: 14)
onPressed: () {
setState(() {
pressGeoON = !pressGeoON;
cmbscritta = !cmbscritta;
});
}
),
),
);
}
}
Saquib sheikh