dart - Flutter - Drawing a rectangle in bottom -
i'm trying draw rectangle @ bottom rect
object rect.fromltrb
not drawing.
i not know if i'm interpreting rect
object in wrong way or i'm writing drawrect
object erroneously.
could me draw rectangle in bottom?
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 void paint(canvas canvas, size size) { canvas.drawrect( new rect.fromltrb( 0.0, 100.0, 0.0, 0.0 ), new paint()..color = new color(0xff0099ff), ); } @override bool shouldrepaint(sky olddelegate) { return false; } }
your left , right same (0.0) draws empty rect. coordinates start on top, bottom should > top; try this
new rect.fromltrb( 0.0, 0.0, 20.0, 100.0 )
Comments
Post a Comment