Flutter jpg vs jpeg:影像资源服务引起的异常

时间:2019-12-15 12:31:17

标签: flutter dart

这就是出现的错误

  

I / flutter(8161):IM图像资源服务引起的异常CA ══════════════════════

  I / flutter(8161):抛出以下断言来解析图像编解码器:

  I / flutter(8161):无法加载资产:images / hermione.jpeg

但是我无法终生理解为什么当代码显示JPG时为什么说JPEG。

yaml:

flutter:
  uses-material-design: true
  assets:
    - images/

整个代码:

import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';

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

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        backgroundColor: Colors.teal[100],
        body: SafeArea(
          child: Center(
            child: Column(
              mainAxisAlignment: MainAxisAlignment.center,
              children: <Widget>[
                CircleAvatar(
                  radius: 100.0,
                  backgroundImage: AssetImage('images/hermione.jpg'),
                ),
                Text(
                  'Hermione Granger',
                  style: TextStyle(
                    fontFamily: 'OpenSansCondensed',
                    color: Colors.red[500],
                    fontSize: 20.0,
                    fontWeight: FontWeight.bold,
                    letterSpacing: 5.0,
                  ),
                ),
                Text(
                  'The girl who saved everyone',
                  style: TextStyle(
                    fontFamily: 'CourierPrime',
                    color: Colors.grey[800],
                    fontSize: 14.0,
                    letterSpacing: 10.0,
                  ),
                ),
              ],
            ),
          ),
        ),
      ),
    );
  }
}

这是我没有意识到的那些愚蠢的错误之一吗? (图像文件夹中的文件也为.jpg)

0 个答案:

没有答案