【发布时间】:2021-04-19 23:51:35
【问题描述】:
问题
如何更改ElevatedButton 上的点击波纹效果的持续时间和颜色?有关这种涟漪效应的工作示例,请参阅飞镖垫链接。
ElevatedButton 工作代码
import 'package:flutter/material.dart';
void main() => runApp(MyApp());
/// This is the main application widget.
class MyApp extends StatelessWidget {
static const String _title = 'Flutter Code Sample';
@override
Widget build(BuildContext context) {
return MaterialApp(
title: _title,
home: Scaffold(
appBar: AppBar(title: const Text(_title)),
body: MyStatelessWidget(),
),
);
}
}
class MyStatelessWidget extends StatelessWidget {
MyStatelessWidget({Key key}) : super(key: key);
@override
Widget build(BuildContext context) {
return Center(
child: ElevatedButton(
onPressed: () {},
child: const Text('Elevated Button', style: TextStyle(fontSize: 20)),
),
);
}
}
DartPad 链接
【问题讨论】:
-
你可以试试
inkWellin flutter,这可能会有所帮助stackoverflow.com/questions/51115401/changing-speed-of-inkwell -
能否展示一个带有 ElevatedButton 的墨水池的工作示例?