Reputation: 101
pubspec.yaml
google_sign_in: ^4.1.4
apple_sign_in:
path: /home/Desktop/temp/apps/Apple/flutter_apple_sign_in/
PUB of flutter_apple_sign_in
# The following section is specific to Flutter.
flutter:
uses-material-design: true
plugin:
androidPackage: dev.gilder.tom.apple_sign_in
pluginClass: AppleSignInPlugin
assets:
- images/
//Following is code
class _AppleSignInButtonState extends State<AppleSignInButton> {
bool _isTapDown = false;
@override
Widget build(BuildContext context) {
final bgColor =
widget.style == ButtonStyle.black ? Colors.black : Colors.white;
final textColor =
widget.style == ButtonStyle.black ? Colors.white : Colors.black;
final borderColor =
widget.style == ButtonStyle.white ? Colors.white : Colors.black;
return GestureDetector(
onTapDown: (_) => setState(() => _isTapDown = true),
onTapUp: (_) {
setState(() => _isTapDown = false);
widget?.onPressed();
},
onTapCancel: () => setState(() => _isTapDown = false),
child: AnimatedContainer(
duration: Duration(milliseconds: 100),
decoration: BoxDecoration(
borderRadius: BorderRadius.all(
Radius.circular(widget.cornerRadius),
),
),
child: Container(
child: widget.type == ButtonType.continueButton
? Image.asset("images/white_outlined.png")
: Image.asset("images/getapple.jpg") //Here I am using jpg
),
width: double.infinity,
),
);
}
}
Error
══╡ EXCEPTION CAUGHT BY IMAGE RESOURCE SERVICE ╞════════════════════════════════════════════════════
I/flutter (32764): The following assertion was thrown resolving an image codec:
I/flutter (32764): Unable to load asset: images/getapple.jpg
I/flutter (32764):
I/flutter (32764): When the exception was thrown, this was the stack:
I/flutter (32764): #0 PlatformAssetBundle.load (package:flutter/src/services/asset_bundle.dart:221:7)
I/flutter (32764): <asynchronous suspension>
I/flutter (32764): #1 AssetBundleImageProvider._loadAsync (package:flutter/src/painting/image_provider.dart:664:31)
I/flutter (32764): #2 AssetBundleImageProvider.load (package:flutter/src/painting/image_provider.dart:648:14)
**Here I am using flutter_apple_sign_in package in the local directory, I am using ubuntu, I want to modify the UI of that package, so I forked it. And While I am accessing that package,I am unable to access images and getting the above error.
I have attached the screenshot below.
Upvotes: 1
Views: 266
Reputation: 76
In pubspec.yaml
you need to declare your images assets
flutter:
assets:
- images/getapple.jpg
or To include all of your image files in your folder
flutter:
assets:
- images/
if it not showing try to stop and run your program again.
Upvotes: 2