flutter【13】從框架層面看看flutter的widget

經過前面的一篇文章,flutter 工程創建和組織方面的工作就基本結束了,下一步就可以進行具體的開發。

flutter 作爲一個跨平臺的 ui 工具包,核心理念就是 widget,所以網上的文章也大多是從 widget 入手進行 flutter 講解,但是 flutter 中的 widget 太多了,提供了各種各樣的 widget,在方便開發者的同時也讓人難以從宏觀方面把握 flutter 的 widget 的組織結構。

現在網上的文章雖多,大部分側重於介紹單個 widget 的使用,或者 widget 層級繼承原理等方面,這些固然重要,但是在探討具體 widget 的具體細節之前,如果能從宏觀、框架層面瞭解 flutter 的 組織結構,widget 是怎麼劃分的,以什麼邏輯組織的,在後續的開發工作中,可以更有針對性的選擇合適的 widget ,心中也會有一個 widget 的脈絡圖。

下面還是從初始工程的 main.dart 文件入手,一步一步梳理 flutter 的 widget 組織邏輯。

這裏再放一次 main.dart 代碼吧,方便敘述。

import 'package:flutter/material.dart';

//這是 app 的入口
void main() => runApp(MyApp());

/**
 * flutter 中絕大多數東西都是 widget,主要有兩種,無狀態的(StatelessWidget)、有狀態的(StatefulWidget)
 */
class MyApp extends StatelessWidget {
  // StatelessWidget 主要的就是這個 build 方法,主要用來執行 widget 的構建
  @override
  Widget build(BuildContext context) {
    return MaterialApp(//MateriaApp 是flutter提供的android平臺風格的庫
      title: 'Flutter Demo',
      theme: ThemeData(//可以配置主題
        primarySwatch: Colors.blue,
      ),
      home: MyHomePage(title: 'Flutter Demo Home Page'),
    );
  }
}

// 有狀態的 widget
class MyHomePage extends StatefulWidget {
  MyHomePage({Key key, this.title}) : super(key: key);

  final String title;

  //主要的方法就是 createState() ,用來創建一個 State
  @override
  _MyHomePageState createState() => _MyHomePageState();
}

//這就是和上面 StatefulWidget 綁定的 State
class _MyHomePageState extends State<MyHomePage> {
  int _counter = 0;

  void _incrementCounter() {
    //有狀態的widget,可以使用 setState 方法來更新狀態,然後 widget 樹會根據最新的狀態重新構建
    setState(() {
      _counter++;
    });
  }

  //這是 State 的核心方法,用來執行 widget 的構建
  @override
  Widget build(BuildContext context) {
    return Scaffold(//Scaffold 是android 風格app的一個骨架 widget,裏面可以配置 appbar等
      appBar: AppBar(
        // 這裏的widget就是上面的MyHomePage對象
        title: Text(widget.title),
      ),
      body: Center(//一個單子元素在中間的佈局widget
        child: Column(//豎直佈局widget
          mainAxisAlignment: MainAxisAlignment.center,//主方向的對齊方式
          children: <Widget>[//子元素列表
            Text(
              'You have pushed the button this many times:',
            ),
            Text(
              '$_counter',
              style: Theme.of(context).textTheme.display1,
            ),
          ],
        ),
      ),
      floatingActionButton: FloatingActionButton(
        onPressed: _incrementCounter,
        tooltip: 'Increment',
        child: Icon(Icons.add),
      ), // This trailing comma makes auto-formatting nicer for build methods.
    );
  }
}

上述代碼中使用的 widget 有 MaterialApp、StatelessWidget、StatefulWidget、Scaffold……,開頭的 import 'package:flutter/material.dart'; 這句代碼,會將flutter 的大部分 widget 導入進來進行使用。

AS中 ctrl+鼠標左鍵 點擊 material.dart 就可以定位到 material.dart 文件了,文件的內容這裏貼出來,如下:

library material;

