Skip to content

Image assets don't work in custom widgets #522

@abdrzq16

Description

@abdrzq16

Expected behavior (required)

Calling image from the assets in custom widget is not working at all. In all browsers and in the APK file.

Current behavior (required)

Just plain white.

To Reproduce (required)

If you need to use an Image. Asset in your custom code, it will not work.

 // Automatic FlutterFlow imports
import '../../flutter_flow/flutter_flow_theme.dart';
import '../../flutter_flow/flutter_flow_util.dart';
import '../widgets/index.dart'; // Imports other custom widgets
import '../../flutter_flow/custom_functions.dart'; // Imports custom functions
import 'package:flutter/material.dart';
// Begin custom widget code
// DO NOT REMOVE OR MODIFY THE CODE ABOVE!

class Aaa extends StatefulWidget {
  const Aaa({
    Key? key,
    this.width,
    this.height,
    this.ppp,
  }) : super(key: key);

  final double? width;
  final double? height;
  final String? ppp;

  @override
  _AaaState createState() => _AaaState();
}

class _AaaState extends State<Aaa> {
  @override
  Widget build(BuildContext context) {
    return Container(
      width: double.infinity,
      height: double.infinity,
      decoration: BoxDecoration(
        color: FlutterFlowTheme.of(context).secondaryBackground,
      ),
      child: 
        Image.asset(
                               'assets/images/604.jpg',
                                width: double.infinity,
                                height: double.infinity,
                                fit: BoxFit.contain,
                              ),

    );
  }
}

Context (required)

I had to make pageview of 600 images manually>

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions