Home > Net >  Flutter Image AppBar Extend further than background
Flutter Image AppBar Extend further than background

Time:12-03

My question is how do I extend my transparent image further than the appbar's borders? I want the image to cover the whole of the appbar, I have tried using fit: and it doesn't do the job. I want the whole of the orange covered by the image.

This is my code below:

import 'package:flutter/material.dart';

void main() => runApp(const MyApp());

class MyApp extends StatelessWidget {
  const MyApp({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    var title = 'Web Images';

return MaterialApp(
  title: title,
  home: Scaffold(
    appBar: AppBar(
      title: SizedBox(
        width: 1000,
        child: Image.asset('assets/images/foodBackground.png'),


         ),
            backgroundColor: const Color(0xffFA7343),
        ),
        body: Text('test1'),
      ),
    );
  }
}

enter image description here

CodePudding user response:

AppBar(
  flexibleSpace: Image.asset(
    'assets/images/foodBackground.png',
  ),
),
  • Related