使用 assets_util 来管理 assets
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import '../widgets/floating_icon.dart';
|
||||
import '../utils/assets_util.dart';
|
||||
|
||||
class MainScreen extends StatefulWidget {
|
||||
const MainScreen({super.key});
|
||||
@@ -26,9 +27,9 @@ class _MainScreenState extends State<MainScreen> {
|
||||
body: Stack(
|
||||
children: [
|
||||
Container(
|
||||
decoration: const BoxDecoration(
|
||||
decoration: BoxDecoration(
|
||||
image: DecorationImage(
|
||||
image: AssetImage('assets/images/bg.jpg', package: 'ai_chat_assistant'),
|
||||
image: AssetsUtil.getImage('bg.jpg'),
|
||||
fit: BoxFit.cover,
|
||||
),
|
||||
),
|
||||
|
||||
@@ -5,6 +5,7 @@ import '../screens/full_screen.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import '../services/message_service.dart';
|
||||
import '../widgets/gradient_background.dart';
|
||||
import '../utils/assets_util.dart';
|
||||
|
||||
class PartScreen extends StatefulWidget {
|
||||
final VoidCallback? onHide;
|
||||
@@ -202,11 +203,10 @@ class _PartScreenState extends State<PartScreen> {
|
||||
top: 6,
|
||||
right: 6,
|
||||
child: IconButton(
|
||||
icon: Image.asset(
|
||||
'assets/images/open_in_full.png',
|
||||
icon: AssetsUtil.getImageWidget(
|
||||
'open_in_full.png',
|
||||
width: 24,
|
||||
height: 24,
|
||||
package: 'ai_chat_assistant',
|
||||
),
|
||||
onPressed: _openFullScreen,
|
||||
padding: EdgeInsets.zero,
|
||||
|
||||
Reference in New Issue
Block a user