标签: button

在Delphi中执行自动取消选中按钮的操作

当我按下TSpeedButton时我想要执行一个动作,而当同一个按钮被"未按下"时我想要执行另一个动作.我知道没有onunpress事件,但有什么简单的方法可以让我在按下不同的按钮时执行操作?

procedure ActionName.ActionNameExecute(Sender: TObject);
begin
  PreviousActionName.execute(Sender);
  //
end;
Run Code Online (Sandbox Code Playgroud)

看起来太笨重了.

delphi button taction

3
推荐指数
2
解决办法
2855
查看次数

Flutter,按下按钮后如何将数据粘贴到 Text Widget 上?

首先,我对我不完美的英语感到非常抱歉;)

我从应用程序复制数据,我想在我的应用程序中点击按钮,它会复制数据并将其粘贴到小部件文本上

预先感谢您的帮助。

copy widget button paste flutter

3
推荐指数
1
解决办法
2363
查看次数

按下后退按钮转到主屏幕时如何处理颤动底部导航栏

我正在开发底部导航栏,但我没有完美地按回按到主屏幕。

如果我从底部导航栏视图项目中选择两个以上导航按钮,那么当我按后退按钮时,它将关闭应用程序。

我想在按下后退按钮时返回主页。

这是我的代码。

import 'package:flutter/material.dart';

void main() => runApp(const MyApp());


class MyApp extends StatelessWidget {
  const MyApp({Key? key}) : super(key: key);

  static const String _title = 'Flutter Code Sample';

  @override
  Widget build(BuildContext context) {
    return const MaterialApp(
      title: _title,
      home: MyStatefulWidget(),
    );
  }
}


class MyStatefulWidget extends StatefulWidget {
  const MyStatefulWidget({Key? key}) : super(key: key);

  @override
  State<MyStatefulWidget> createState() => _MyStatefulWidgetState();
}


class _MyStatefulWidgetState extends State<MyStatefulWidget> {
  int _selectedIndex = 0;
  static const TextStyle optionStyle =
      TextStyle(fontSize: 30, fontWeight: FontWeight.bold); …
Run Code Online (Sandbox Code Playgroud)

android button onbackpressed flutter

3
推荐指数
1
解决办法
8285
查看次数

使用 Button Jupyter Notebook 终止循环?

我想要:

