小编J P*_*J P的帖子

在 Flutter 中将 RaisedButton 居中

我正在研究如何将这个按钮居中。

@override
  Widget build(BuildContext context) {
    return new MaterialApp(
      debugShowCheckedModeBanner: false,
      color: Colors.pinkAccent,
      home:new Scaffold(
        appBar: new AppBar(backgroundColor: Colors.white,),
        body: new Column(
            children: <Widget>[

               new Padding(
                padding: const EdgeInsets.symmetric(vertical: 10.0),
              ),
              new RaisedButton(

                splashColor: Colors.pinkAccent,
                color: Colors.black,
                child: new Text("Scan",style: new TextStyle(fontSize: 20.0,color: Colors.white),),
                onPressed: scan,
              ),
              new Padding(padding: const EdgeInsets.symmetric(vertical: 10.0), ),
              new Text('$_reader',softWrap: true, style: new TextStyle(fontSize: 30.0,color: Colors.black),),

         ],
        ),
      ),
    );
  }
Run Code Online (Sandbox Code Playgroud)

这是从这里:https : //pub.dartlang.org/packages/barcode_scan#-example-tab-

请帮我解决这个问题,谢谢。

编辑:如何将所有内容都集中在“身体”中?

flutter

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

hCaptcha 在调用时滚动到顶部

我已以不可见模式将 hCaptcha 添加到我的网站,当按下表单上的提交按钮时,我会调用挑战

await captcha.execute({ async: true }).catch(() => { // ... }
submitForm();
Run Code Online (Sandbox Code Playgroud)

但是,由于某种原因,这会导致页面滚动到顶部,然后向我显示 hCaptcha 挑战。

如何防止这种滚动发生?

示例: https: //codepen.io/aisouard/pen/mdxKqZy

html javascript frontend hcaptcha

6
推荐指数
1
解决办法
470
查看次数

保持 aiohttp 会话处于活动状态

我尝试每 X 秒访问一个具有并行和单独会话的网站,然后分析响应中的内容以查看每个会话是否应该继续。但是,一旦代码到达第二个循环,它就会失败。

import asyncio
from aiohttp import ClientSession
import logging
import time

interval = 30
instances = 2
visit_url = 'http://www.example.org'

tasks = []

logging.basicConfig(
    format='%(asctime)s.%(msecs)03d %(message)s',  # Log in format time.milliseconds {message}
    level=logging.INFO,  # Use with logging.info()
    datefmt='%H:%M:%S')  # Display time as Hours:Minutes:Seconds


class StopException(Exception):
    pass


async def quit_app(session, task_, reason):
    logging.info("[{}] {}.".format(task_, reason))
    session.cookies.clear()  # Reset cookies
    session.headers.clear()  # Reset headers
    session.close()  # End HTTP connection
    raise StopException


async def get_status(response):
    if "abow" in response:
        return "success" …
Run Code Online (Sandbox Code Playgroud)

python python-asyncio aiohttp

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