Ripple Effectを消すのは下記、
https://stackoverflow.com/questions/50020523/how-to-disable-default-widget-splash-effect-in-flutter
ボタン押下時の挙動の指定は下記、
https://okutaro.com/2022/06/10/2022-6-10-flutter-materialstateproperty/
にあるのでよければ参考にされてください。
import 'package:flutter/material.dart';
void main() {
runApp(
MaterialApp(
home: MyApp(),
),
);
}
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
//backgroundColor: Colors.red,
backgroundColor:
MaterialStateColor.resolveWith((Set<MaterialState> states) {
if (true) {
return Colors.cyanAccent;
}
return Colors.red;
}),
),
body: Container(
child: Center(
child: SizedBox(
width:200.0,
height:100.0,
child: ElevatedButton(
style: ButtonStyle(
backgroundColor: MaterialStateProperty.resolveWith<Color?>(
(Set<MaterialState> states) {
if (states.contains(MaterialState.pressed))
return Theme.of(context)
.colorScheme
.onPrimary;
return null; // Use the component's default.
},
),
foregroundColor: MaterialStateProperty.resolveWith<Color?>(
(Set<MaterialState> states) {
if (states.contains(MaterialState.pressed))
return Theme.of(context)
.colorScheme
.primary;
return null; // Use the component's default.
},
),
//https://stackoverflow.com/questions/50020523/how-to-disable-default-widget-splash-effect-in-flutter
//button_style.dartのsplashFactoryのドキュメントコメントに書いてある。
splashFactory: NoSplash.splashFactory,
),
child: Text('push'),
onPressed: () {},
),
),
),
),
);
}
}
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。