  • 从串口读取(无限循环)
  • 当按下“STOP”按钮时 --> 停止读取并绘制数据

来自如何通过按键杀死 while 循环? 我以使用键盘中断为例进行中断,这有效,但我想使用按钮。

键盘中断示例

weights = []
times = [] 
#open port 
ser = serial.Serial('COM3', 9600)
try:
   while True: # read infinite loop
       #DO STUFF
       line = ser.readline()   # read a byte string
       if line:
           weight_ = float(line.decode())  # convert the byte string to a unicode string
           time_ = time.time()
           weights.append(weight_)
           times.append(time_)
           print (weight_)
#STOP it by keyboard interup and continue with program 
except KeyboardInterrupt:
   pass
#Continue with plotting
Run Code Online (Sandbox Code Playgroud)

不过我想用一个显示的按钮来做到这一点(更方便人们使用)。我尝试制作一个按钮(在 …

python events button break

3
推荐指数
1
解决办法
2244
查看次数

颤振 onPressed 函数

onPressed 中出错尝试传递 onPressed 函数但出现错误。

错误 - 参数类型“Function”无法分配给参数类型“void Function()?”。在此输入图像描述

class CircleButton extends StatelessWidget {
  CircleButton({required this.icon, required this.onPressed});
  final IconData icon;
  final Function onPressed;                 [![Error][1]][1]//Here
  @override
  Widget build(BuildContext context) {
    return ElevatedButton(
      child: Icon(icon),
      onPressed: onPressed,
      style: ElevatedButton.styleFrom(
        elevation: 6.0,
        primary: Color(0xFF4C4F5E),
        shape: CircleBorder(),
        padding: EdgeInsets.all(15),
      ),);
  }}
Run Code Online (Sandbox Code Playgroud)

function button flutter

3
推荐指数
1
解决办法
1788
查看次数

如何在按钮中心添加两行

有一个带边框的按钮:3pxsolid#E82929;可以使用什么技术来添加像照片中那样的额外线条?

\n

在此输入图像描述

\n

\r\n
\r\n
.btn {\n  position: relative;\n  width: 362px;\n  height: 71px;\n  color: #FFFFFF;\n  background-color: #000000;\n  border: 3px solid #E82929;\n  font-family: \'Flamenco\';\n  font-style: normal;\n  font-weight: 400;\n  font-size: 24px;\n  line-height: 25px;\n  text-align: center;\n}
Run Code Online (Sandbox Code Playgroud)\r\n
<button class="btn">\xd0\x97\xd0\xb0\xd0\xb1\xd1\x80\xd0\xbe\xd0\xbd\xd0\xb8\xd1\x80\xd0\xbe\xd0\xb2\xd0\xb0\xd1\x82\xd1\x8c \xd1\x81\xd1\x82\xd0\xbe\xd0\xbb\xd0\xb8\xd0\xba</button>
Run Code Online (Sandbox Code Playgroud)\r\n
\r\n
\r\n

\n

html css button

3
推荐指数
1
解决办法
70
查看次数

Apple 支付按钮未显示在 HTML 网站中

我有一个 HTML 文件,其中添加了如下所述的代码: https ://developer.apple.com/documentation/apple_pay_on_the_web/displaying_apple_pay_buttons_using_javascript

所以我的 HTML 代码如下所示:

<!DOCTYPE html>
<html>
<head>
  <script src="https://applepay.cdn-apple.com/jsapi/v1/apple-pay-sdk.js"></script>

  <style>

    apple-pay-button {
      --apple-pay-button-width: 140px;
      --apple-pay-button-height: 30px;
      --apple-pay-button-border-radius: 5px;
      --apple-pay-button-padding: 5px 0px;
    }

  </style>
</head>

<body>

<apple-pay-button buttonstyle="black" type="plain" locale="en">Check out</apple-pay-button>

</body>
</html>
Run Code Online (Sandbox Code Playgroud)

当我在 MacBook Pro 上的 Chrome 或 Safari 中打开 HTML 文件时,它不显示该按钮。控制台中也没有 JavaScript 错误。

如何让 Apple pay 按钮显示在浏览器中?我特别需要带有 Apple 徽标的“结账”按钮。

html javascript css button applepay-web

3
推荐指数
1
解决办法
1454
查看次数

使用后退按钮使 AppBar 居中

我将显示在中心 AppBar 中的文本和图标存储在标题中。在转换过程中,出现的后退按钮占据了线条的一部分,并且我的居中位置发生了变化。即使有后退按钮,我可以以某种方式解决这个问题并使标题居中吗?

在此输入图像描述

底部图标位于屏幕中央

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        leading: BackButton(
        color: Colors.grey
   ), 
          elevation: 0,
          title: Center(
              child: Row(
            mainAxisAlignment: MainAxisAlignment.center,
            children: [
              Icon(Icons.telegram_sharp, color: iconColor),
              Padding(
                  padding:
                      const EdgeInsets.symmetric(horizontal: 2, vertical: 2)),
              Text('ID', style: TextStyle(color: Colors.black, fontSize: 18)),
            ],
          ))),
      body: Padding(
        padding: const EdgeInsets.all(20),
        child: ListView(
          children: [
            _MainInfoWidget(),
          ],
        ),
      ),
    );
  }
Run Code Online (Sandbox Code Playgroud)

position appbar button dart flutter

3
推荐指数
1
解决办法
2535
查看次数

如何在 Flutter 中给带有装饰的容器添加波纹效果?

我想为自定义添加连锁反应Container。我已经使用Inkwell和Material小部件来实现此行为,但它不起作用。代码如下:

@override
  Widget build(BuildContext context) {
    return Center(
      child: Material(
        color: Colors.transparent,
        child: InkWell(
          onTap: (){},
          child: Container(
            width: 150,
            height: 100,
            decoration: BoxDecoration(
              border: Border.all(color: Colors.red, width: 2),
              borderRadius: BorderRadius.circular(18),
              color: Colors.deepPurpleAccent,
            ),
            alignment: Alignment.center,
            child: Text(
              "A box container",
              style: TextStyle(color: Colors.white),
            ),
          ),
        ),
      ),
    );
  }
Run Code Online (Sandbox Code Playgroud)

结果是:

在此输入图像描述

我还使用了透明颜色Container和紫色,Material如下所示:

@override
  Widget build(BuildContext context) {
    return Center(
      child: Material(
        color: Colors.deepPurpleAccent,
        child: InkWell(
          onTap: () {},
          child: Container( …
Run Code Online (Sandbox Code Playgroud)

button flutter flutter-layout flutter-container

3
推荐指数
1
解决办法
2773
查看次数

Jetpack Compose 中的默认按钮单击声音

在经典 Android(基于 XML 的布局)中实现应用程序功能时,我默认启用了点击声音,如果在设备上设置了适当的模式,我可以听到它。

但是,我注意到它对于 Jetpack Compose 中编写的功能来说并不能开箱即用。如何在不更新每个按钮和交互源修改器的情况下启用默认按钮单击声音?

我尝试手动添加点击声音,但它会在代码库中造成混乱。如何以更简单的方式实现呢?Compose 现在是一种在 Android 中进行开发的首选方法,因此我认为它应该是一种更简单的方法。

audio android click button android-jetpack-compose

3
推荐指数
1
解决办法
913
查看次数