是否可以离开FloatingActionButton中心而不是右侧?
import 'package:flutter/material.dart';
import 'number.dart';
import 'keyboard.dart';
class ContaPage extends StatelessWidget {
@override
Widget build(BuildContext context) => new Scaffold(
body: new Column(
children: <Widget>[
new Number(),
new Keyboard(),
],
),
floatingActionButton: new FloatingActionButton(
elevation: 0.0,
child: new Icon(Icons.check),
backgroundColor: new Color(0xFFE57373),
onPressed: (){}
)
);
}
Run Code Online (Sandbox Code Playgroud)
我试图在底部绘制一个矩形,仅Rect对象Rect.fromLTRB未绘制。
我不知道我是Rect用错误的方式解释对象还是错误地编写了drawRect对象。
你能帮我在底部画一个矩形吗?
import 'package:flutter/material.dart';
void main() {
runApp(new MaterialApp(home: new HomePage()));
}
class HomePage extends StatefulWidget {
@override
HomePageState createState() => new HomePageState();
}
class HomePageState extends State<HomePage> {
@override
Widget build(BuildContext context) {
return new Scaffold(
body: new Stack(
children: <Widget>[
new Positioned(
bottom: 0.0,
left: 0.0,
right: 0.0,
top: 0.0,
child: new CustomPaint(
painter: new Sky(),
)
),
]
)
);
}
}
class Sky extends CustomPainter {
@override …Run Code Online (Sandbox Code Playgroud) 我正在使用TextField但是键盘正在提升FloatingActionButton.我想知道键盘是否有可能不提高FloatingActionButton?
在下面的代码中,我FloatingActionButton用两种不同的方式放两个,但是在两个键盘都上升,这阻碍了字段填充,因为FAB与TextField下面的gif 在同一行.
有什么方法可以解决这个问题吗?
import 'package:flutter/material.dart';
import 'dart:ui' as ui;
void main() {
runApp(new MyApp());
}
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return new MaterialApp(
home: new MyHomePage(),
);
}
}
class MyHomePage extends StatefulWidget {
@override
_MyHomePageState createState() => new _MyHomePageState();
}
class _MyHomePageState extends State<MyHomePage> {
@override
Widget build(BuildContext context) {
final ui.Size logicalSize = MediaQuery.of(context).size;
final double _width = logicalSize.width;
return new Scaffold( …Run Code Online (Sandbox Code Playgroud) 如何FileReaderSync在 Angular2 中安装?
它出现在文件中node_modules/typescript/lib/lib.webworker.d.ts但无法使用它。
我FileReader可以使用它而无需导入任何内容。
我需要对 FileReaderSync 做一些不同的事情吗?
error TS2304: Cannot find name 'FileReaderSync'.
我试图改变AppBar的背景颜色,但它不起作用.
0x673AB7根据下图选择颜色时,AppBar变为灰色而不是紫色.
import "package:flutter/material.dart";
void main() {
runApp(new ControlleApp());
}
class ControlleApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return new MaterialApp(
title: "Controlle Financeiro",
home: new HomePage(),
);
}
}
class HomePage extends StatelessWidget {
@override
Widget build(BuildContext context) {
return new Scaffold(
appBar: new AppBar(
backgroundColor: new Color(0x673AB7),
),
);
}
}
Run Code Online (Sandbox Code Playgroud)
当我使用Python生成base64将在其中使用的字符串时raw key { 'raw': value } GMAIL API,发送电子邮件就完美了.
但是当我使用Dart生成相同的base64字符串时,字符串与python不同,因此我无法发送电子邮件,因为GMAIL API告诉我message: Invalid value for ByteString
将转换为base64的字符串是:
var message = '''<html><meta http-equiv="content-type" content="text/html; charset=utf-8"/><head></head><body>Test</body></html>'''
Run Code Online (Sandbox Code Playgroud)
Python代码:
import base64
e = base64.urlsafe_b64encode('''<html><meta http-equiv="content-type" content="text/html; charset=utf-8"/><head></head><body>Test</body></html>''')
print(e)
Run Code Online (Sandbox Code Playgroud)
结果:
PGh0bWw-PG1ldGEgaHR0cC1lcXVpdj0iY29udGVudC10eXBlIiBjb250ZW50PSJ0ZXh0L2h0bWw7IGNoYXJzZXQ9dXRmLTgiLz48aGVhZD48L2hlYWQ-PGJvZHk-VGVzdDwvYm9keT48L2h0bWw-
飞镖码:
import 'dart:convert';
var _bytes = utf8.encode('''<html><meta http-equiv="content-type" content="text/html; charset=utf-8"/><head></head><body>Test</body></html>''');
var _base64 = base64Encode(_bytes);
print(_base64);
Run Code Online (Sandbox Code Playgroud)
结果:
PGh0bWw+PG1ldGEgaHR0cC1lcXVpdj0iY29udGVudC10eXBlIiBjb250ZW50PSJ0ZXh0L2h0bWw7IGNoYXJzZXQ9dXRmLTgiLz48aGVhZD48L2hlYWQ+PGJvZHk+VGVzdDwvYm9keT48L2h0bWw+
请注意,唯一的区别是+Dart的base64字符串中的-符号,以及Python的base64字符串中的符号
如何生成相同的base64 python代码,以便我可以在GMAIL API中发送电子邮件
我正在尝试获取请求,但我需要放入cookie。
使用curl可以:
curl -v --cookie "sessionid=asdasdasqqwd" <my_site>
但是下面的功能没有带来什么
import 'dart:async';
import 'package:http/http.dart' as http;
import 'package:html/parser.dart' as parser;
import 'package:html/dom.dart';
...
parseHtml() async {
http.Response response = await http.get (
<my_site>,
headers: {"sessionid": "asdasdasqqwd"}
);
Document document = parser.parse (response.body);
print(document.text);
}
Run Code Online (Sandbox Code Playgroud)
有没有办法将Cookie放在Dart中的get请求上?
如果函数 canActivate 的值为 false,我无法将受保护的组件HeaderComponent重定向到该LoginComponent组件。
该HeaderComponent组件和他们的孩子受到保护,只有访问URLhttp://localhost:3000/#/header/index时出现黑屏,我希望它被引导到http://localhost:3000/#/auth是登录屏幕
有谁知道如何帮助我?
auth.guard.ts
import {Injectable} from '@angular/core';
import {CanActivate, ActivatedRouteSnapshot, RouterStateSnapshot, Router} from '@angular/router';
import {Observable, BehaviorSubject} from 'rxjs/Rx';
import 'rxjs/operator/take';
import {LoginService} from './login/login.service';
@Injectable()
export class AuthGuard implements CanActivate {
constructor(private loginService: LoginService, private router: Router) {}
canActivate(
route: ActivatedRouteSnapshot,
state: RouterStateSnapshot): Observable<boolean> | boolean {
this.loginService.logado()
.subscribe(
data => {
return data //true
},
error => {
this.loginService.redirectUrl = state.url;
this.router.navigate(['/auth']);
return error …Run Code Online (Sandbox Code Playgroud) 我不确定如何通过循环(例如)生成多个ListTiles for()。
我不知道Flutter如何渲染小部件,因为在Angular 2中,只需*ngFor在布局(html)中插入指令即可。
我在Flutter文档中找不到这样的主题。
主镖
import 'package:flutter/material.dart';
void main() {
runApp(new MyApp());
}
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return new MaterialApp(
title: "Myapp",
home: new HomePage(),
);
}
}
class HomePage extends StatelessWidget {
@override
Widget build(BuildContext context) => new Scaffold(
appBar: new AppBar(
backgroundColor: new Color(0xFF26C6DA),
),
body: new ListView (
children: <Widget>[
new Card(
child: new Column(
mainAxisSize: MainAxisSize.min,
children: <Widget>[
const ListTile(
leading: const Icon(Icons.album),
title: const Text('The …Run Code Online (Sandbox Code Playgroud) dart ×8
flutter ×6
angular ×2
center-align ×1
filereader ×1
observable ×1
python ×1
redirect ×1
request ×1
setcookie ×1
typescript ×1