Issue with Google Pay Button Rendering in Light Theme and Theme.AppCompat Error
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 25/100
Hướng nghiên cứu
Bắt đầu với cấu hình Flutter GooglePayButton và các entry point Android PayButtonView.kt được trích dẫn trong stack trace, sau đó so sánh theme của manifest và các dependency Google Play Services được liệt kê. Tái hiện với pay 2.0.0 và phiên bản Flutter được báo cáo; hoàn tất khi button dùng light theme được render chính xác mà không có lỗi Theme.AppCompat hoặc lỗi phân giải attribute.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Description:
There seems to be an issue when using the Google Pay Button with the pay package in Flutter. The button does not render correctly when using the light theme, and there are errors related to the Theme.AppCompat.
Steps to Reproduce:
Add the pay package and necessary dependencies to the Flutter project.
Run the app and observe the rendering issue and log errors.
Expected Behavior:
The Google Pay Button should render correctly with the light theme applied.
Observed Behavior:
The button shows graphical glitches or does not render correctly. Additionally, there are errors in the logs related to using Theme.AppCompat.
Additional Information:
The error message indicates an issue with the attribute at index 0, related to the Theme.AppCompat.
Please investigate this issue to determine the root cause and provide a fix or workaround. Thank you.
Additional Information:
pay package version: pay: ^2.0.0
flutter --version
Flutter 3.22.3 • channel stable • https://github.com/flutter/flutter.git
Framework • revision b0850beeb2 (3 weeks ago) • 2024-07-16 21:43:41 -0700
Engine • revision 235db911ba
Tools • Dart 3.4.4 • DevTools 2.34.3
Android Studio Koala | 2024.1.1 Patch 1
Build #AI-241.18034.62.2411.12071903, built on July 10, 2024
Runtime version: 17.0.11+0--11852314 amd64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o.
Windows 11.0
GC: G1 Young Generation, G1 Old Generation
Memory: 4058M
Cores: 24
Registry:
debugger.new.tool.window.layout=true
ide.experimental.ui=true
Relevant code:
Center(
child: GooglePayButton(
paymentConfiguration: paymentConfig,
key: Key(selectedIndex.toString()),
paymentItems: [
PaymentItem(
label: 'Total',
amount: (() {
final price = packages![selectedIndex].price.toString();
return price;
})(),
status: PaymentItemStatus.final_price,
)
],
theme: GooglePayButtonTheme.light,
type: GooglePayButtonType.pay,
margin: const EdgeInsets.only(top: 15.0),
onPressed: () {
setState(() {});
return;
},
onPaymentResult: (result) async {
try {
String res = result.toString();
log("Payment result: $res");
String tokenJson = result['methodData']['tokenData']['token'];
Map<String, dynamic> tokenData = jsonDecode(tokenJson);
String tokenId = tokenData['id'];
int amount = convertToIntMultiplyBy100(packages![selectedIndex].price);
String tokenDesc = result['methodData']['description'];
await processStripePayment(
tokenId,
amount,
packages![selectedIndex].points,
tokenDesc,
);
} catch (e, s) {
userFeedback.showFeedbackMessage("Payment Error", e.toString());
handleError(e, s, 'Payment Error');
}
},
onError: (error) {
log("Payment error: $error");
},
loadingIndicator: const Center(
child: CircularProgressIndicator(),
),
),
),
Manifest Configuration:
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
<application
android:enableOnBackInvokedCallback="true"
android:usesCleartextTraffic="true"
android:label="xpt"
android:name="${applicationName}"
android:icon="@mipmap/ic_launcher">
<activity
android:name=".MainActivity"
android:exported="true"
android:launchMode="singleTop"
android:theme="@style/Theme.AppCompat.Light"
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
android:hardwareAccelerated="true"
android:windowSoftInputMode="adjustResize">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
<meta-data
android:name="flutterEmbedding"
android:value="2" />
<meta-data
android:name="com.google.android.gms.wallet.api.enabled"
android:value="true"/>
</application>
<queries>
<intent>
<action android:name="android.intent.action.VIEW" />
<data android:scheme="sms" />
</intent>
<intent>
<action android:name="android.intent.action.VIEW" />
<data android:scheme="tel" />
</intent>
<intent>
<action android:name="android.intent.action.SENDTO" />
<data android:scheme="mailto" />
</intent>
</queries>
Dependencies:
dependencies {
implementation 'com.android.support:multidex:1.0.3'
implementation "androidx.multidex:multidex:2.0.1"
implementation 'com.google.android.material:material:1.9.0'
implementation 'androidx.compose.material:material:1.6.8'
implementation 'com.google.android.gms:play-services-wallet:19.4.0'
implementation 'com.google.android.gms:play-services-base:18.5.0'
implementation 'com.stripe:stripe-android:20.37.4'
implementation(platform("com.google.firebase:firebase-bom:33.1.2"))
implementation("com.google.firebase:firebase-crashlytics-ndk")
implementation("com.google.firebase:firebase-analytics")
}
LOG Output
E/ThemeUtils(32156): View class android.support.v7.widget.AppCompatTextView is an AppCompat widget that can only be used with a Theme.AppCompat theme (or descendant).
E/ThemeUtils(32156): View class com.google.android.material.imageview.ShapeableImageView is an AppCompat widget that can only be used with a Theme.AppCompat theme (or descendant).
W/ResourcesCompat(32156): Failed to inflate ColorStateList, leaving it to the framework
W/ResourcesCompat(32156): java.lang.UnsupportedOperationException: Failed to resolve attribute at index 0: TypedValue{t=0x2/d=0x7b040084 a=-1}, theme={InheritanceMap=[id=0x7b1100abcom.google.android.gms:style/PayButtonLightTheme], Themes=[com.google.android.gms:style/PayButtonLightTheme, forced, android:style/Theme.DeviceDefault.Light.DarkActionBar, forced]}
W/ResourcesCompat(32156): at android.content.res.TypedArray.getColor(TypedArray.java:529)
W/ResourcesCompat(32156): at m.jf.b(:com.google.android.gms.dynamite_dynamitemodulesc@[email protected] (190800-0):18)
W/ResourcesCompat(32156): at m.jf.a(:com.google.android.gms.dynamite_dynamitemodulesc@[email protected] (190800-0):24)
W/ResourcesCompat(32156): at m.jb.a(:com.google.android.gms.dynamite_dynamitemodulesc@[email protected] (190800-0):126)
W/ResourcesCompat(32156): at com.google.android.material.imageview.ShapeableImageView.(:com.google.android.gms.dynamite_dynamitemodulesc@[email protected] (190800-0):31)
W/ResourcesCompat(32156): at com.google.android.material.imageview.ShapeableImageView.(:com.google.android.gms.dynamite_dynamitemodulesc@[email protected] (190800-0):2)
W/ResourcesCompat(32156): at java.lang.reflect.Constructor.newInstance0(Native Method)
W/ResourcesCompat(32156): at java.lang.reflect.Constructor.newInstance(Constructor.java:343)
W/ResourcesCompat(32156): at android.view.LayoutInflater.createView(LayoutInflater.java:866)
W/ResourcesCompat(32156): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:1018)
W/ResourcesCompat(32156): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:973)
W/ResourcesCompat(32156): at android.view.LayoutInflater.rInflate(LayoutInflater.java:1135)
W/ResourcesCompat(32156): at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:1096)
W/ResourcesCompat(32156): at android.view.LayoutInflater.rInflate(LayoutInflater.java:1138)
W/ResourcesCompat(32156): at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:1096)
W/ResourcesCompat(32156): at android.view.LayoutInflater.rInflate(LayoutInflater.java:1138)
W/ResourcesCompat(32156): at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:1096)
W/ResourcesCompat(32156): at android.view.LayoutInflater.rInflate(LayoutInflater.java:1138)
W/ResourcesCompat(32156): at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:1096)
W/ResourcesCompat(32156): at android.view.LayoutInflater.inflate(LayoutInflater.java:694)
W/ResourcesCompat(32156): at android.view.LayoutInflater.inflate(LayoutInflater.java:538)
W/ResourcesCompat(32156): at m.bdv.d(:com.google.android.gms.dynamite_dynamitemodulesc@[email protected] (190800-0):337)
W/ResourcesCompat(32156): at m.bdv.b(:com.google.android.gms.dynamite_dynamitemodulesc@[email protected] (190800-0):30)
W/ResourcesCompat(32156): at com.google.android.gms.wallet.dynamite.PayButtonCreatorChimeraImpl.newPayButton(:com.google.android.gms.dynamite_dynamitemodulesc@[email protected] (190800-0):51)
W/ResourcesCompat(32156): at m.bdl.z(:com.google.android.gms.dynamite_dynamitemodulesc@[email protected] (190800-0):43)
W/ResourcesCompat(32156): at m.rz.onTransact(:com.google.android.gms.dynamite_dynamitemodulesc@[email protected] (190800-0):21)
W/ResourcesCompat(32156): at android.os.Binder.transact(Binder.java:1183)
W/ResourcesCompat(32156): at com.google.android.gms.internal.wallet.zza.zzb(com.google.android.gms:play-services-wallet@@19.3.0:2)
W/ResourcesCompat(32156): at com.google.android.gms.wallet.button.zze.zzd(com.google.android.gms:play-services-wallet@@19.3.0:4)
W/ResourcesCompat(32156): at com.google.android.gms.wallet.button.zzf.zza(com.google.android.gms:play-services-wallet@@19.3.0:6)
W/ResourcesCompat(32156): at com.google.android.gms.wallet.button.PayButton.initialize(com.google.android.gms:play-services-wallet@@19.3.0:17)
W/ResourcesCompat(32156): at io.flutter.plugins.pay_android.view.PayButtonView.buildPayButton(PayButtonView.kt:61)
W/ResourcesCompat(32156): at io.flutter.plugins.pay_android.view.PayButtonView.(PayButtonView.kt:48)
W/ResourcesCompat(32156): at io.flutter.plugins.pay_android.view.PayButtonViewFactory.create(PayButtonViewFactory.kt:27)
W/ResourcesCompat(32156): at io.flutter.plugin.platform.PlatformViewsController.createPlatformView(PlatformViewsController.java:523)
W/ResourcesCompat(32156): at io.flutter.plugin.platform.PlatformViewsController$1.createForTextureLayer(PlatformViewsController.java:197)
W/ResourcesCompat(32156): at io.flutter.embedding.engine.systemchannels.PlatformViewsChannel$1.create(PlatformViewsChannel.java:128)
W/ResourcesCompat(32156): at io.flutter.embedding.engine.systemchannels.PlatformViewsChannel$1.onMethodCall(PlatformViewsChannel.java:55)
W/ResourcesCompat(32156): at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage(MethodChannel.java:267)
W/ResourcesCompat(32156): at io.flutter.embedding.engine.dart.DartMessenger.invokeHandler(DartMessenger.java:292)
W/ResourcesCompat(32156): at io.flutter.embedding.engine.dart.DartMessenger.lambda$dispatchMessageToQueue$0$io-flutter-embedding-engine-dart-DartMessenger(DartMessenger.java:319)
W/ResourcesCompat(32156): at io.flutter.embedding.engine.dart.DartMessenger$$ExternalSyntheticLambda0.run(Unknown Source:12)
W/ResourcesCompat(32156): at android.os.Handler.handleCallback(Handler.java:958)
W/ResourcesCompat(32156): at android.os.Handler.dispatchMessage(Handler.java:99)
W/ResourcesCompat(32156): at android.os.Looper.loopOnce(Looper.java:205)
W/ResourcesCompat(32156): at android.os.Looper.loop(Looper.java:294)
W/ResourcesCompat(32156): at android.app.ActivityThread.main(ActivityThread.java:8177)
W/ResourcesCompat(32156): at java.lang.reflect.Method.invoke(Native Method)
W/ResourcesCompat(32156): at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:552)
W/ResourcesCompat(32156): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:971)
E/ThemeUtils(32156): View class android.support.v7.widget.AppCompatTextView is an AppCompat widget that can only be used with a Theme.AppCompat theme (or descendant).
E/ThemeUtils(32156): View class android.support.v7.widget.AppCompatTextView is an AppCompat widget that can only be used with a Theme.AppCompat theme (or descendant).
I/PlatformViewsController(32156): Hosting view in view hierarchy for platform view: 0
I/PlatformViewsController(32156): PlatformView is using SurfaceProducer backend
W/ConnectionStatusConfig(32156): Dynamic lookup for intent failed for action: com.google.android.gms.wallet.service.BIND
- Ngôn ngữ chính
- Dart
- Star
- 180
- Fork
- 144
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của google-pay/flutter-plugin
-
Unable to load asset: "packages/pay_platform_interface/pubspec.yaml".Có thể làm lại được Pull request cho issue này đã bị đóng mà không được merge. Đang mở
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 42/100
google-pay/flutter-plugin#331 ·
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 52/100
google-pay/flutter-plugin#323 · 3 bình luận · 1 reaction ·
-
Apple Pay Bottom Sheet – Incorrect Failure Design Handling After Backend Call Using Apple Pay TokenĐang mở
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 25/100
google-pay/flutter-plugin#322 · 1 bình luận ·
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 52/100
google-pay/flutter-plugin#321 · 2 bình luận · 9 reaction ·
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 40/100
google-pay/flutter-plugin#312 · 1 bình luận ·
Tất cả issue của google-pay/flutter-plugin
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 85/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 88/100
CircuitVerse/mobile-app#679 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 74/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 67/100
PhoebeSoftware/xrooster#41 ·
-
enhancement
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 61/100
spotiflacapp/SpotiFLAC-Mobile#687 ·