Code Explained - The About Page :
import 'package:flutter/material.dart';
class AnswerButton extends StatelessWidget {
final String _answer;
final VoidCallback _onTap;
AnswerButton(this._answer, this._onTap);
@override
Widget build(BuildContext context) {
return new Expanded( // true button
child: new Material(
color: _answer == "A"? Colors.green : _answer == "B" ? Colors.redAccent: _answer == "C" ? Colors.blueAccent: Colors.deepOrangeAccent,
child: new InkWell(
onTap: () => _onTap(),
child: new Center(
child: new Container(
decoration: new BoxDecoration(
// border: new Border.all(color: Colors.white, width: 1.0)
),
padding: new EdgeInsets.all(10.0),
child: new Text(_answer == "A" ? "A" : _answer == "B" ? "B": _answer == "C" ? "C": "D",
style: new TextStyle(color: Colors.white, fontSize: 40.0, fontWeight: FontWeight.bold, fontStyle: FontStyle.italic)
),
)
),
),
),
);
}
}
Code Explained - The About Page :
import 'package:flutter/material.dart';
class AnswerButton extends StatelessWidget {
final String _answer;
final VoidCallback _onTap;
AnswerButton(this._answer, this._onTap);
@override
Widget build(BuildContext context) {
return new Expanded( // true button
child: new Material(
color: _answer == "A"? Colors.green : _answer == "B" ? Colors.redAccent: _answer == "C" ? Colors.blueAccent: Colors.deepOrangeAccent,
child: new InkWell(
onTap: () => _onTap(),
child: new Center(
child: new Container(
decoration: new BoxDecoration(
// border: new Border.all(color: Colors.white, width: 1.0)
),
padding: new EdgeInsets.all(10.0),
child: new Text(_answer == "A" ? "A" : _answer == "B" ? "B": _answer == "C" ? "C": "D",
style: new TextStyle(color: Colors.white, fontSize: 40.0, fontWeight: FontWeight.bold, fontStyle: FontStyle.italic)
),
)
),
),
),
);
}
}