export 'src/material/about.dart';
export 'src/material/animated_icons.dart';
export 'src/material/app.dart';
export 'src/material/app_bar.dart';
export 'src/material/app_bar_theme.dart';
export 'src/material/arc.dart';
export 'src/material/back_button.dart';
export 'src/material/bottom_app_bar.dart';
export 'src/material/bottom_app_bar_theme.dart';
export 'src/material/bottom_navigation_bar.dart';
export 'src/material/bottom_sheet.dart';
export 'src/material/bottom_sheet_theme.dart';
export 'src/material/button.dart';
export 'src/material/button_bar.dart';
export 'src/material/button_theme.dart';
export 'src/material/card.dart';
export 'src/material/card_theme.dart';
export 'src/material/checkbox.dart';
export 'src/material/checkbox_list_tile.dart';
export 'src/material/chip.dart';
export 'src/material/chip_theme.dart';
export 'src/material/circle_avatar.dart';
export 'src/material/color_scheme.dart';
export 'src/material/colors.dart';
export 'src/material/constants.dart';
export 'src/material/data_table.dart';
export 'src/material/data_table_source.dart';
export 'src/material/date_picker.dart';
export 'src/material/debug.dart';
export 'src/material/dialog.dart';
export 'src/material/dialog_theme.dart';
export 'src/material/divider.dart';
export 'src/material/drawer.dart';
export 'src/material/drawer_header.dart';
export 'src/material/dropdown.dart';
export 'src/material/expand_icon.dart';
export 'src/material/expansion_panel.dart';
export 'src/material/expansion_tile.dart';
export 'src/material/feedback.dart';
export 'src/material/flat_button.dart';
export 'src/material/flexible_space_bar.dart';
export 'src/material/floating_action_button.dart';
export 'src/material/floating_action_button_location.dart';
export 'src/material/floating_action_button_theme.dart';
export 'src/material/flutter_logo.dart';
export 'src/material/grid_tile.dart';
export 'src/material/grid_tile_bar.dart';
export 'src/material/icon_button.dart';
export 'src/material/icons.dart';
export 'src/material/ink_decoration.dart';
export 'src/material/ink_highlight.dart';
export 'src/material/ink_ripple.dart';
export 'src/material/ink_splash.dart';
export 'src/material/ink_well.dart';
export 'src/material/input_border.dart';
export 'src/material/input_decorator.dart';
export 'src/material/list_tile.dart';
export 'src/material/material.dart';
export 'src/material/material_button.dart';
export 'src/material/material_localizations.dart';
export 'src/material/material_state.dart';
export 'src/material/mergeable_material.dart';
export 'src/material/outline_button.dart';
export 'src/material/page.dart';
export 'src/material/page_transitions_theme.dart';
export 'src/material/paginated_data_table.dart';
export 'src/material/popup_menu.dart';
export 'src/material/progress_indicator.dart';
export 'src/material/radio.dart';
export 'src/material/radio_list_tile.dart';
export 'src/material/raised_button.dart';
export 'src/material/range_slider.dart';
export 'src/material/refresh_indicator.dart';
export 'src/material/reorderable_list.dart';
export 'src/material/scaffold.dart';
export 'src/material/scrollbar.dart';
export 'src/material/search.dart';
export 'src/material/shadows.dart';
export 'src/material/slider.dart';
export 'src/material/slider_theme.dart';
export 'src/material/snack_bar.dart';
export 'src/material/snack_bar_theme.dart';
export 'src/material/stepper.dart';
export 'src/material/switch.dart';
export 'src/material/switch_list_tile.dart';
export 'src/material/tab_bar_theme.dart';
export 'src/material/tab_controller.dart';
export 'src/material/tab_indicator.dart';
export 'src/material/tabs.dart';
export 'src/material/text_field.dart';
export 'src/material/text_form_field.dart';
export 'src/material/text_selection.dart';
export 'src/material/text_theme.dart';
export 'src/material/theme.dart';
export 'src/material/theme_data.dart';
export 'src/material/time.dart';
export 'src/material/time_picker.dart';
export 'src/material/toggleable.dart';
export 'src/material/tooltip.dart';
export 'src/material/typography.dart';
export 'src/material/user_accounts_drawer_header.dart';
export 'widgets.dart';

