flutterとswiftでのhomewidget作成
@available(iOS 14.0, *)
struct WidgetEntryView: View {
var entry: Provider.Entry
var body: some View {
if #available(iOS 17.0, *) {
Text(entry.summaryContent)
.padding()
.containerBackground(for: .widget)
} else {
Text(entry.summaryContent)
.padding()
}
}
}
これを以下のように修正
@available(iOS 14.0, *)
struct WidgetEntryView: View {
var entry: Provider.Entry
var body: some View {
if #available(iOS 17.0, *) {
Text(entry.summaryContent)
.padding()
.containerBackground(.regularMaterial, for: .widget) // 修正箇所
} else {
Text(entry.summaryContent)
.padding()
}
}
}