加载本地图片

import 'package:flutter/material.dart';

void main() {
  runApp(MaterialApp(
    home: Scaffold(
        appBar: AppBar(title: const Text("加载本地图片")), body: const MyApp()),
  ));
}

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  @override
  Widget build(BuildContext context) {
    return Center(
      child: Container(
        decoration: const BoxDecoration(color: Colors.lightBlue),
        child: Image.asset(
          "assets/splash.png",
          fit: BoxFit.cover,
        ),
      ),
    );
  }
}

  

posted @ 2024-08-20 11:07  飞雪飘鸿  阅读(8)  评论(0编辑  收藏  举报
https://damo.alibaba.com/ https://tianchi.aliyun.com/course?spm=5176.21206777.J_3941670930.5.87dc17c9BZNvLL