可以看到這個文件中僅僅是聲明導入了一些包,並沒有具體的實現,需要注意的是前面都是 src/material 開頭的路徑,很顯然,material.dart 文件名字相對應,而最後一個是 widgets.dart,這是爲什麼呢?

其實你用文件資源管理器打開 material.dart 所在的位置就明白了,具體路徑在 flutter\packages\flutter\lib , 該文件夾的全部的文件及子文件夾中的文件在文章的最後會附上。

該目錄下有 12 個 dart 文件,內容都和 material.dart 的內容類似,都是使用 export 自動導入了一些包。這些包的具體實現都在 src 目錄中,src 的字目錄名字和 12 個 dart 文件的名字一致。

需要注意的是這 12 個 dart 文件以及 src 目錄中具體實現的 widget dart 文件並不是孤立的,而是相互之間引用的,就如同上面 material.dart 文件中最後一行引用了 widget.dart。也就是說整個 flutter 按照功能或者能力分爲 12 個大的模塊,模塊內部具體的實現根據需要的能力會引用其他模塊。

  • animation.dart:動畫模塊
  • cupertino.dart:ios design 風格模塊
  • foundation.dart:底層工具模塊
  • gesture.dart:手勢識別模塊
  • material.dart:android material design 風格模塊
  • painting.dart:flutter 繪製引擎模塊,包含各種繪製 api,比如縮放圖片、陰影插值,繪製邊框等等
  • physics.dart:簡單一維物理模擬模塊,比如彈簧、摩擦、重力等,用於用戶界面動畫
  • rendering.dart:flutter RenderObjuect 渲染樹模塊,提供給 wieget 模塊使用,實現其後端的佈局和繪製
  • scheduler.dart:調度模塊,負責程序框架回調以及特定優先級任務的調度
  • semantics.dart:語意模塊,SemanticsEvent 類定義了平臺的語意事件的發送協議,SemanticsNode層級表示了UI的語意結構,用於特定平臺的加速服務
  • services.dart:平臺能力服務,整個模塊只引用了 core dart 庫以及 foundation模塊
  • widgets.dart:flutter 的 widgets 框架

從上面可以看出來,flutter 的基礎 widgets 都在 widgets.dart 文件中導入了,具體的實現在 src/widgets/ 目錄中。

  widgets
            actions.dart
            animated_cross_fade.dart
            animated_list.dart
            animated_size.dart
            animated_switcher.dart
            annotated_region.dart
            app.dart
            async.dart
            automatic_keep_alive.dart
            banner.dart
            basic.dart
            binding.dart
            bottom_navigation_bar_item.dart
            container.dart
            debug.dart
            dismissible.dart
            draggable_scrollable_sheet.dart
            drag_target.dart
            editable_text.dart
            fade_in_image.dart
            focus_manager.dart
            focus_scope.dart
            focus_traversal.dart
            form.dart
            framework.dart
            gesture_detector.dart
            grid_paper.dart
            heroes.dart
            icon.dart
            icon_data.dart
            icon_theme.dart
            icon_theme_data.dart
            image.dart
            image_icon.dart
            implicit_animations.dart
            inherited_model.dart
            inherited_notifier.dart
            layout_builder.dart
            list_wheel_scroll_view.dart
            localizations.dart
            media_query.dart
            modal_barrier.dart
            navigation_toolbar.dart
            navigator.dart
            nested_scroll_view.dart
            notification_listener.dart
            orientation_builder.dart
            overlay.dart
            overscroll_indicator.dart
            pages.dart
            page_storage.dart
            page_view.dart
            performance_overlay.dart
            placeholder.dart
            platform_view.dart
            preferred_size.dart
            primary_scroll_controller.dart
            raw_keyboard_listener.dart
            routes.dart
            safe_area.dart
            scrollable.dart
            scrollbar.dart
            scroll_activity.dart
            scroll_configuration.dart
            scroll_context.dart
            scroll_controller.dart
            scroll_metrics.dart
            scroll_notification.dart
            scroll_physics.dart
            scroll_position.dart
            scroll_position_with_single_context.dart
            scroll_simulation.dart
            scroll_view.dart
            semantics_debugger.dart
            shortcuts.dart
            single_child_scroll_view.dart
            size_changed_layout_notifier.dart
            sliver.dart
            sliver_persistent_header.dart
            sliver_prototype_extent_list.dart
            spacer.dart
            status_transitions.dart
            table.dart
            text.dart
            texture.dart
            text_selection.dart
            ticker_provider.dart
            title.dart
            transitions.dart
            unique_widget.dart
            value_listenable_builder.dart
            viewport.dart
            visibility.dart
            widget_inspector.dart
            widget_span.dart
            will_pop_scope.dart

