加载远程图片

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(
        width: 300,
        height: 160,
        decoration: const BoxDecoration(color: Colors.lightBlue),
        child: Image.network(
          "https://img-s-msn-com.akamaized.net/tenant/amp/entityid/AA1p2dXL.img?w=768&h=647&m=6&x=358&y=143&s=406&d=406",
          fit: BoxFit.cover,
        ),
      ),
    );
  }
}

  

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