How To Use Image Stack Widget Using Flutter Android App

admin_img Posted By Bajarangi soft , Posted On 30-10-2020

A Stack widget allows us to make multiple widgets overlay each other. This not only allows brilliant custom designs but also some really cool animations.

How To Use Image Stack Widget Using Flutter Android App

Image Stack Widget
Complete Code For Image Stack Widget In Flutter
main.dart

import 'package:flutter/material.dart';

void main(){
  runApp(MyApp());
}

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      debugShowCheckedModeBanner: false,
      home: MyHomePage()
    );
  }
}

class MyHomePage extends StatefulWidget {
  @override
  _MyHomePageState createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
          backgroundColor: Colors.blue[900],
          title: Text("Stack Widget",
            style: TextStyle(color:Colors.white
            ),)),
      body: Stack(
        children: <Widget>[
          new Image.asset(
            'assets/images/img.jpg',
            height: double.infinity,
            width: double.infinity,
            fit: BoxFit.fill,
          ),
          Positioned(
            bottom: 15.0,
            left: 20.0,
            child: Text("Bajarangisoft.com",
                style: TextStyle(
                    fontWeight: FontWeight.bold,
                    fontSize: 28.0,
                    color: Colors.white)),
          ),
        ],
      ),
    );
  }
}

 

Related Post