I have some issues with my background image since it didn’t show up on my application. I updated my pubspec yalm and added images to my assets directory, but only the logo image showed up. Can anyone explain for me pls? appreciate a lot
Here is my code:
import 'package:flutter/material.dart';
import '../components/login_textfield.dart';
import 'package:flutter/services.dart';
class LogInPage extends StatelessWidget {
const LogInPage({super.key});
@override
Widget build(BuildContext context) {
return Scaffold(
body: Padding(
padding: const EdgeInsets.all(10.0),
child: SafeArea(
child: Column(
children: [
Container(
decoration: const BoxDecoration(
image: DecorationImage(
image: AssetImage("assets/images/login_background.png"),
fit: BoxFit.cover,
)
)
),
const SizedBox(height: 10),
const Text("Cục An toàn Thông tin",
style: TextStyle(
fontFamily: 'Roboto',
fontWeight: FontWeight.w500
),
),
const Image(image: AssetImage("assets/images/login_logo.png"),
width: 80),
const SizedBox(height: 10),
const MyTextField(),
const SizedBox(height: 10),
const MyTextField()
],
)
),
)
);
}
}
My pubspec yalm
assets:
- assets/images/login_background.png
- assets/images/login_logo.png
Here is my expected result
enter image description here
My current result has no background image