另外對應android平臺下的 material 風格的 widget 是在 material.dart 模塊中,該模塊實在 widgets.dart 的基礎上,實現並補充了一些 android md 風格的 widget,具體的實現都在 src/materal/ 目錄下,具體的文件如下:

   ├─material
    │  │  about.dart
    │  │  animated_icons.dart
    │  │  app.dart
    │  │  app_bar.dart
    │  │  app_bar_theme.dart
    │  │  arc.dart
    │  │  back_button.dart
    │  │  bottom_app_bar.dart
    │  │  bottom_app_bar_theme.dart
    │  │  bottom_navigation_bar.dart
    │  │  bottom_sheet.dart
    │  │  bottom_sheet_theme.dart
    │  │  button.dart
    │  │  button_bar.dart
    │  │  button_theme.dart
    │  │  card.dart
    │  │  card_theme.dart
    │  │  checkbox.dart
    │  │  checkbox_list_tile.dart
    │  │  chip.dart
    │  │  chip_theme.dart
    │  │  circle_avatar.dart
    │  │  colors.dart
    │  │  color_scheme.dart
    │  │  constants.dart
    │  │  data_table.dart
    │  │  data_table_source.dart
    │  │  date_picker.dart
    │  │  debug.dart
    │  │  dialog.dart
    │  │  dialog_theme.dart
    │  │  divider.dart
    │  │  drawer.dart
    │  │  drawer_header.dart
    │  │  dropdown.dart
    │  │  expand_icon.dart
    │  │  expansion_panel.dart
    │  │  expansion_tile.dart
    │  │  feedback.dart
    │  │  flat_button.dart
    │  │  flexible_space_bar.dart
    │  │  floating_action_button.dart
    │  │  floating_action_button_location.dart
    │  │  floating_action_button_theme.dart
    │  │  flutter_logo.dart
    │  │  grid_tile.dart
    │  │  grid_tile_bar.dart
    │  │  icons.dart
    │  │  icon_button.dart
    │  │  ink_decoration.dart
    │  │  ink_highlight.dart
    │  │  ink_ripple.dart
    │  │  ink_splash.dart
    │  │  ink_well.dart
    │  │  input_border.dart
    │  │  input_decorator.dart
    │  │  list_tile.dart
    │  │  material.dart
    │  │  material_button.dart
    │  │  material_localizations.dart
    │  │  material_state.dart
    │  │  mergeable_material.dart
    │  │  outline_button.dart
    │  │  page.dart
    │  │  page_transitions_theme.dart
    │  │  paginated_data_table.dart
    │  │  popup_menu.dart
    │  │  progress_indicator.dart
    │  │  radio.dart
    │  │  radio_list_tile.dart
    │  │  raised_button.dart
    │  │  range_slider.dart
    │  │  refresh_indicator.dart
    │  │  reorderable_list.dart
    │  │  scaffold.dart
    │  │  scrollbar.dart
    │  │  search.dart
    │  │  shadows.dart
    │  │  slider.dart
    │  │  slider_theme.dart
    │  │  snack_bar.dart
    │  │  snack_bar_theme.dart
    │  │  stepper.dart
    │  │  switch.dart
    │  │  switch_list_tile.dart
    │  │  tabs.dart
    │  │  tab_bar_theme.dart
    │  │  tab_controller.dart
    │  │  tab_indicator.dart
    │  │  text_field.dart
    │  │  text_form_field.dart
    │  │  text_selection.dart
    │  │  text_theme.dart
    │  │  theme.dart
    │  │  theme_data.dart
    │  │  time.dart
    │  │  time_picker.dart
    │  │  toggleable.dart
    │  │  tooltip.dart
    │  │  typography.dart
    │  │  user_accounts_drawer_header.dart
    │  │  
    │  └─animated_icons
    │      │  animated_icons.dart
    │      │  animated_icons_data.dart
    │      │  
    │      └─data
    │              add_event.g.dart
    │              arrow_menu.g.dart
    │              close_menu.g.dart
    │              ellipsis_search.g.dart
    │              event_add.g.dart
    │              home_menu.g.dart
    │              list_view.g.dart
    │              menu_arrow.g.dart
    │              menu_close.g.dart
    │              menu_home.g.dart
    │              pause_play.g.dart
    │              play_pause.g.dart
    │              search_ellipsis.g.dart
    │              view_list.g.dart

另外 ios 平臺的 widget 在 cupertino.dart 模塊中,對應的目錄爲 src/cupertino。這裏就不再列舉了。

src/widgets、src/material 目錄中的文件,每一個文件對應這一個/多個/一類 widget。也就是說後面我們開發的過程中,可以在該目錄下尋找需要的 widget,同時平時瀏覽下該目錄下文件的內容,看看都有哪些 widget,提前有個印象。

到這裏 main.dart 中用到的那些 widget 你就可以 ctrl+鼠標左鍵 點進去看看了,像 StatelessWidget、StatefulWidget 這種基礎 widget 是在 widgets.dart 模塊中,而 MaterialApp 這種和android平臺相關的 widget 是在 material.dart 模塊中。

本文從框架的角度,分析了 flutter 的模塊組織,描述了 widget 的劃分和組織邏輯,從宏觀上有一個印象,爲後續講解具體 widget 用法做鋪墊,免得在大量 widget 中迷失自我。

最後附上 flutter\packages\flutter\lib 路徑下所有的文件和文件夾以及子文件夾中的內容。

│  analysis_options_user.yaml
│  animation.dart
│  cupertino.dart
│  foundation.dart
│  gestures.dart
│  material.dart
│  painting.dart
│  physics.dart
│  rendering.dart
│  scheduler.dart
│  semantics.dart
│  services.dart
│  widgets.dart
│  
└─src
    ├─animation
    │      animation.dart
    │      animations.dart
    │      animation_controller.dart
    │      curves.dart
    │      listener_helpers.dart
    │      tween.dart
    │      tween_sequence.dart
    │      
    ├─cupertino
    │      action_sheet.dart
    │      activity_indicator.dart
    │      app.dart
    │      bottom_tab_bar.dart
    │      button.dart
    │      colors.dart
    │      date_picker.dart
    │      dialog.dart
    │      icons.dart
    │      localizations.dart
    │      nav_bar.dart
    │      page_scaffold.dart
    │      picker.dart
    │      refresh.dart
    │      route.dart
    │      scrollbar.dart
    │      segmented_control.dart
    │      slider.dart
    │      switch.dart
    │      tab_scaffold.dart
    │      tab_view.dart
    │      text_field.dart
    │      text_selection.dart
    │      text_theme.dart
    │      theme.dart
    │      thumb_painter.dart
    │      
    ├─foundation
    │      annotations.dart
    │      assertions.dart
    │      basic_types.dart
    │      binding.dart
    │      bitfield.dart
    │      change_notifier.dart
    │      collections.dart
    │      consolidate_response.dart
    │      constants.dart
    │      debug.dart
    │      diagnostics.dart
    │      isolates.dart
    │      key.dart
    │      licenses.dart
    │      node.dart
    │      observer_list.dart
    │      platform.dart
    │      print.dart
    │      profile.dart
    │      README.md
    │      serialization.dart
    │      synchronous_future.dart
    │      unicode.dart
    │      _bitfield_io.dart
    │      _bitfield_web.dart
    │      _isolates_io.dart
    │      _isolates_web.dart
    │      _platform_io.dart
    │      _platform_web.dart
    │      
    ├─gestures
    │      arena.dart
    │      binding.dart
    │      constants.dart
    │      converter.dart
    │      debug.dart
    │      drag.dart
    │      drag_details.dart
    │      eager.dart
    │      events.dart
    │      force_press.dart
    │      hit_test.dart
    │      long_press.dart
    │      lsq_solver.dart
    │      monodrag.dart
    │      mouse_tracking.dart
    │      multidrag.dart
    │      multitap.dart
    │      pointer_router.dart
    │      pointer_signal_resolver.dart
    │      recognizer.dart
    │      scale.dart
    │      tap.dart
    │      team.dart
    │      velocity_tracker.dart
    │      
    ├─material
    │  │  about.dart
    │  │  animated_icons.dart
    │  │  app.dart
    │  │  app_bar.dart
    │  │  app_bar_theme.dart
    │  │  arc.dart
    │  │  back_button.dart
    │  │  bottom_app_bar.dart
    │  │  bottom_app_bar_theme.dart
    │  │  bottom_navigation_bar.dart
    │  │  bottom_sheet.dart
    │  │  bottom_sheet_theme.dart
    │  │  button.dart
    │  │  button_bar.dart
    │  │  button_theme.dart
    │  │  card.dart
    │  │  card_theme.dart
    │  │  checkbox.dart
    │  │  checkbox_list_tile.dart
    │  │  chip.dart
    │  │  chip_theme.dart
    │  │  circle_avatar.dart
    │  │  colors.dart
    │  │  color_scheme.dart
    │  │  constants.dart
    │  │  data_table.dart
    │  │  data_table_source.dart
    │  │  date_picker.dart
    │  │  debug.dart
    │  │  dialog.dart
    │  │  dialog_theme.dart
    │  │  divider.dart
    │  │  drawer.dart
    │  │  drawer_header.dart
    │  │  dropdown.dart
    │  │  expand_icon.dart
    │  │  expansion_panel.dart
    │  │  expansion_tile.dart
    │  │  feedback.dart
    │  │  flat_button.dart
    │  │  flexible_space_bar.dart
    │  │  floating_action_button.dart
    │  │  floating_action_button_location.dart
    │  │  floating_action_button_theme.dart
    │  │  flutter_logo.dart
    │  │  grid_tile.dart
    │  │  grid_tile_bar.dart
    │  │  icons.dart
    │  │  icon_button.dart
    │  │  ink_decoration.dart
    │  │  ink_highlight.dart
    │  │  ink_ripple.dart
    │  │  ink_splash.dart
    │  │  ink_well.dart
    │  │  input_border.dart
    │  │  input_decorator.dart
    │  │  list_tile.dart
    │  │  material.dart
    │  │  material_button.dart
    │  │  material_localizations.dart
    │  │  material_state.dart
    │  │  mergeable_material.dart
    │  │  outline_button.dart
    │  │  page.dart
    │  │  page_transitions_theme.dart
    │  │  paginated_data_table.dart
    │  │  popup_menu.dart
    │  │  progress_indicator.dart
    │  │  radio.dart
    │  │  radio_list_tile.dart
    │  │  raised_button.dart
    │  │  range_slider.dart
    │  │  refresh_indicator.dart
    │  │  reorderable_list.dart
    │  │  scaffold.dart
    │  │  scrollbar.dart
    │  │  search.dart
    │  │  shadows.dart
    │  │  slider.dart
    │  │  slider_theme.dart
    │  │  snack_bar.dart
    │  │  snack_bar_theme.dart
    │  │  stepper.dart
    │  │  switch.dart
    │  │  switch_list_tile.dart
    │  │  tabs.dart
    │  │  tab_bar_theme.dart
    │  │  tab_controller.dart
    │  │  tab_indicator.dart
    │  │  text_field.dart
    │  │  text_form_field.dart
    │  │  text_selection.dart
    │  │  text_theme.dart
    │  │  theme.dart
    │  │  theme_data.dart
    │  │  time.dart
    │  │  time_picker.dart
    │  │  toggleable.dart
    │  │  tooltip.dart
    │  │  typography.dart
    │  │  user_accounts_drawer_header.dart
    │  │  
    │  └─animated_icons
    │      │  animated_icons.dart
    │      │  animated_icons_data.dart
    │      │  
    │      └─data
    │              add_event.g.dart
    │              arrow_menu.g.dart
    │              close_menu.g.dart
    │              ellipsis_search.g.dart
    │              event_add.g.dart
    │              home_menu.g.dart
    │              list_view.g.dart
    │              menu_arrow.g.dart
    │              menu_close.g.dart
    │              menu_home.g.dart
    │              pause_play.g.dart
    │              play_pause.g.dart
    │              search_ellipsis.g.dart
    │              view_list.g.dart
    │              
    ├─painting
    │      alignment.dart
    │      basic_types.dart
    │      beveled_rectangle_border.dart
    │      binding.dart
    │      borders.dart
    │      border_radius.dart
    │      box_border.dart
    │      box_decoration.dart
    │      box_fit.dart
    │      box_shadow.dart
    │      circle_border.dart
    │      clip.dart
    │      colors.dart
    │      continuous_rectangle_border.dart
    │      debug.dart
    │      decoration.dart
    │      decoration_image.dart
    │      edge_insets.dart
    │      flutter_logo.dart
    │      fractional_offset.dart
    │      geometry.dart
    │      gradient.dart
    │      image_cache.dart
    │      image_decoder.dart
    │      image_provider.dart
    │      image_resolution.dart
    │      image_stream.dart
    │      inline_span.dart
    │      matrix_utils.dart
    │      notched_shapes.dart
    │      paint_utilities.dart
    │      placeholder_span.dart
    │      rounded_rectangle_border.dart
    │      shader_warm_up.dart
    │      shape_decoration.dart
    │      stadium_border.dart
    │      strut_style.dart
    │      text_painter.dart
    │      text_span.dart
    │      text_style.dart
    │      _network_image_io.dart
    │      _network_image_web.dart
    │      
    ├─physics
    │      clamped_simulation.dart
    │      friction_simulation.dart
    │      gravity_simulation.dart
    │      simulation.dart
    │      spring_simulation.dart
    │      tolerance.dart
    │      utils.dart
    │      
    ├─rendering
    │      animated_size.dart
    │      binding.dart
    │      box.dart
    │      custom_layout.dart
    │      custom_paint.dart
    │      debug.dart
    │      debug_overflow_indicator.dart
    │      editable.dart
    │      error.dart
    │      flex.dart
    │      flow.dart
    │      image.dart
    │      layer.dart
    │      list_body.dart
    │      list_wheel_viewport.dart
    │      object.dart
    │      paragraph.dart
    │      performance_overlay.dart
    │      platform_view.dart
    │      proxy_box.dart
    │      rotated_box.dart
    │      shifted_box.dart
    │      sliver.dart
    │      sliver_fill.dart
    │      sliver_fixed_extent_list.dart
    │      sliver_grid.dart
    │      sliver_list.dart
    │      sliver_multi_box_adaptor.dart
    │      sliver_padding.dart
    │      sliver_persistent_header.dart
    │      stack.dart
    │      table.dart
    │      table_border.dart
    │      texture.dart
    │      tweens.dart
    │      view.dart
    │      viewport.dart
    │      viewport_offset.dart
    │      wrap.dart
    │      
    ├─scheduler
    │      binding.dart
    │      debug.dart
    │      priority.dart
    │      ticker.dart
    │      
    ├─semantics
    │      binding.dart
    │      debug.dart
    │      semantics.dart
    │      semantics_event.dart
    │      semantics_service.dart
    │      
    ├─services
    │      asset_bundle.dart
    │      binary_messenger.dart
    │      binding.dart
    │      clipboard.dart
    │      font_loader.dart
    │      haptic_feedback.dart
    │      keyboard_key.dart
    │      keyboard_maps.dart
    │      message_codec.dart
    │      message_codecs.dart
    │      platform_channel.dart
    │      platform_messages.dart
    │      platform_views.dart
    │      raw_keyboard.dart
    │      raw_keyboard_android.dart
    │      raw_keyboard_fuchsia.dart
    │      raw_keyboard_linux.dart
    │      raw_keyboard_macos.dart
    │      system_channels.dart
    │      system_chrome.dart
    │      system_navigator.dart
    │      system_sound.dart
    │      text_editing.dart
    │      text_formatter.dart
    │      text_input.dart
    │      
    └─widgets
            actions.dart
            animated_cross_fade.dart
            animated_list.dart
            animated_size.dart
            animated_switcher.dart
            annotated_region.dart
            app.dart
            async.dart
            automatic_keep_alive.dart
            banner.dart
            basic.dart
            binding.dart
            bottom_navigation_bar_item.dart
            container.dart
            debug.dart
            dismissible.dart
            draggable_scrollable_sheet.dart
            drag_target.dart
            editable_text.dart
            fade_in_image.dart
            focus_manager.dart
            focus_scope.dart
            focus_traversal.dart
            form.dart
            framework.dart
            gesture_detector.dart
            grid_paper.dart
            heroes.dart
            icon.dart
            icon_data.dart
            icon_theme.dart
            icon_theme_data.dart
            image.dart
            image_icon.dart
            implicit_animations.dart
            inherited_model.dart
            inherited_notifier.dart
            layout_builder.dart
            list_wheel_scroll_view.dart
            localizations.dart
            media_query.dart
            modal_barrier.dart
            navigation_toolbar.dart
            navigator.dart
            nested_scroll_view.dart
            notification_listener.dart
            orientation_builder.dart
            overlay.dart
            overscroll_indicator.dart
            pages.dart
            page_storage.dart
            page_view.dart
            performance_overlay.dart
            placeholder.dart
            platform_view.dart
            preferred_size.dart
            primary_scroll_controller.dart
            raw_keyboard_listener.dart
            routes.dart
            safe_area.dart
            scrollable.dart
            scrollbar.dart
            scroll_activity.dart
            scroll_configuration.dart
            scroll_context.dart
            scroll_controller.dart
            scroll_metrics.dart
            scroll_notification.dart
            scroll_physics.dart
            scroll_position.dart
            scroll_position_with_single_context.dart
            scroll_simulation.dart
            scroll_view.dart
            semantics_debugger.dart
            shortcuts.dart
            single_child_scroll_view.dart
            size_changed_layout_notifier.dart
            sliver.dart
            sliver_persistent_header.dart
            sliver_prototype_extent_list.dart
            spacer.dart
            status_transitions.dart
            table.dart
            text.dart
            texture.dart
            text_selection.dart
            ticker_provider.dart
            title.dart
            transitions.dart
            unique_widget.dart
            value_listenable_builder.dart
            viewport.dart
            visibility.dart
            widget_inspector.dart
            widget_span.dart
            will_pop_scope.dart
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章