Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Adding App Widget with Flutter - Part 2 (iOS)

Adding App Widget with Flutter - Part 2 (iOS)

This is a slide on potatotips 78.
「Adding App Widget with Flutter - Part 2 (iOS)」
#potatotips #flutterjp #flutter #iosjp

- See also:
Adding App Widget with Flutter - Part 1 (Android)
https://speakerdeck.com/korodroid/adding-app-widget-with-flutter-part-1-android

Kenichi Kambara

June 22, 2022
Tweet

More Decks by Kenichi Kambara

Other Decks in Technology

Transcript

  1.  About me •Mobile App Development •Speeches (e.g. 9 International

    confs.) •Writings (e.g. 6 Dev Books) •[Of fi cial] Evangelist at NTT TechnoCross •[Private] iplatform.org ਆݪ ݈Ұ (@korodroid)
  2. Approach  •Native [iOS] 1. Create a Widget Extension 2.

    Con fi gure App Groups 3. Implement a Widget Extension •Flutter 4. Implement Dart code
  3. 2. Con fi gure App Groups  On Xcode: Signing

    & Capabilities->TARGETS->[App]
  4. 2. Con fi gure App Groups  On Xcode: Signing

    & Capabilities->TARGETS->[Extension]
  5. 2. Con fi gure App Groups  On Xcode: Signing

    & Capabilities->TARGETS->[Extension]
  6. 3. Implement a Widget Extension (1/2)  <ios_src>/<Extension>/: SampleWidget.swift import

    WidgetKit import SwiftUI struct SampleWidgetEntryView : View { var entry: Provider.Entry var body: some View { HStack { Image("charactor").resizable() .frame(width: 48.0, height: 48.0).padding() VStack { Text(entry.srcText).padding() Text(entry.dstText).bold().padding() } }.frame(maxWidth: .infinity, maxHeight: .infinity ).background(Color(red: 255/255, green: 235/255, 
 blue: 59/255, opacity: 1.0)) } }
  7. 3. Implement a Widget Extension (2/2)  @main struct SampleWidget:

    Widget { let kind: String = "SampleWidget" var body: some WidgetConfiguration { StaticConfiguration(kind: kind, provider: Provider()) { entry in SampleWidgetEntryView(entry: entry) } .configurationDisplayName("Sekaiphone Widget") .description("Shows recent sentences.") .supportedFamilies([.systemMedium, .systemLarge]) } } Supported Widget Size <ios_src>/<Extension>/: SampleWidget.swift
  8.  Reference •Adding App Widget with Flutter - Part 1

    (Android) 
 https://speakerdeck.com/korodroid/adding-app-widget-with- fl utter-part-1-android
  9. Please let me know if you have any requests 


    such as technical speeches, technical writings and so on. Facebook:https://fb.com/kanbara.kenichi Twitter:@korodroid LinkedIn:https://www.linkedin.com/in/korodroid Thank you so much