Fakultas Ilmu Komputer UI

Verified Commit 3bf91044 authored by Muhammad Ariq Basyar's avatar Muhammad Ariq Basyar
Browse files

[CHORE] Migrate deprecated widgets

- FlatButton to TextButton
- RaisedButton to ElevatedButton
parent 97a13e1b
Pipeline #74876 failed with stages
in 10 minutes and 30 seconds
......@@ -284,8 +284,8 @@ class _AddLokasiState extends State<AddLokasi> {
),
)),
Expanded(
child: FlatButton(
color: greenPrimary,
child: TextButton(
style: TextButton.styleFrom(backgroundColor: greenPrimary),
onPressed: () {
addLocationToApi();
setState(() {
......
......@@ -206,9 +206,9 @@ class AddInformasiState extends State<AddInformasi> {
style: TextStyle(fontSize: 18),
textAlign: TextAlign.left,
),
FlatButton(
TextButton(
key: const Key('Button Input Foto Gallery'),
padding: EdgeInsets.zero,
style: TextButton.styleFrom(padding: EdgeInsets.zero),
onPressed: () async {
final imageSelected = await _getImage();
setState(() {
......@@ -240,9 +240,9 @@ class AddInformasiState extends State<AddInformasi> {
),
),
),
FlatButton(
TextButton(
key: const Key('Button Input Foto Camera'),
padding: EdgeInsets.zero,
style: TextButton.styleFrom(padding: EdgeInsets.zero),
onPressed: () async {
final imageSelected = await _getCameraImage();
setState(() {
......@@ -318,11 +318,13 @@ class AddInformasiState extends State<AddInformasi> {
decoration: BoxDecoration(boxShadow: regularShadow),
child: ButtonTheme(
height: 55.0,
child: FlatButton(
color: greenPrimary,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(10.0)),
padding: const EdgeInsets.symmetric(vertical: 10.0),
child: TextButton(
style: TextButton.styleFrom(
backgroundColor: greenPrimary,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(10.0)),
padding: const EdgeInsets.symmetric(vertical: 10.0)
),
onPressed: _validateInformationInput,
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
......
......@@ -134,17 +134,30 @@ class _FasilitasState extends State<Fasilitas> {
decoration: BoxDecoration(boxShadow: regularShadow),
child: SizedBox(
width: double.infinity,
child: FlatButton(
child: TextButton(
key: const Key('Tambah Informasi'),
color: Colors.green[700],
textColor: Colors.white,
disabledColor: Colors.grey,
disabledTextColor: Colors.black,
padding: const EdgeInsets.all(8),
shape: RoundedRectangleBorder(
style: ButtonStyle(
backgroundColor: MaterialStateProperty.resolveWith((states) {
if (states.contains(MaterialState.disabled)) {
return Colors.grey;
}
return Colors.green[700];
}),
foregroundColor: MaterialStateProperty.resolveWith((states) {
if (states.contains(MaterialState.disabled)) {
return Colors.black;
}
return Colors.white;
}),
padding: MaterialStateProperty.all(
EdgeInsets.symmetric(vertical: 8, horizontal: 8)
),
shape: MaterialStateProperty.all(RoundedRectangleBorder(
borderRadius: regularBorderRadius,
side: const BorderSide(color: Colors.transparent)),
splashColor: Colors.lightGreen,
side: const BorderSide(color: Colors.transparent),
)),
overlayColor: MaterialStateColor.resolveWith((states) => Colors.lightGreen),
),
onPressed: () {
checkLoginStatus();
},
......
......@@ -113,10 +113,15 @@ class _DetailPostPageState extends State<DetailPostPage> {
return choices.map((String choice) {
return PopupMenuItem(
key: Key(choice),
child: RaisedButton(
padding: EdgeInsets.zero,
color: Colors.white,
elevation: 0,
child: ElevatedButton(
style: ButtonStyle(
padding: MaterialStateProperty.all(
EdgeInsets.symmetric(vertical: 0, horizontal: 0)
),
backgroundColor: MaterialStateProperty.all(Colors.white),
foregroundColor: MaterialStateProperty.all(Colors.black),
elevation: MaterialStateProperty.all(0)
),
onPressed: _updateInformasi,
child: SizedBox(
width: double.infinity,
......@@ -353,18 +358,17 @@ class _DetailPostPageState extends State<DetailPostPage> {
child: ButtonTheme(
minWidth: double.infinity,
height: 40,
child: RaisedButton(
child: ElevatedButton(
key: const Key('Button Tambah Komentar'),
padding: const EdgeInsets.symmetric(
vertical: 13),
highlightElevation: 0.0,
splashColor: greenPrimary,
highlightColor: Colors.white,
elevation: 0.0,
color: greenPrimary,
shape: const RoundedRectangleBorder(
borderRadius:
BorderRadius.all(Radius.circular(10)),
style: ButtonStyle(
padding: MaterialStateProperty.all(
EdgeInsets.symmetric(vertical: 13)
),
elevation: MaterialStateProperty.all(0.0),
backgroundColor: MaterialStateProperty.all(greenPrimary),
shape: MaterialStateProperty.all(RoundedRectangleBorder(
borderRadius: BorderRadius.all(Radius.circular(10))
)),
),
onPressed: () {
_checkLoginStatus();
......
......@@ -14,6 +14,30 @@ class LayananDisabilitas extends StatefulWidget {
class _LayananDisabilitasState extends State<LayananDisabilitas> {
@override
Widget build(BuildContext context) {
final buttonStyle = ButtonStyle(
backgroundColor: MaterialStateProperty.resolveWith((states) {
if (states.contains(MaterialState.disabled)) {
return Colors.grey;
}
return Colors.white;
}),
foregroundColor: MaterialStateProperty.resolveWith((states) {
if (states.contains(MaterialState.disabled)) {
return Colors.black;
}
return Colors.black;
}),
padding: MaterialStateProperty.all(
EdgeInsets.all(regularBiggerSpace)
),
shape: MaterialStateProperty.all(RoundedRectangleBorder(
borderRadius: regularBorderRadius,
side: BorderSide(
width: 2, color: greenPrimary.withOpacity(0.4)),
)),
overlayColor: MaterialStateColor.resolveWith((states) =>
Colors.lightGreen),
);
return Scaffold(
appBar: const PreferredSize(
preferredSize: Size.fromHeight(55),
......@@ -44,17 +68,8 @@ class _LayananDisabilitasState extends State<LayananDisabilitas> {
decoration: BoxDecoration(boxShadow: regularShadow),
child: SizedBox(
width: double.infinity,
child: FlatButton(
color: Colors.white,
textColor: Colors.black,
disabledColor: Colors.grey,
disabledTextColor: Colors.black,
padding: const EdgeInsets.all(regularBiggerSpace),
shape: RoundedRectangleBorder(
borderRadius: regularBorderRadius,
side: BorderSide(
width: 2, color: greenPrimary.withOpacity(0.4))),
//splashColor: Colors.lightGreen,
child: TextButton(
style: buttonStyle,
onPressed: () {
_navigateToRegistrasiDisabilitasPage(context);
},
......@@ -83,17 +98,8 @@ class _LayananDisabilitasState extends State<LayananDisabilitas> {
decoration: BoxDecoration(boxShadow: regularShadow),
child: SizedBox(
width: double.infinity,
child: FlatButton(
color: Colors.white,
textColor: Colors.black,
disabledColor: Colors.grey,
disabledTextColor: Colors.black,
padding: const EdgeInsets.all(regularBiggerSpace),
shape: RoundedRectangleBorder(
borderRadius: regularBorderRadius,
side: BorderSide(
width: 2, color: greenPrimary.withOpacity(0.4))),
//splashColor: Colors.lightGreen,
child: TextButton(
style: buttonStyle,
onPressed: () {
_navigateToListSekolahPage(context);
},
......
......@@ -157,12 +157,14 @@ class LoginState extends State<Login> {
key: const Key('Button'),
decoration: BoxDecoration(boxShadow: regularShadow),
height: 64.0,
child: FlatButton(
color: Colors.white,
shape: RoundedRectangleBorder(
child: TextButton(
style: TextButton.styleFrom(
backgroundColor: Colors.white,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(5.0),
side: const BorderSide(color: greenPrimary)),
padding: const EdgeInsets.symmetric(vertical: 10.0),
padding: const EdgeInsets.symmetric(vertical: 10.0)
),
onPressed: () async {
Navigator.of(context).pop(true);
await _updateUser(newUser);
......@@ -185,11 +187,13 @@ class LoginState extends State<Login> {
key: const Key('Button'),
decoration: BoxDecoration(boxShadow: regularShadow),
height: 64.0,
child: FlatButton(
color: greenPrimary,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(5.0)),
padding: const EdgeInsets.symmetric(vertical: 10.0),
child: TextButton(
style: TextButton.styleFrom(
backgroundColor: greenPrimary,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(5.0)),
padding: const EdgeInsets.symmetric(vertical: 10.0)
),
onPressed: () {
Navigator.of(context).pop(true);
_navigateToPilihDisabilitas(context);
......
......@@ -195,8 +195,11 @@ class PencarianState extends State<Pencarian> {
'Tidak menemukan lokasi yang anda cari?',
style: TextStyle(color: grayPrimary),
),
RaisedButton(
color: greenPrimary,
ElevatedButton(
style: ButtonStyle(
backgroundColor: MaterialStateProperty.all(
greenPrimary)
),
onPressed: () {
Navigator.of(context).pushReplacement(
MaterialPageRoute(
......
......@@ -160,11 +160,14 @@ class _EditProfileState extends State<EditProfile> {
textAlign: TextAlign.left,
),
const SizedBox(height: 10.0),
FlatButton(
TextButton(
key: const Key('Button Tanggal Lahir'),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(10.0)),
padding: const EdgeInsets.all(13.0),
style: TextButton.styleFrom(
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(10.0)),
padding: const EdgeInsets.all(13.0),
backgroundColor: greenPrimary,
),
onPressed: () {
DatePicker.showDatePicker(context,
currentTime: DateTime.parse(tanggalLahir),
......@@ -175,7 +178,6 @@ class _EditProfileState extends State<EditProfile> {
});
});
},
color: greenPrimary,
child: Text(
tanggalLahir,
style: const TextStyle(
......
......@@ -155,11 +155,14 @@ class RegistrasiState extends State<Registrasi> {
],
),
const SizedBox(height: 10.0),
FlatButton(
TextButton(
style: TextButton.styleFrom(
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(10.0)),
padding: const EdgeInsets.all(9.0),
backgroundColor: greenPrimary,
),
key: const Key('Button Tanggal Lahir'),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(10.0)),
padding: const EdgeInsets.all(9.0),
onPressed: () {
DatePicker.showDatePicker(context,
maxTime: DateTime.now(), onChanged: (date) {
......@@ -169,7 +172,6 @@ class RegistrasiState extends State<Registrasi> {
});
});
},
color: greenPrimary,
child: Text(
tanggalLahir,
style: const TextStyle(
......
......@@ -176,7 +176,10 @@ class _RegistrasiInformasiLayananDisabilitasState
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
const Text('Tanggal Lahir'),
FlatButton(
TextButton(
style: TextButton.styleFrom(
backgroundColor: greenPrimary,
),
key: const Key('Tanggal Lahir Flat Button'),
onPressed: () {
DatePicker.showDatePicker(context,
......@@ -187,7 +190,6 @@ class _RegistrasiInformasiLayananDisabilitasState
});
});
},
color: greenPrimary,
child: Text(
tanggalLahir,
style: const TextStyle(color: Colors.white),
......@@ -416,18 +418,25 @@ class _RegistrasiInformasiLayananDisabilitasState
top: regularSpace, bottom: regularSpace),
decoration: const BoxDecoration(),
child: SizedBox(
child: FlatButton(
color: Colors.transparent,
textColor: Colors.black,
padding: const EdgeInsets.only(
top: regularBiggerSpace,
bottom: regularBiggerSpace,
left: doubleSpace,
right: doubleSpace),
shape: RoundedRectangleBorder(
borderRadius: regularBorderRadius,
side: const BorderSide(color: Colors.grey)),
splashColor: white,
child: TextButton(
style: ButtonStyle(
backgroundColor: MaterialStateProperty.all(
Colors.transparent),
foregroundColor: MaterialStateProperty.all(
Colors.black),
padding: MaterialStateProperty.all(
EdgeInsets.only(
top: regularBiggerSpace,
bottom: regularBiggerSpace,
left: doubleSpace,
right: doubleSpace
)),
shape: MaterialStateProperty.all(
RoundedRectangleBorder(
borderRadius: regularBorderRadius,
side: const BorderSide(color: Colors.grey),
)),
),
onPressed: () {
/*...*/
},
......@@ -444,20 +453,27 @@ class _RegistrasiInformasiLayananDisabilitasState
top: regularSpace, bottom: regularSpace),
decoration: BoxDecoration(boxShadow: regularShadow),
child: SizedBox(
child: FlatButton(
child: TextButton(
key: const Key('Simpan Key'),
color: greenPrimary,
textColor: Colors.white,
padding: const EdgeInsets.only(
top: regularBiggerSpace,
bottom: regularBiggerSpace,
left: spaceFourty,
right: spaceFourty),
shape: RoundedRectangleBorder(
borderRadius: regularBorderRadius,
side: const BorderSide(
color: Colors.transparent)),
splashColor: greenPrimary,
style: ButtonStyle(
backgroundColor: MaterialStateProperty.all(
greenPrimary),
foregroundColor: MaterialStateProperty.all(
Colors.white),
padding: MaterialStateProperty.all(
EdgeInsets.only(
top: regularBiggerSpace,
bottom: regularBiggerSpace,
left: spaceFourty,
right: spaceFourty
)),
shape: MaterialStateProperty.all(
RoundedRectangleBorder(
borderRadius: regularBorderRadius,
side: const BorderSide(
color: Colors.transparent),
)),
),
onPressed: () {
_validateRegisInput();
},
......
......@@ -48,7 +48,7 @@ class _TentangDisabilitasState extends State<TentangDisabilitas> {
Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: <Widget>[
FlatButton(
TextButton(
onPressed: () {
_navigateDetailDisabilitasPage(context, 'Fisik');
},
......@@ -85,7 +85,7 @@ class _TentangDisabilitasState extends State<TentangDisabilitas> {
],
)),
),
FlatButton(
TextButton(
onPressed: () {
_navigateDetailDisabilitasPage(context, 'Intelektual');
},
......@@ -127,7 +127,7 @@ class _TentangDisabilitasState extends State<TentangDisabilitas> {
Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: <Widget>[
FlatButton(
TextButton(
onPressed: () {
_navigateDetailDisabilitasPage(context, 'Mental');
},
......@@ -164,7 +164,7 @@ class _TentangDisabilitasState extends State<TentangDisabilitas> {
],
)),
),
FlatButton(
TextButton(
onPressed: () {
_navigateDetailDisabilitasPage(context, 'Sensorik');
},
......
......@@ -209,9 +209,11 @@ class UpdateInformasiState extends State<UpdateInformasi> {
style: TextStyle(fontSize: 18),
textAlign: TextAlign.left,
),
FlatButton(
TextButton(
style: TextButton.styleFrom(
padding: EdgeInsets.zero
),
key: const Key('Button Input Foto'),
padding: EdgeInsets.zero,
onPressed: () async {
final imageSelected = await _getImage();
setState(() {
......@@ -293,17 +295,26 @@ class UpdateInformasiState extends State<UpdateInformasi> {
key: const Key('Button Batal'),
minWidth: double.infinity,
height: 40,
child: RaisedButton(
padding: const EdgeInsets.symmetric(vertical: 15),
highlightElevation: 0.0,
splashColor: const Color(0xff3A903A),
highlightColor: const Color(0xff3A903A),
elevation: 0.0,
color: Colors.white70,
shape: const RoundedRectangleBorder(
borderRadius:
BorderRadius.all(Radius.circular(10)),
side: BorderSide(color: Color(0xff3A903A))),
child: ElevatedButton(
style: ButtonStyle(
padding: MaterialStateProperty.all(
EdgeInsets.symmetric(vertical: 15)
),
overlayColor: MaterialStateProperty.all(
greenPrimary
),
backgroundColor: MaterialStateProperty.all(
Colors.white70
),
elevation: MaterialStateProperty.all(0.0),
shape: MaterialStateProperty.all(
RoundedRectangleBorder(
borderRadius: BorderRadius.all(
Radius.circular(10)),
side: BorderSide(color: greenPrimary)
)
)
),
onPressed: () {
_resetInput();
Navigator.of(context).pop();
......@@ -508,9 +519,9 @@ class UpdateInformasiState extends State<UpdateInformasi> {
const SizedBox(height: doubleSpace),
SizedBox(height: 200, child: ImageHolder(url: widget.komentar.image)),
const SizedBox(height: regularSpace),
FlatButton(
TextButton(
style: TextButton.styleFrom(padding: EdgeInsets.zero),
key: const Key('Button Hapus Foto'),
padding: EdgeInsets.zero,
onPressed: () async {
setState(() {
_existingImageUrl = '/media/';
......
......@@ -43,12 +43,14 @@ class _CustomAlertDialog extends State<CustomAlertDialog> {
key: Key('Pop Up Button ${widget.leftText}'),
decoration: BoxDecoration(boxShadow: regularShadow),
height: 64.0,
child: FlatButton(
color: Colors.white,
shape: RoundedRectangleBorder(
child: TextButton(
style: TextButton.styleFrom(
backgroundColor: Colors.white,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(5.0),
side: const BorderSide(color: greenPrimary)),
padding: const EdgeInsets.symmetric(vertical: 10.0),
padding: const EdgeInsets.symmetric(vertical: 10.0),
),
onPressed: widget.leftFunction,
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
......@@ -67,11 +69,13 @@ class _CustomAlertDialog extends State<CustomAlertDialog> {
key: Key('Pop Up Button ${widget.rightText}'),
decoration: BoxDecoration(boxShadow: regularShadow),
height: 64.0,
child: FlatButton(
color: greenPrimary,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(5.0)),
padding: const EdgeInsets.symmetric(vertical: 10.0),
child: TextButton(
style: TextButton.styleFrom(
backgroundColor: greenPrimary,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(5.0)),
padding: const EdgeInsets.symmetric(vertical: 10.0),
),
onPressed: widget.rightFunction,
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
......
......@@ -5,24 +5,39 @@ import 'package:bisaGo/config/styles.dart';
Widget submitButton(String text, void Function() function) {
return Container(
decoration: BoxDecoration(boxShadow: regularShadow),
child: RaisedButton(
padding: const EdgeInsets.symmetric(vertical: 15),
highlightElevation: 0.0,
splashColor: greenPale,
disabledColor: grayPrimary,
disabledTextColor: Colors.black,
elevation: 0.0,
color: greenPrimary,
shape: RoundedRectangleBorder(
borderRadius: regularBorderRadius,
),
onPressed: () => function(),
child: Text(
text,
style: const TextStyle(
fontSize: 20, color: white, fontWeight: FontWeight.bold),
child: SizedBox(
width: double.infinity,
child: ElevatedButton(