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'),
),
);
}
}
This is the image of how it looks, as you can see it hasn’t filled to the edges of the appbar.
2
Answers
try with this and you need to ensure
titleSpacing
should be zero and you dynamic widthouble.infinity
output: