Flutter - Drawing a rectangle in bottom

Viewed 21661

I'm trying to draw a rectangle at the bottom only the Rect object Rect.fromLTRB is not drawing.

I do not know if I'm interpreting the Rect object in the wrong way or I'm writing the drawRect object erroneously.

Could you help me draw a rectangle in the 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;
  }
}
2 Answers
Related