Site icon George的生活點滴

Flutter – Image

import 'package:flutter/material.dart';
void main() => runApp(MyApp());

class MyApp extends StatelessWidget{
  @override
  Widget build(BuildContext context){
    return MaterialApp(
      debugShowCheckedModeBanner: false,
      title:'Starter Template',
      home: Scaffold(
        appBar: AppBar(       
          title:Text('IMG'),
        ),
        body:Center(   
          child: Image.asset("assets/img1.jpg"),   //插入圖片
      
        ),   
      ),   
    );
  }
}

Image widgets support the following formats:
.JPEG
.PNG
.GIF
.Animated GIF
.BMP
.WBMP
.WebP
.Animated WebP

To be continued…

Exit mobile version