我要在AppBar的左侧添加徽标图像,如下所示:https://i.stack.imgur.com/qGIbb.png
这是我当前的代码:
main.dart:
import 'package:flutter/material.dart';
import 'home_page.dart';
void main() => runApp(new MyApp());
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return new MaterialApp(title: "Chat App", home: new LoginPage());
}
}
home_page.dart:
import 'package:flutter/material.dart';
class LoginPage extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Smart ID',
home: Container(
decoration: BoxDecoration(
image: DecorationImage(
image: AssetImage("assets/background.png"), fit: BoxFit.cover)),
child: Scaffold(
backgroundColor: Colors.transparent,
appBar: AppBar(
elevation: 0,
backgroundColor: Color(0xff05B068),
centerTitle: true,
title: Text('SMARTID', style: TextStyle(fontFamily: 'Open Sans', fontWeight: FontWeight.bold)),
),
),
)
);
}
}
我如何应用徽标图像?
答案 0 :(得分:2)
有一个名为def pointsAreOnSameSideOfLine(a, b, c, x1, y1, x2, y2):
fx1 = 0 # Variable to store a * x1 + b * y1 - c
fx2 = 0 # Variable to store a * x2 + b * y2 - c
fx1 = a * x1 + b * y1 - c
fx2 = a * x2 + b * y2 - c
# If fx1 and fx2 have same sign
if ((fx1 * fx2) > 0):
return True
return False
的参数,该参数采用a, b, c = 1, 1, 1
x1, y1 = 1, 1
x2, y2 = 2, 1
if (pointsAreOnSameSideOfLine(a, b, c, x1, y1, x2, y2)):
print("Yes")
else:
print("No")
并将其放在leading
的左侧。
替换我在徽标中加上的widget
:
AppBar
答案 1 :(得分:0)