Skip to content

fixed: image sources null check #9

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion lib/app/modules/profile/views/profile_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import 'package:get/get.dart';

import '../../../../services/auth_service.dart';
import '../../../../models/screens.dart';
import '../../../utils/img_constants.dart';
import '../../../widgets/change_password_dialog.dart';
import '../../../widgets/image_picker_button.dart';
import '../controllers/profile_controller.dart';
Expand Down Expand Up @@ -62,7 +63,7 @@ class ProfileView extends GetView<ProfileController> {
)
: Center(
child: Image.asset(
'assets/images/dash.png',
ImgConstants.dash,
width: size,
fit: BoxFit.contain,
),
Expand Down
3 changes: 2 additions & 1 deletion lib/app/modules/root/views/root_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import 'package:get/get.dart';
import 'package:get_flutter_fire/services/auth_service.dart';
import '../../../routes/app_pages.dart';
import '../../../../models/screens.dart';
import '../../../utils/icon_constants.dart';
import '../controllers/root_controller.dart';
import 'drawer.dart';

Expand All @@ -31,7 +32,7 @@ class RootView extends GetView<RootController> {
)
: IconButton(
icon: ImageIcon(
const AssetImage("icons/logo.png"),
const AssetImage(IconConstants.logo),
color: Colors.grey.shade800,
),
onPressed: () => AuthService.to.isLoggedInValue
Expand Down
5 changes: 5 additions & 0 deletions lib/app/utils/icon_constants.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
abstract class IconConstants {
static const _assetsIcon = 'assets/icons';

static const logo = '$_assetsIcon/logo.png';
}
6 changes: 6 additions & 0 deletions lib/app/utils/img_constants.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
abstract class ImgConstants {
static const _assetsImg = 'assets/images';

static const dash = '$_assetsImg/dash.png';
static const flutterfire = '$_assetsImg/flutterfire_300x.png';
}
2 changes: 1 addition & 1 deletion lib/app/widgets/image_picker_button.dart
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,6 @@ class ImagePickerButton extends MenuSheetButton<ImageSources> {
icon: icon,
label: const Text('Pick an Image'),
)
: builder(context);
: builder(context, vals: values);
}
}
5 changes: 3 additions & 2 deletions lib/app/widgets/login_widgets.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import 'package:get/get.dart';
import '../../services/auth_service.dart';
import '../../models/screens.dart';
import '../../services/remote_config.dart';
import '../utils/img_constants.dart';
import 'menu_sheet_button.dart';

class LoginWidgets {
Expand All @@ -14,7 +15,7 @@ class LoginWidgets {
padding: const EdgeInsets.all(20),
child: AspectRatio(
aspectRatio: 1,
child: Image.asset('assets/images/flutterfire_300x.png'),
child: Image.asset(ImgConstants.flutterfire),
),
);
}
Expand All @@ -38,7 +39,7 @@ class LoginWidgets {
padding: const EdgeInsets.all(20),
child: AspectRatio(
aspectRatio: 1,
child: Image.asset('assets/images/flutterfire_300x.png'),
child: Image.asset(ImgConstants.flutterfire),
),
);
}
Expand Down
6 changes: 3 additions & 3 deletions pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ flutter:
fonts:
- asset: packages/firebase_ui_auth/fonts/SocialIcons.ttf
assets:
- assets/images/flutterfire_300x.png
- assets/images/dash.png
- assets/icons/logo.png
- assets/
- assets/images/
- assets/icons/
uses-material-design: true