小编mon*_*910的帖子

更改Flutter Snackbar的位置

当某些条件不满足时,我想在按钮上方显示一个简单的消失错误消息。Flutter的Snackbar似乎非常适合此目的。

但是,我很难将Snackbar的位置更改为屏幕最底部以外的任何位置。这可能吗?如果不是,是否有更适合此目的的小部件?

我当前的小吃店代码:

class ContinueButton extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return Container(
      margin: const EdgeInsets.only(
          bottom: 24.0, top: 24.0),
      child: Align(
        alignment: FractionalOffset.bottomCenter,
        child: MaterialButton(
          onPressed: () {
            final snackBar = SnackBar(
              content: Text('Yay! A SnackBar!'),
            );
            Scaffold.of(context).showSnackBar(snackBar);
          },

          child: Text('Continue'),
          height: 40.0,
          minWidth: 300.0,
          color: Colors.greenAccent,
        ),
      ),
    );
  }
}
Run Code Online (Sandbox Code Playgroud)

android flutter flutter-layout

6
推荐指数
3
解决办法
1157
查看次数

PHP Heredoc 意外的文件结尾错误

我正在使用 Heredoc 以将非常大的 HTML 块保存到变量中,以便我可以将其作为电子邮件发送。但是,我不断收到意外的文件结尾语法错误。在关闭 Heredoc 标签和其他常见问题之前,我已经检查过空格。任何帮助将不胜感激!

这是我的完整代码:

<?php

include("init.php");
$email = "matthew910@gmail.com";

$body = <<<HEREDOC
    <!DOCTYPE html>
<html lang="en" style="height: 100%; font-family: sans-serif; -ms-text-size-adjust: 100%; -webkit-text-size-adjust: 100%; background-color: transparent !important; color: #000 !important; -webkit-box-shadow: none !important; box-shadow: none !important; text-shadow: none !important; -webkit-box-sizing: border-box; -moz-box-sizing: border-box; box-sizing: border-box; font-size: 10px; -webkit-tap-highlight-color: rgba(0, 0, 0, 0);">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link rel="shortcut icon" href="https://d2jug8yyubo3yl.cloudfront.net/26999B2F-7C10-4962-918C-E964709E745D/e5d39140-5a3e-4177-9ff1-d7cf74cb6972.jpg">
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width">
<meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no">
<!-- <meta …
Run Code Online (Sandbox Code Playgroud)

php heredoc unexpectendoffile

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

具有多个ands和ors的Mysql查询

我正在尝试为我的网站上的服务器创建过滤功能.用户可以检查他们想要过滤的类别的不同选项,并且我有一个ajax请求,返回满足其条件的服务器.但是,我的mysql_query无法正常工作,我想我的语法可能不对.

默认情况下,每个类别都将选项设置为1.我当前的查询是:

$order = "SELECT * FROM `servers` 
    WHERE `size` = '$size' or 
      1 = '$size' and 
      `type` = '$type' or 
      1 = '$type' and 
      `mode` = '$gamemode' or 
      1 = '$gamemode' and 
      `main` = '$main' or 
      1 = '$main' 
    ORDER BY $orderby 
    LIMIT 5";
Run Code Online (Sandbox Code Playgroud)

它似乎没有得到正确的服务器,我的查询中有错误吗?

谢谢!

php mysql

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