小编Flo*_*epa的帖子

颤动倒数计时器

如何将传递的值放入构造中,使计时器四舍五入到小数点后一位并显示在RaisedButton的子文本中?我已经尝试过但没有运气。我设法使用一个简单的Timer来使回调函数起作用,但没有周期性,并且文本中没有实时更新值...

import 'package:flutter/material.dart';
import 'dart:ui';
import 'dart:async';

class TimerButton extends StatefulWidget {
  final Duration timerTastoPremuto;


  TimerButton(this.timerTastoPremuto);

  @override
  _TimerButtonState createState() => _TimerButtonState();
}

class _TimerButtonState extends State<TimerButton> {
  @override
  Widget build(BuildContext context) {
    return Container(
      margin: EdgeInsets.all(5.0),
      height: 135.0,
      width: 135.0,
      child: new RaisedButton(
        elevation: 100.0,
        color: Colors.white.withOpacity(.8),
        highlightElevation: 0.0,
        onPressed: () {
          int _start = widget.timerTastoPremuto.inMilliseconds;

          const oneDecimal = const Duration(milliseconds: 100);
          Timer _timer = new Timer.periodic(
              oneDecimal,
                  (Timer timer) =>
                  setState(() {
                    if (_start < 100) {
                      _timer.cancel();
                    } …
Run Code Online (Sandbox Code Playgroud)

timer countdown dart flutter

17
推荐指数
7
解决办法
2万
查看次数

如何在 IconButton 上产生圆形涟漪效果?

我想用一个图标制作一个带有圆形波纹效果的按钮,我在网上看到过一些东西,但我做不到。它并不像它应该的那样直截了当。现在尝试使用此代码。

InkWell(
                      onTap: () {},
                      splashColor: Colors.red,
                      highlightColor: Colors.white,
                      child: new Icon(
                        FontAwesomeIcons.chevronCircleUp,
                        size: 100,
                      ),
                    )
Run Code Online (Sandbox Code Playgroud)

另一个尝试是用这个,但我不明白为什么那些不能完美地相互集中。

Container(
                      margin: EdgeInsets.all(0.0),
                      height: 100.0,
                      width: 100.0,
                      child: new RaisedButton(
                          padding: EdgeInsets.all(0.0),
                          elevation: 100.0,
                          color: Colors.black,
                          highlightElevation: 0.0,
                          onPressed: () {},
                          splashColor: Colors.red,
                          highlightColor: Colors.red,
                          //shape: RoundedRectangleBorder e tutto il resto uguale
                          shape: CircleBorder(
                            side: BorderSide(color: Colors.black, width: 5),
                          ),
                          child: Icon(
                            FontAwesomeIcons.chevronCircleUp,
                            color: Colors.white.withOpacity(.8),
                            size: 80,
                          )),
                    ),
Run Code Online (Sandbox Code Playgroud)

谢谢您的帮助

icons button dart flutter

13
推荐指数
5
解决办法
2万
查看次数

浮动操作按钮:如何像 RaisedButton 一样更改初始颜色和突出显示颜色?

我看到 FAB 采用的飞溅和高亮颜色与 MaterialApp 小部件中的参数颜色相关联。有没有办法覆盖这些颜色?我发现只有前景色和背景色,这些不是我想要的。谢谢

dart floating-action-button flutter

7
推荐指数
2
解决办法
7602
查看次数

扑。如何让持续/永久的通知运行?

我很想知道是否可以使用 flutter 发出此类通知。这些图像是我在手机上通过应用程序“A HIIT Interval Timer”制作的。在此输入图像描述在此输入图像描述

调整大小时会有一个图标,但当您放下通知栏时,它会显示剩余时间。我想为我的应用程序制作一个非常相似的东西,其中包括一个计时器。这种通知的正确名称是什么?我应该从哪里开始寻找制作这个?谢谢

notifications dart flutter

5
推荐指数
1
解决办法
2414
查看次数

如何在 Flutter 中自定义数字选择器?

我在我的应用程序中实现了numberpicker。我想修改突出显示值和非突出显示值的数字大小和颜色。我设法修改突出显示的内容,将其包装在主题小部件中并修改强调颜色,但不知道如何进行其他自定义?

Theme(
  data: Theme.of(context).copyWith(
    accentColor: Colors.red,
  ),
  child: NumberPicker.integer(
    initialValue: _currentPickerValue,
    minValue: 0,
    maxValue: 100,
    onChanged: (newValue) =>
      setState(() => _currentPickerValue = newValue))) 
Run Code Online (Sandbox Code Playgroud)

dart flutter

4
推荐指数
1
解决办法
5007
查看次数

将 Font Awesome 图标居中时的渲染问题

我不明白为什么这个 FAB 不以它的孩子为中心。我尝试了不同的东西,但不能完美地居中。因为例如仅在图标底部添加填充可以使其以设备为中心,但可能并非全部。这是我的代码

Theme(
  data: Theme.of(context).copyWith(
      highlightColor: Colors.red, splashColor: Colors.red),
  child: SizedBox(
    height: MediaQuery.of(context).size.height / 7,
    width: MediaQuery.of(context).size.height / 7,
    child: FloatingActionButton(
        elevation: 100,
        shape: new CircleBorder(
            side: new BorderSide(
                color: Colors.black, width: 5.0)),
        backgroundColor: Colors.orangeAccent,
        onPressed: () {},
        child: new Icon(
          FontAwesomeIcons.chevronUp,
          size: 80,
        )),
  ),
),
Run Code Online (Sandbox Code Playgroud)

这是带有图标子项的不居中 FAB。

在此处输入图片说明

只有我觉得图标没有居中吗?

icons widget dart flutter

0
推荐指数
1
解决办法
865
查看次数