diff --git a/android/app/bin/src/main/AndroidManifest.xml b/android/app/bin/src/main/AndroidManifest.xml index c9c0310c..d7921ff6 100644 --- a/android/app/bin/src/main/AndroidManifest.xml +++ b/android/app/bin/src/main/AndroidManifest.xml @@ -14,7 +14,7 @@ FlutterApplication and put your custom class here. --> CFBundleInfoDictionaryVersion 6.0 CFBundleName - flutter_rookie_book + flutter_go CFBundlePackageType APPL CFBundleShortVersionString diff --git a/lib/common/eventBus.dart b/lib/common/event_bus.dart similarity index 100% rename from lib/common/eventBus.dart rename to lib/common/event_bus.dart diff --git a/lib/common/iconNames.dart b/lib/common/icon_names.dart similarity index 99% rename from lib/common/iconNames.dart rename to lib/common/icon_names.dart index e8ce0e71..7d75b841 100644 --- a/lib/common/iconNames.dart +++ b/lib/common/icon_names.dart @@ -10,5 +10,5 @@ import 'package:flutter/material.dart'; class IconNames { - static List Names = [Icons.ac_unit,Icons.access_alarm,Icons.access_alarms,Icons.access_time,Icons.accessibility,Icons.accessibility_new,Icons.accessible,Icons.accessible_forward,Icons.account_balance,Icons.account_balance_wallet,Icons.account_box,Icons.account_circle,Icons.adb,Icons.add,Icons.add_a_photo,Icons.add_alarm,Icons.add_alert,Icons.add_box,Icons.add_call,Icons.add_circle,Icons.add_circle_outline,Icons.add_comment,Icons.add_location,Icons.add_photo_alternate,Icons.add_shopping_cart,Icons.add_to_home_screen,Icons.add_to_photos,Icons.add_to_queue,Icons.adjust,Icons.airline_seat_flat,Icons.airline_seat_flat_angled,Icons.airline_seat_individual_suite,Icons.airline_seat_legroom_extra,Icons.airline_seat_legroom_normal,Icons.airline_seat_legroom_reduced,Icons.airline_seat_recline_extra,Icons.airline_seat_recline_normal,Icons.airplanemode_active,Icons.airplanemode_inactive,Icons.airplay,Icons.airport_shuttle,Icons.alarm,Icons.alarm_add,Icons.alarm_off,Icons.alarm_on,Icons.album,Icons.all_inclusive,Icons.all_out,Icons.alternate_email,Icons.android,Icons.announcement,Icons.apps,Icons.archive,Icons.arrow_back,Icons.arrow_back_ios,Icons.arrow_downward,Icons.arrow_drop_down,Icons.arrow_drop_down_circle,Icons.arrow_drop_up,Icons.arrow_forward,Icons.arrow_forward_ios,Icons.arrow_left,Icons.arrow_right,Icons.arrow_upward,Icons.art_track,Icons.aspect_ratio,Icons.assessment,Icons.assignment,Icons.assignment_ind,Icons.assignment_late,Icons.assignment_return,Icons.assignment_returned,Icons.assignment_turned_in,Icons.assistant,Icons.assistant_photo,Icons.atm,Icons.attach_file,Icons.attach_money,Icons.attachment,Icons.audiotrack,Icons.autorenew,Icons.av_timer,Icons.backspace,Icons.backup,Icons.battery_alert,Icons.battery_charging_full,Icons.battery_full,Icons.battery_std,Icons.battery_unknown,Icons.beach_access,Icons.beenhere,Icons.block,Icons.bluetooth,Icons.bluetooth_audio,Icons.bluetooth_connected,Icons.bluetooth_disabled,Icons.bluetooth_searching,Icons.blur_circular,Icons.blur_linear,Icons.blur_off,Icons.blur_on,Icons.book,Icons.bookmark,Icons.bookmark_border,Icons.border_all,Icons.border_bottom,Icons.border_clear,Icons.border_color,Icons.border_horizontal,Icons.border_inner,Icons.border_left,Icons.border_outer,Icons.border_right,Icons.border_style,Icons.border_top,Icons.border_vertical,Icons.branding_watermark,Icons.brightness_1,Icons.brightness_2,Icons.brightness_3,Icons.brightness_4,Icons.brightness_5,Icons.brightness_6,Icons.brightness_7,Icons.brightness_auto,Icons.brightness_high,Icons.brightness_low,Icons.brightness_medium,Icons.broken_image,Icons.brush,Icons.bubble_chart,Icons.bug_report,Icons.build,Icons.burst_mode,Icons.business,Icons.business_center,Icons.cached,Icons.cake,Icons.calendar_today,Icons.calendar_view_day,Icons.call,Icons.call_end,Icons.call_made,Icons.call_merge,Icons.call_missed,Icons.call_missed_outgoing,Icons.call_received,Icons.call_split,Icons.call_to_action,Icons.camera,Icons.camera_alt,Icons.camera_enhance,Icons.camera_front,Icons.camera_rear,Icons.camera_roll,Icons.cancel,Icons.card_giftcard,Icons.card_membership,Icons.card_travel,Icons.casino,Icons.cast,Icons.cast_connected,Icons.category,Icons.center_focus_strong,Icons.center_focus_weak,Icons.change_history,Icons.chat,Icons.chat_bubble,Icons.chat_bubble_outline,Icons.check,Icons.check_box,Icons.check_box_outline_blank,Icons.check_circle,Icons.check_circle_outline,Icons.chevron_left,Icons.chevron_right,Icons.child_care,Icons.child_friendly,Icons.chrome_reader_mode,Icons.class_,Icons.clear,Icons.clear_all,Icons.close,Icons.closed_caption,Icons.cloud,Icons.cloud_circle,Icons.cloud_done,Icons.cloud_download,Icons.cloud_off,Icons.cloud_queue,Icons.cloud_upload,Icons.code,Icons.collections,Icons.collections_bookmark,Icons.color_lens,Icons.colorize,Icons.comment,Icons.compare,Icons.compare_arrows,Icons.computer,Icons.confirmation_number,Icons.contact_mail,Icons.contact_phone,Icons.contacts,Icons.content_copy,Icons.content_cut,Icons.content_paste,Icons.control_point,Icons.control_point_duplicate,Icons.copyright,Icons.create,Icons.create_new_folder,Icons.credit_card,Icons.crop,Icons.crop_3_2,Icons.crop_5_4,Icons.crop_7_5,Icons.crop_16_9,Icons.crop_din,Icons.crop_free,Icons.crop_landscape,Icons.crop_original,Icons.crop_portrait,Icons.crop_rotate,Icons.crop_square,Icons.dashboard,Icons.data_usage,Icons.date_range,Icons.dehaze,Icons.delete,Icons.delete_forever,Icons.delete_outline,Icons.delete_sweep,Icons.departure_board,Icons.description,Icons.desktop_mac,Icons.desktop_windows,Icons.details,Icons.developer_board,Icons.developer_mode,Icons.device_hub,Icons.device_unknown,Icons.devices,Icons.devices_other,Icons.dialer_sip,Icons.dialpad,Icons.directions,Icons.directions_bike,Icons.directions_boat,Icons.directions_bus,Icons.directions_car,Icons.directions_railway,Icons.directions_run,Icons.directions_subway,Icons.directions_transit,Icons.directions_walk,Icons.disc_full,Icons.dns,Icons.do_not_disturb,Icons.do_not_disturb_alt,Icons.do_not_disturb_off,Icons.do_not_disturb_on,Icons.dock,Icons.domain,Icons.done,Icons.done_all,Icons.done_outline,Icons.donut_large,Icons.donut_small,Icons.drafts,Icons.drag_handle,Icons.drive_eta,Icons.dvr,Icons.edit,Icons.edit_attributes,Icons.edit_location,Icons.eject,Icons.email,Icons.enhanced_encryption,Icons.equalizer,Icons.error,Icons.error_outline,Icons.euro_symbol,Icons.ev_station,Icons.event,Icons.event_available,Icons.event_busy,Icons.event_note,Icons.event_seat,Icons.exit_to_app,Icons.expand_less,Icons.expand_more,Icons.explicit,Icons.explore,Icons.exposure,Icons.exposure_neg_1,Icons.exposure_neg_2,Icons.exposure_plus_1,Icons.exposure_plus_2,Icons.exposure_zero,Icons.extension,Icons.face,Icons.fast_forward,Icons.fast_rewind,Icons.fastfood,Icons.favorite,Icons.favorite_border,Icons.featured_play_list,Icons.featured_video,Icons.feedback,Icons.fiber_dvr,Icons.fiber_manual_record,Icons.fiber_new,Icons.fiber_pin,Icons.fiber_smart_record,Icons.file_download,Icons.file_upload,Icons.filter,Icons.filter_1,Icons.filter_2,Icons.filter_3,Icons.filter_4,Icons.filter_5,Icons.filter_6,Icons.filter_7,Icons.filter_8,Icons.filter_9,Icons.filter_9_plus,Icons.filter_b_and_w,Icons.filter_center_focus,Icons.filter_drama,Icons.filter_frames,Icons.filter_hdr,Icons.filter_list,Icons.filter_none,Icons.filter_tilt_shift,Icons.filter_vintage,Icons.find_in_page,Icons.find_replace,Icons.fingerprint,Icons.first_page,Icons.fitness_center,Icons.flag,Icons.flare,Icons.flash_auto,Icons.flash_off,Icons.flash_on,Icons.flight,Icons.flight_land,Icons.flight_takeoff,Icons.flip,Icons.flip_to_back,Icons.flip_to_front,Icons.folder,Icons.folder_open,Icons.folder_shared,Icons.folder_special,Icons.font_download,Icons.format_align_center,Icons.format_align_justify,Icons.format_align_left,Icons.format_align_right,Icons.format_bold,Icons.format_clear,Icons.format_color_fill,Icons.format_color_reset,Icons.format_color_text,Icons.format_indent_decrease,Icons.format_indent_increase,Icons.format_italic,Icons.format_line_spacing,Icons.format_list_bulleted,Icons.format_list_numbered,Icons.format_list_numbered_rtl,Icons.format_paint,Icons.format_quote,Icons.format_shapes,Icons.format_size,Icons.format_strikethrough,Icons.format_textdirection_l_to_r,Icons.format_textdirection_r_to_l,Icons.format_underlined,Icons.forum,Icons.forward,Icons.forward_5,Icons.forward_10,Icons.forward_30,Icons.four_k,Icons.free_breakfast,Icons.fullscreen,Icons.fullscreen_exit,Icons.functions,Icons.g_translate,Icons.gamepad,Icons.games,Icons.gavel,Icons.gesture,Icons.get_app,Icons.gif,Icons.golf_course,Icons.gps_fixed,Icons.gps_not_fixed,Icons.gps_off,Icons.grade,Icons.gradient,Icons.grain,Icons.graphic_eq,Icons.grid_off,Icons.grid_on,Icons.group,Icons.group_add,Icons.group_work,Icons.hd,Icons.hdr_off,Icons.hdr_on,Icons.hdr_strong,Icons.hdr_weak,Icons.headset,Icons.headset_mic,Icons.headset_off,Icons.healing,Icons.hearing,Icons.help,Icons.help_outline,Icons.high_quality,Icons.highlight,Icons.highlight_off,Icons.history,Icons.home,Icons.hot_tub,Icons.hotel,Icons.hourglass_empty,Icons.hourglass_full,Icons.http,Icons.https,Icons.image,Icons.image_aspect_ratio,Icons.import_contacts,Icons.import_export,Icons.important_devices,Icons.inbox,Icons.indeterminate_check_box,Icons.info,Icons.info_outline,Icons.input,Icons.insert_chart,Icons.insert_comment,Icons.insert_drive_file,Icons.insert_emoticon,Icons.insert_invitation,Icons.insert_link,Icons.insert_photo,Icons.invert_colors,Icons.invert_colors_off,Icons.iso,Icons.keyboard,Icons.keyboard_arrow_down,Icons.keyboard_arrow_left,Icons.keyboard_arrow_right,Icons.keyboard_arrow_up,Icons.keyboard_backspace,Icons.keyboard_capslock,Icons.keyboard_hide,Icons.keyboard_return,Icons.keyboard_tab,Icons.keyboard_voice,Icons.kitchen,Icons.label,Icons.label_important,Icons.label_outline,Icons.landscape,Icons.language,Icons.laptop,Icons.laptop_chromebook,Icons.laptop_mac,Icons.laptop_windows,Icons.last_page,Icons.launch,Icons.layers,Icons.layers_clear,Icons.leak_add,Icons.leak_remove,Icons.lens,Icons.library_add,Icons.library_books,Icons.library_music,Icons.lightbulb_outline,Icons.line_style,Icons.line_weight,Icons.linear_scale,Icons.link,Icons.link_off,Icons.linked_camera,Icons.list,Icons.live_help,Icons.live_tv,Icons.local_activity,Icons.local_airport,Icons.local_atm,Icons.local_bar,Icons.local_cafe,Icons.local_car_wash,Icons.local_convenience_store,Icons.local_dining,Icons.local_drink,Icons.local_florist,Icons.local_gas_station,Icons.local_grocery_store,Icons.local_hospital,Icons.local_hotel,Icons.local_laundry_service,Icons.local_library,Icons.local_mall,Icons.local_movies,Icons.local_offer,Icons.local_parking,Icons.local_pharmacy,Icons.local_phone,Icons.local_pizza,Icons.local_play,Icons.local_post_office,Icons.local_printshop,Icons.local_see,Icons.local_shipping,Icons.local_taxi,Icons.location_city,Icons.location_disabled,Icons.location_off,Icons.location_on,Icons.location_searching,Icons.lock,Icons.lock_open,Icons.lock_outline,Icons.looks,Icons.looks_3,Icons.looks_4,Icons.looks_5,Icons.looks_6,Icons.looks_one,Icons.looks_two,Icons.loop,Icons.loupe,Icons.low_priority,Icons.loyalty,Icons.mail,Icons.mail_outline,Icons.map,Icons.markunread,Icons.markunread_mailbox,Icons.maximize,Icons.memory,Icons.menu,Icons.merge_type,Icons.message,Icons.mic,Icons.mic_none,Icons.mic_off,Icons.minimize,Icons.missed_video_call,Icons.mms,Icons.mobile_screen_share,Icons.mode_comment,Icons.mode_edit,Icons.monetization_on,Icons.money_off,Icons.monochrome_photos,Icons.mood,Icons.mood_bad,Icons.more,Icons.more_horiz,Icons.more_vert,Icons.motorcycle,Icons.mouse,Icons.move_to_inbox,Icons.movie,Icons.movie_creation,Icons.movie_filter,Icons.multiline_chart,Icons.music_note,Icons.music_video,Icons.my_location,Icons.nature,Icons.nature_people,Icons.navigate_before,Icons.navigate_next,Icons.navigation,Icons.near_me,Icons.network_cell,Icons.network_check,Icons.network_locked,Icons.network_wifi,Icons.new_releases,Icons.next_week,Icons.nfc,Icons.no_encryption,Icons.no_sim,Icons.not_interested,Icons.not_listed_location,Icons.note,Icons.note_add,Icons.notification_important,Icons.notifications,Icons.notifications_active,Icons.notifications_none,Icons.notifications_off,Icons.notifications_paused,Icons.offline_bolt,Icons.offline_pin,Icons.ondemand_video,Icons.opacity,Icons.open_in_browser,Icons.open_in_new,Icons.open_with,Icons.outlined_flag,Icons.pages,Icons.pageview,Icons.palette,Icons.pan_tool,Icons.panorama,Icons.panorama_fish_eye,Icons.panorama_horizontal,Icons.panorama_vertical,Icons.panorama_wide_angle,Icons.party_mode,Icons.pause,Icons.pause_circle_filled,Icons.pause_circle_outline,Icons.payment,Icons.people,Icons.people_outline,Icons.perm_camera_mic,Icons.perm_contact_calendar,Icons.perm_data_setting,Icons.perm_device_information,Icons.perm_identity,Icons.perm_media,Icons.perm_phone_msg,Icons.perm_scan_wifi,Icons.person,Icons.person_add,Icons.person_outline,Icons.person_pin,Icons.person_pin_circle,Icons.personal_video,Icons.pets,Icons.phone,Icons.phone_android,Icons.phone_bluetooth_speaker,Icons.phone_forwarded,Icons.phone_in_talk,Icons.phone_iphone,Icons.phone_locked,Icons.phone_missed,Icons.phone_paused,Icons.phonelink,Icons.phonelink_erase,Icons.phonelink_lock,Icons.phonelink_off,Icons.phonelink_ring,Icons.phonelink_setup,Icons.photo,Icons.photo_album,Icons.photo_camera,Icons.photo_filter,Icons.photo_library,Icons.photo_size_select_actual,Icons.photo_size_select_large,Icons.photo_size_select_small,Icons.picture_as_pdf,Icons.picture_in_picture,Icons.picture_in_picture_alt,Icons.pie_chart,Icons.pie_chart_outlined,Icons.pin_drop,Icons.place,Icons.play_arrow,Icons.play_circle_filled,Icons.play_circle_outline,Icons.play_for_work,Icons.playlist_add,Icons.playlist_add_check,Icons.playlist_play,Icons.plus_one,Icons.poll,Icons.polymer,Icons.pool,Icons.portable_wifi_off,Icons.portrait,Icons.power,Icons.power_input,Icons.power_settings_new,Icons.pregnant_woman,Icons.present_to_all,Icons.print,Icons.priority_high,Icons.public,Icons.publish,Icons.query_builder,Icons.question_answer,Icons.queue,Icons.queue_music,Icons.queue_play_next,Icons.radio,Icons.radio_button_checked,Icons.radio_button_unchecked,Icons.rate_review,Icons.receipt,Icons.recent_actors,Icons.record_voice_over,Icons.redeem,Icons.redo,Icons.refresh,Icons.remove,Icons.remove_circle,Icons.remove_circle_outline,Icons.remove_from_queue,Icons.remove_red_eye,Icons.remove_shopping_cart,Icons.reorder,Icons.repeat,Icons.repeat_one,Icons.replay,Icons.replay_5,Icons.replay_10,Icons.replay_30,Icons.reply,Icons.reply_all,Icons.report,Icons.report_off,Icons.report_problem,Icons.restaurant,Icons.restaurant_menu,Icons.restore,Icons.restore_from_trash,Icons.restore_page,Icons.ring_volume,Icons.room,Icons.room_service,Icons.rotate_90_degrees_ccw,Icons.rotate_left,Icons.rotate_right,Icons.rounded_corner,Icons.router,Icons.rowing,Icons.rss_feed,Icons.rv_hookup,Icons.satellite,Icons.save,Icons.save_alt,Icons.scanner,Icons.scatter_plot,Icons.schedule,Icons.school,Icons.score,Icons.screen_lock_landscape,Icons.screen_lock_portrait,Icons.screen_lock_rotation,Icons.screen_rotation,Icons.screen_share,Icons.sd_card,Icons.sd_storage,Icons.search,Icons.security,Icons.select_all,Icons.send,Icons.sentiment_dissatisfied,Icons.sentiment_neutral,Icons.sentiment_satisfied,Icons.sentiment_very_dissatisfied,Icons.sentiment_very_satisfied,Icons.settings,Icons.settings_applications,Icons.settings_backup_restore,Icons.settings_bluetooth,Icons.settings_brightness,Icons.settings_cell,Icons.settings_ethernet,Icons.settings_input_antenna,Icons.settings_input_component,Icons.settings_input_composite,Icons.settings_input_hdmi,Icons.settings_input_svideo,Icons.settings_overscan,Icons.settings_phone,Icons.settings_power,Icons.settings_remote,Icons.settings_system_daydream,Icons.settings_voice,Icons.share,Icons.shop,Icons.shop_two,Icons.shopping_basket,Icons.shopping_cart,Icons.short_text,Icons.show_chart,Icons.shuffle,Icons.shutter_speed,Icons.signal_cellular_4_bar,Icons.signal_cellular_connected_no_internet_4_bar,Icons.signal_cellular_no_sim,Icons.signal_cellular_null,Icons.signal_cellular_off,Icons.signal_wifi_4_bar,Icons.signal_wifi_4_bar_lock,Icons.signal_wifi_off,Icons.sim_card,Icons.sim_card_alert,Icons.skip_next,Icons.skip_previous,Icons.slideshow,Icons.slow_motion_video,Icons.smartphone,Icons.smoke_free,Icons.smoking_rooms,Icons.sms,Icons.sms_failed,Icons.snooze,Icons.sort,Icons.sort_by_alpha,Icons.spa,Icons.space_bar,Icons.speaker,Icons.speaker_group,Icons.speaker_notes,Icons.speaker_notes_off,Icons.speaker_phone,Icons.spellcheck,Icons.star,Icons.star_border,Icons.star_half,Icons.stars,Icons.stay_current_landscape,Icons.stay_current_portrait,Icons.stay_primary_landscape,Icons.stay_primary_portrait,Icons.stop,Icons.stop_screen_share,Icons.storage,Icons.store,Icons.store_mall_directory,Icons.straighten,Icons.streetview,Icons.strikethrough_s,Icons.style,Icons.subdirectory_arrow_left,Icons.subdirectory_arrow_right,Icons.subject,Icons.subscriptions,Icons.subtitles,Icons.subway,Icons.supervised_user_circle,Icons.supervisor_account,Icons.surround_sound,Icons.swap_calls,Icons.swap_horiz,Icons.swap_horizontal_circle,Icons.swap_vert,Icons.swap_vertical_circle,Icons.switch_camera,Icons.switch_video,Icons.sync,Icons.sync_disabled,Icons.sync_problem,Icons.system_update,Icons.system_update_alt,Icons.tab,Icons.tab_unselected,Icons.table_chart,Icons.tablet,Icons.tablet_android,Icons.tablet_mac,Icons.tag_faces,Icons.tap_and_play,Icons.terrain,Icons.text_fields,Icons.text_format,Icons.text_rotate_up,Icons.text_rotate_vertical,Icons.text_rotation_angledown,Icons.text_rotation_angleup,Icons.text_rotation_down,Icons.text_rotation_none,Icons.textsms,Icons.texture,Icons.theaters,Icons.threed_rotation,Icons.threesixty,Icons.thumb_down,Icons.thumb_up,Icons.thumbs_up_down,Icons.time_to_leave,Icons.timelapse,Icons.timeline,Icons.timer,Icons.timer_3,Icons.timer_10,Icons.timer_off,Icons.title,Icons.toc,Icons.today,Icons.toll,Icons.tonality,Icons.touch_app,Icons.toys,Icons.track_changes,Icons.traffic,Icons.train,Icons.tram,Icons.transfer_within_a_station,Icons.transform,Icons.transit_enterexit,Icons.translate,Icons.trending_down,Icons.trending_flat,Icons.trending_up,Icons.trip_origin,Icons.tune,Icons.turned_in,Icons.turned_in_not,Icons.tv,Icons.unarchive,Icons.undo,Icons.unfold_less,Icons.unfold_more,Icons.update,Icons.usb,Icons.verified_user,Icons.vertical_align_bottom,Icons.vertical_align_center,Icons.vertical_align_top,Icons.vibration,Icons.video_call,Icons.video_label,Icons.video_library,Icons.videocam,Icons.videocam_off,Icons.videogame_asset,Icons.view_agenda,Icons.view_array,Icons.view_carousel,Icons.view_column,Icons.view_comfy,Icons.view_compact,Icons.view_day,Icons.view_headline,Icons.view_list,Icons.view_module,Icons.view_quilt,Icons.view_stream,Icons.view_week,Icons.vignette,Icons.visibility,Icons.visibility_off,Icons.voice_chat,Icons.voicemail,Icons.volume_down,Icons.volume_mute,Icons.volume_off,Icons.volume_up,Icons.vpn_key,Icons.vpn_lock,Icons.wallpaper,Icons.warning,Icons.watch,Icons.watch_later,Icons.wb_auto,Icons.wb_cloudy,Icons.wb_incandescent,Icons.wb_iridescent,Icons.wb_sunny,Icons.wc,Icons.web,Icons.web_asset,Icons.weekend,Icons.whatshot,Icons.widgets,Icons.wifi,Icons.wifi_lock,Icons.wifi_tethering,Icons.work,Icons.wrap_text,Icons.youtube_searched_for,Icons.zoom_in,Icons.zoom_out,Icons.zoom_out_map]; + static List names = [Icons.ac_unit,Icons.access_alarm,Icons.access_alarms,Icons.access_time,Icons.accessibility,Icons.accessibility_new,Icons.accessible,Icons.accessible_forward,Icons.account_balance,Icons.account_balance_wallet,Icons.account_box,Icons.account_circle,Icons.adb,Icons.add,Icons.add_a_photo,Icons.add_alarm,Icons.add_alert,Icons.add_box,Icons.add_call,Icons.add_circle,Icons.add_circle_outline,Icons.add_comment,Icons.add_location,Icons.add_photo_alternate,Icons.add_shopping_cart,Icons.add_to_home_screen,Icons.add_to_photos,Icons.add_to_queue,Icons.adjust,Icons.airline_seat_flat,Icons.airline_seat_flat_angled,Icons.airline_seat_individual_suite,Icons.airline_seat_legroom_extra,Icons.airline_seat_legroom_normal,Icons.airline_seat_legroom_reduced,Icons.airline_seat_recline_extra,Icons.airline_seat_recline_normal,Icons.airplanemode_active,Icons.airplanemode_inactive,Icons.airplay,Icons.airport_shuttle,Icons.alarm,Icons.alarm_add,Icons.alarm_off,Icons.alarm_on,Icons.album,Icons.all_inclusive,Icons.all_out,Icons.alternate_email,Icons.android,Icons.announcement,Icons.apps,Icons.archive,Icons.arrow_back,Icons.arrow_back_ios,Icons.arrow_downward,Icons.arrow_drop_down,Icons.arrow_drop_down_circle,Icons.arrow_drop_up,Icons.arrow_forward,Icons.arrow_forward_ios,Icons.arrow_left,Icons.arrow_right,Icons.arrow_upward,Icons.art_track,Icons.aspect_ratio,Icons.assessment,Icons.assignment,Icons.assignment_ind,Icons.assignment_late,Icons.assignment_return,Icons.assignment_returned,Icons.assignment_turned_in,Icons.assistant,Icons.assistant_photo,Icons.atm,Icons.attach_file,Icons.attach_money,Icons.attachment,Icons.audiotrack,Icons.autorenew,Icons.av_timer,Icons.backspace,Icons.backup,Icons.battery_alert,Icons.battery_charging_full,Icons.battery_full,Icons.battery_std,Icons.battery_unknown,Icons.beach_access,Icons.beenhere,Icons.block,Icons.bluetooth,Icons.bluetooth_audio,Icons.bluetooth_connected,Icons.bluetooth_disabled,Icons.bluetooth_searching,Icons.blur_circular,Icons.blur_linear,Icons.blur_off,Icons.blur_on,Icons.book,Icons.bookmark,Icons.bookmark_border,Icons.border_all,Icons.border_bottom,Icons.border_clear,Icons.border_color,Icons.border_horizontal,Icons.border_inner,Icons.border_left,Icons.border_outer,Icons.border_right,Icons.border_style,Icons.border_top,Icons.border_vertical,Icons.branding_watermark,Icons.brightness_1,Icons.brightness_2,Icons.brightness_3,Icons.brightness_4,Icons.brightness_5,Icons.brightness_6,Icons.brightness_7,Icons.brightness_auto,Icons.brightness_high,Icons.brightness_low,Icons.brightness_medium,Icons.broken_image,Icons.brush,Icons.bubble_chart,Icons.bug_report,Icons.build,Icons.burst_mode,Icons.business,Icons.business_center,Icons.cached,Icons.cake,Icons.calendar_today,Icons.calendar_view_day,Icons.call,Icons.call_end,Icons.call_made,Icons.call_merge,Icons.call_missed,Icons.call_missed_outgoing,Icons.call_received,Icons.call_split,Icons.call_to_action,Icons.camera,Icons.camera_alt,Icons.camera_enhance,Icons.camera_front,Icons.camera_rear,Icons.camera_roll,Icons.cancel,Icons.card_giftcard,Icons.card_membership,Icons.card_travel,Icons.casino,Icons.cast,Icons.cast_connected,Icons.category,Icons.center_focus_strong,Icons.center_focus_weak,Icons.change_history,Icons.chat,Icons.chat_bubble,Icons.chat_bubble_outline,Icons.check,Icons.check_box,Icons.check_box_outline_blank,Icons.check_circle,Icons.check_circle_outline,Icons.chevron_left,Icons.chevron_right,Icons.child_care,Icons.child_friendly,Icons.chrome_reader_mode,Icons.class_,Icons.clear,Icons.clear_all,Icons.close,Icons.closed_caption,Icons.cloud,Icons.cloud_circle,Icons.cloud_done,Icons.cloud_download,Icons.cloud_off,Icons.cloud_queue,Icons.cloud_upload,Icons.code,Icons.collections,Icons.collections_bookmark,Icons.color_lens,Icons.colorize,Icons.comment,Icons.compare,Icons.compare_arrows,Icons.computer,Icons.confirmation_number,Icons.contact_mail,Icons.contact_phone,Icons.contacts,Icons.content_copy,Icons.content_cut,Icons.content_paste,Icons.control_point,Icons.control_point_duplicate,Icons.copyright,Icons.create,Icons.create_new_folder,Icons.credit_card,Icons.crop,Icons.crop_3_2,Icons.crop_5_4,Icons.crop_7_5,Icons.crop_16_9,Icons.crop_din,Icons.crop_free,Icons.crop_landscape,Icons.crop_original,Icons.crop_portrait,Icons.crop_rotate,Icons.crop_square,Icons.dashboard,Icons.data_usage,Icons.date_range,Icons.dehaze,Icons.delete,Icons.delete_forever,Icons.delete_outline,Icons.delete_sweep,Icons.departure_board,Icons.description,Icons.desktop_mac,Icons.desktop_windows,Icons.details,Icons.developer_board,Icons.developer_mode,Icons.device_hub,Icons.device_unknown,Icons.devices,Icons.devices_other,Icons.dialer_sip,Icons.dialpad,Icons.directions,Icons.directions_bike,Icons.directions_boat,Icons.directions_bus,Icons.directions_car,Icons.directions_railway,Icons.directions_run,Icons.directions_subway,Icons.directions_transit,Icons.directions_walk,Icons.disc_full,Icons.dns,Icons.do_not_disturb,Icons.do_not_disturb_alt,Icons.do_not_disturb_off,Icons.do_not_disturb_on,Icons.dock,Icons.domain,Icons.done,Icons.done_all,Icons.done_outline,Icons.donut_large,Icons.donut_small,Icons.drafts,Icons.drag_handle,Icons.drive_eta,Icons.dvr,Icons.edit,Icons.edit_attributes,Icons.edit_location,Icons.eject,Icons.email,Icons.enhanced_encryption,Icons.equalizer,Icons.error,Icons.error_outline,Icons.euro_symbol,Icons.ev_station,Icons.event,Icons.event_available,Icons.event_busy,Icons.event_note,Icons.event_seat,Icons.exit_to_app,Icons.expand_less,Icons.expand_more,Icons.explicit,Icons.explore,Icons.exposure,Icons.exposure_neg_1,Icons.exposure_neg_2,Icons.exposure_plus_1,Icons.exposure_plus_2,Icons.exposure_zero,Icons.extension,Icons.face,Icons.fast_forward,Icons.fast_rewind,Icons.fastfood,Icons.favorite,Icons.favorite_border,Icons.featured_play_list,Icons.featured_video,Icons.feedback,Icons.fiber_dvr,Icons.fiber_manual_record,Icons.fiber_new,Icons.fiber_pin,Icons.fiber_smart_record,Icons.file_download,Icons.file_upload,Icons.filter,Icons.filter_1,Icons.filter_2,Icons.filter_3,Icons.filter_4,Icons.filter_5,Icons.filter_6,Icons.filter_7,Icons.filter_8,Icons.filter_9,Icons.filter_9_plus,Icons.filter_b_and_w,Icons.filter_center_focus,Icons.filter_drama,Icons.filter_frames,Icons.filter_hdr,Icons.filter_list,Icons.filter_none,Icons.filter_tilt_shift,Icons.filter_vintage,Icons.find_in_page,Icons.find_replace,Icons.fingerprint,Icons.first_page,Icons.fitness_center,Icons.flag,Icons.flare,Icons.flash_auto,Icons.flash_off,Icons.flash_on,Icons.flight,Icons.flight_land,Icons.flight_takeoff,Icons.flip,Icons.flip_to_back,Icons.flip_to_front,Icons.folder,Icons.folder_open,Icons.folder_shared,Icons.folder_special,Icons.font_download,Icons.format_align_center,Icons.format_align_justify,Icons.format_align_left,Icons.format_align_right,Icons.format_bold,Icons.format_clear,Icons.format_color_fill,Icons.format_color_reset,Icons.format_color_text,Icons.format_indent_decrease,Icons.format_indent_increase,Icons.format_italic,Icons.format_line_spacing,Icons.format_list_bulleted,Icons.format_list_numbered,Icons.format_list_numbered_rtl,Icons.format_paint,Icons.format_quote,Icons.format_shapes,Icons.format_size,Icons.format_strikethrough,Icons.format_textdirection_l_to_r,Icons.format_textdirection_r_to_l,Icons.format_underlined,Icons.forum,Icons.forward,Icons.forward_5,Icons.forward_10,Icons.forward_30,Icons.four_k,Icons.free_breakfast,Icons.fullscreen,Icons.fullscreen_exit,Icons.functions,Icons.g_translate,Icons.gamepad,Icons.games,Icons.gavel,Icons.gesture,Icons.get_app,Icons.gif,Icons.golf_course,Icons.gps_fixed,Icons.gps_not_fixed,Icons.gps_off,Icons.grade,Icons.gradient,Icons.grain,Icons.graphic_eq,Icons.grid_off,Icons.grid_on,Icons.group,Icons.group_add,Icons.group_work,Icons.hd,Icons.hdr_off,Icons.hdr_on,Icons.hdr_strong,Icons.hdr_weak,Icons.headset,Icons.headset_mic,Icons.headset_off,Icons.healing,Icons.hearing,Icons.help,Icons.help_outline,Icons.high_quality,Icons.highlight,Icons.highlight_off,Icons.history,Icons.home,Icons.hot_tub,Icons.hotel,Icons.hourglass_empty,Icons.hourglass_full,Icons.http,Icons.https,Icons.image,Icons.image_aspect_ratio,Icons.import_contacts,Icons.import_export,Icons.important_devices,Icons.inbox,Icons.indeterminate_check_box,Icons.info,Icons.info_outline,Icons.input,Icons.insert_chart,Icons.insert_comment,Icons.insert_drive_file,Icons.insert_emoticon,Icons.insert_invitation,Icons.insert_link,Icons.insert_photo,Icons.invert_colors,Icons.invert_colors_off,Icons.iso,Icons.keyboard,Icons.keyboard_arrow_down,Icons.keyboard_arrow_left,Icons.keyboard_arrow_right,Icons.keyboard_arrow_up,Icons.keyboard_backspace,Icons.keyboard_capslock,Icons.keyboard_hide,Icons.keyboard_return,Icons.keyboard_tab,Icons.keyboard_voice,Icons.kitchen,Icons.label,Icons.label_important,Icons.label_outline,Icons.landscape,Icons.language,Icons.laptop,Icons.laptop_chromebook,Icons.laptop_mac,Icons.laptop_windows,Icons.last_page,Icons.launch,Icons.layers,Icons.layers_clear,Icons.leak_add,Icons.leak_remove,Icons.lens,Icons.library_add,Icons.library_books,Icons.library_music,Icons.lightbulb_outline,Icons.line_style,Icons.line_weight,Icons.linear_scale,Icons.link,Icons.link_off,Icons.linked_camera,Icons.list,Icons.live_help,Icons.live_tv,Icons.local_activity,Icons.local_airport,Icons.local_atm,Icons.local_bar,Icons.local_cafe,Icons.local_car_wash,Icons.local_convenience_store,Icons.local_dining,Icons.local_drink,Icons.local_florist,Icons.local_gas_station,Icons.local_grocery_store,Icons.local_hospital,Icons.local_hotel,Icons.local_laundry_service,Icons.local_library,Icons.local_mall,Icons.local_movies,Icons.local_offer,Icons.local_parking,Icons.local_pharmacy,Icons.local_phone,Icons.local_pizza,Icons.local_play,Icons.local_post_office,Icons.local_printshop,Icons.local_see,Icons.local_shipping,Icons.local_taxi,Icons.location_city,Icons.location_disabled,Icons.location_off,Icons.location_on,Icons.location_searching,Icons.lock,Icons.lock_open,Icons.lock_outline,Icons.looks,Icons.looks_3,Icons.looks_4,Icons.looks_5,Icons.looks_6,Icons.looks_one,Icons.looks_two,Icons.loop,Icons.loupe,Icons.low_priority,Icons.loyalty,Icons.mail,Icons.mail_outline,Icons.map,Icons.markunread,Icons.markunread_mailbox,Icons.maximize,Icons.memory,Icons.menu,Icons.merge_type,Icons.message,Icons.mic,Icons.mic_none,Icons.mic_off,Icons.minimize,Icons.missed_video_call,Icons.mms,Icons.mobile_screen_share,Icons.mode_comment,Icons.mode_edit,Icons.monetization_on,Icons.money_off,Icons.monochrome_photos,Icons.mood,Icons.mood_bad,Icons.more,Icons.more_horiz,Icons.more_vert,Icons.motorcycle,Icons.mouse,Icons.move_to_inbox,Icons.movie,Icons.movie_creation,Icons.movie_filter,Icons.multiline_chart,Icons.music_note,Icons.music_video,Icons.my_location,Icons.nature,Icons.nature_people,Icons.navigate_before,Icons.navigate_next,Icons.navigation,Icons.near_me,Icons.network_cell,Icons.network_check,Icons.network_locked,Icons.network_wifi,Icons.new_releases,Icons.next_week,Icons.nfc,Icons.no_encryption,Icons.no_sim,Icons.not_interested,Icons.not_listed_location,Icons.note,Icons.note_add,Icons.notification_important,Icons.notifications,Icons.notifications_active,Icons.notifications_none,Icons.notifications_off,Icons.notifications_paused,Icons.offline_bolt,Icons.offline_pin,Icons.ondemand_video,Icons.opacity,Icons.open_in_browser,Icons.open_in_new,Icons.open_with,Icons.outlined_flag,Icons.pages,Icons.pageview,Icons.palette,Icons.pan_tool,Icons.panorama,Icons.panorama_fish_eye,Icons.panorama_horizontal,Icons.panorama_vertical,Icons.panorama_wide_angle,Icons.party_mode,Icons.pause,Icons.pause_circle_filled,Icons.pause_circle_outline,Icons.payment,Icons.people,Icons.people_outline,Icons.perm_camera_mic,Icons.perm_contact_calendar,Icons.perm_data_setting,Icons.perm_device_information,Icons.perm_identity,Icons.perm_media,Icons.perm_phone_msg,Icons.perm_scan_wifi,Icons.person,Icons.person_add,Icons.person_outline,Icons.person_pin,Icons.person_pin_circle,Icons.personal_video,Icons.pets,Icons.phone,Icons.phone_android,Icons.phone_bluetooth_speaker,Icons.phone_forwarded,Icons.phone_in_talk,Icons.phone_iphone,Icons.phone_locked,Icons.phone_missed,Icons.phone_paused,Icons.phonelink,Icons.phonelink_erase,Icons.phonelink_lock,Icons.phonelink_off,Icons.phonelink_ring,Icons.phonelink_setup,Icons.photo,Icons.photo_album,Icons.photo_camera,Icons.photo_filter,Icons.photo_library,Icons.photo_size_select_actual,Icons.photo_size_select_large,Icons.photo_size_select_small,Icons.picture_as_pdf,Icons.picture_in_picture,Icons.picture_in_picture_alt,Icons.pie_chart,Icons.pie_chart_outlined,Icons.pin_drop,Icons.place,Icons.play_arrow,Icons.play_circle_filled,Icons.play_circle_outline,Icons.play_for_work,Icons.playlist_add,Icons.playlist_add_check,Icons.playlist_play,Icons.plus_one,Icons.poll,Icons.polymer,Icons.pool,Icons.portable_wifi_off,Icons.portrait,Icons.power,Icons.power_input,Icons.power_settings_new,Icons.pregnant_woman,Icons.present_to_all,Icons.print,Icons.priority_high,Icons.public,Icons.publish,Icons.query_builder,Icons.question_answer,Icons.queue,Icons.queue_music,Icons.queue_play_next,Icons.radio,Icons.radio_button_checked,Icons.radio_button_unchecked,Icons.rate_review,Icons.receipt,Icons.recent_actors,Icons.record_voice_over,Icons.redeem,Icons.redo,Icons.refresh,Icons.remove,Icons.remove_circle,Icons.remove_circle_outline,Icons.remove_from_queue,Icons.remove_red_eye,Icons.remove_shopping_cart,Icons.reorder,Icons.repeat,Icons.repeat_one,Icons.replay,Icons.replay_5,Icons.replay_10,Icons.replay_30,Icons.reply,Icons.reply_all,Icons.report,Icons.report_off,Icons.report_problem,Icons.restaurant,Icons.restaurant_menu,Icons.restore,Icons.restore_from_trash,Icons.restore_page,Icons.ring_volume,Icons.room,Icons.room_service,Icons.rotate_90_degrees_ccw,Icons.rotate_left,Icons.rotate_right,Icons.rounded_corner,Icons.router,Icons.rowing,Icons.rss_feed,Icons.rv_hookup,Icons.satellite,Icons.save,Icons.save_alt,Icons.scanner,Icons.scatter_plot,Icons.schedule,Icons.school,Icons.score,Icons.screen_lock_landscape,Icons.screen_lock_portrait,Icons.screen_lock_rotation,Icons.screen_rotation,Icons.screen_share,Icons.sd_card,Icons.sd_storage,Icons.search,Icons.security,Icons.select_all,Icons.send,Icons.sentiment_dissatisfied,Icons.sentiment_neutral,Icons.sentiment_satisfied,Icons.sentiment_very_dissatisfied,Icons.sentiment_very_satisfied,Icons.settings,Icons.settings_applications,Icons.settings_backup_restore,Icons.settings_bluetooth,Icons.settings_brightness,Icons.settings_cell,Icons.settings_ethernet,Icons.settings_input_antenna,Icons.settings_input_component,Icons.settings_input_composite,Icons.settings_input_hdmi,Icons.settings_input_svideo,Icons.settings_overscan,Icons.settings_phone,Icons.settings_power,Icons.settings_remote,Icons.settings_system_daydream,Icons.settings_voice,Icons.share,Icons.shop,Icons.shop_two,Icons.shopping_basket,Icons.shopping_cart,Icons.short_text,Icons.show_chart,Icons.shuffle,Icons.shutter_speed,Icons.signal_cellular_4_bar,Icons.signal_cellular_connected_no_internet_4_bar,Icons.signal_cellular_no_sim,Icons.signal_cellular_null,Icons.signal_cellular_off,Icons.signal_wifi_4_bar,Icons.signal_wifi_4_bar_lock,Icons.signal_wifi_off,Icons.sim_card,Icons.sim_card_alert,Icons.skip_next,Icons.skip_previous,Icons.slideshow,Icons.slow_motion_video,Icons.smartphone,Icons.smoke_free,Icons.smoking_rooms,Icons.sms,Icons.sms_failed,Icons.snooze,Icons.sort,Icons.sort_by_alpha,Icons.spa,Icons.space_bar,Icons.speaker,Icons.speaker_group,Icons.speaker_notes,Icons.speaker_notes_off,Icons.speaker_phone,Icons.spellcheck,Icons.star,Icons.star_border,Icons.star_half,Icons.stars,Icons.stay_current_landscape,Icons.stay_current_portrait,Icons.stay_primary_landscape,Icons.stay_primary_portrait,Icons.stop,Icons.stop_screen_share,Icons.storage,Icons.store,Icons.store_mall_directory,Icons.straighten,Icons.streetview,Icons.strikethrough_s,Icons.style,Icons.subdirectory_arrow_left,Icons.subdirectory_arrow_right,Icons.subject,Icons.subscriptions,Icons.subtitles,Icons.subway,Icons.supervised_user_circle,Icons.supervisor_account,Icons.surround_sound,Icons.swap_calls,Icons.swap_horiz,Icons.swap_horizontal_circle,Icons.swap_vert,Icons.swap_vertical_circle,Icons.switch_camera,Icons.switch_video,Icons.sync,Icons.sync_disabled,Icons.sync_problem,Icons.system_update,Icons.system_update_alt,Icons.tab,Icons.tab_unselected,Icons.table_chart,Icons.tablet,Icons.tablet_android,Icons.tablet_mac,Icons.tag_faces,Icons.tap_and_play,Icons.terrain,Icons.text_fields,Icons.text_format,Icons.text_rotate_up,Icons.text_rotate_vertical,Icons.text_rotation_angledown,Icons.text_rotation_angleup,Icons.text_rotation_down,Icons.text_rotation_none,Icons.textsms,Icons.texture,Icons.theaters,Icons.threed_rotation,Icons.threesixty,Icons.thumb_down,Icons.thumb_up,Icons.thumbs_up_down,Icons.time_to_leave,Icons.timelapse,Icons.timeline,Icons.timer,Icons.timer_3,Icons.timer_10,Icons.timer_off,Icons.title,Icons.toc,Icons.today,Icons.toll,Icons.tonality,Icons.touch_app,Icons.toys,Icons.track_changes,Icons.traffic,Icons.train,Icons.tram,Icons.transfer_within_a_station,Icons.transform,Icons.transit_enterexit,Icons.translate,Icons.trending_down,Icons.trending_flat,Icons.trending_up,Icons.trip_origin,Icons.tune,Icons.turned_in,Icons.turned_in_not,Icons.tv,Icons.unarchive,Icons.undo,Icons.unfold_less,Icons.unfold_more,Icons.update,Icons.usb,Icons.verified_user,Icons.vertical_align_bottom,Icons.vertical_align_center,Icons.vertical_align_top,Icons.vibration,Icons.video_call,Icons.video_label,Icons.video_library,Icons.videocam,Icons.videocam_off,Icons.videogame_asset,Icons.view_agenda,Icons.view_array,Icons.view_carousel,Icons.view_column,Icons.view_comfy,Icons.view_compact,Icons.view_day,Icons.view_headline,Icons.view_list,Icons.view_module,Icons.view_quilt,Icons.view_stream,Icons.view_week,Icons.vignette,Icons.visibility,Icons.visibility_off,Icons.voice_chat,Icons.voicemail,Icons.volume_down,Icons.volume_mute,Icons.volume_off,Icons.volume_up,Icons.vpn_key,Icons.vpn_lock,Icons.wallpaper,Icons.warning,Icons.watch,Icons.watch_later,Icons.wb_auto,Icons.wb_cloudy,Icons.wb_incandescent,Icons.wb_iridescent,Icons.wb_sunny,Icons.wc,Icons.web,Icons.web_asset,Icons.weekend,Icons.whatshot,Icons.widgets,Icons.wifi,Icons.wifi_lock,Icons.wifi_tethering,Icons.work,Icons.wrap_text,Icons.youtube_searched_for,Icons.zoom_in,Icons.zoom_out,Icons.zoom_out_map]; } \ No newline at end of file diff --git a/lib/common/provider.dart b/lib/common/provider.dart index 8540d671..32703214 100644 --- a/lib/common/provider.dart +++ b/lib/common/provider.dart @@ -4,37 +4,81 @@ import 'dart:typed_data'; import 'package:path/path.dart'; import 'package:sqflite/sqflite.dart'; import 'package:flutter/services.dart' show rootBundle; +//const createSql = { +// 'cat': """ +// CREATE TABLE "cat" ( +// `id` INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT UNIQUE, +// `name` TEXT NOT NULL UNIQUE, +// `depth` INTEGER NOT NULL DEFAULT 1, +// `parentId` INTEGER NOT NULL, +// `desc` TEXT +// ); +// """, +// 'collectio': """ +// CREATE TABLE collection (id INTEGER PRIMARY KEY NOT NULL UNIQUE, name TEXT NOT NULL, router TEXT); +// """, +// 'widget': """ +// CREATE TABLE widget (id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT UNIQUE, name TEXT NOT NULL, cnName TEXT NOT NULL, image TEXT NOT NULL, doc TEXT, demo TEXT, catId INTEGER NOT NULL REFERENCES cat (id), owner TEXT); +// """; +//}; class Provider { static Database db; + // 获取数据库中所有的表 + Future getTables() async { + if (db == null) { + return Future.value([]); + } + List tables = await db.rawQuery('SELECT name FROM sqlite_master WHERE type = "table"'); + List targetList = []; + tables.forEach((item) { + targetList.add(item['name']); + }); + return targetList; + } + + // 检查数据库中, 表是否完整, 在部份android中, 会出现表丢失的情况 + Future checkTableIsRight() async { + List expectTables = ['cat', 'widget', 'collection']; + + List tables = await getTables(); + + for(int i = 0; i < expectTables.length; i++) { + if (!tables.contains(expectTables[i])) { + print("table lost in app"); + return false; + } + } + return true; + + } + //初始化数据库 - // isCreate 用永远 copy 一个新的数据库 + Future init(bool isCreate) async { //Get a location using getDatabasesPath String databasesPath = await getDatabasesPath(); String path = join(databasesPath, 'flutter.db'); - List tables; + try { db = await openDatabase(path); - tables = await db - .rawQuery('SELECT name FROM sqlite_master WHERE type = "table"'); - print('${tables.length} 7891'); } catch (e) { print("Error $e"); } + bool tableIsRight = await this.checkTableIsRight(); - if (tables.length < 3) { - // Delete the database - await deleteDatabase(path); + if (!tableIsRight) { // 关闭上面打开的db,否则无法执行open db.close(); + // Delete the database + await deleteDatabase(path); ByteData data = await rootBundle.load(join("assets", "app.db")); List bytes = data.buffer.asUint8List(data.offsetInBytes, data.lengthInBytes); await new File(path).writeAsBytes(bytes); - db = await openDatabase(path, version: 2, + db = await openDatabase(path, version: 1, onCreate: (Database db, int version) async { print('db created version is $version'); }, onOpen: (Database db) async { @@ -44,4 +88,5 @@ class Provider { print("Opening existing database"); } } + } diff --git a/lib/common/style.dart b/lib/common/style.dart new file mode 100644 index 00000000..31d9bb8d --- /dev/null +++ b/lib/common/style.dart @@ -0,0 +1,29 @@ +import 'package:flutter/material.dart'; + +//颜色配置 +class AppColor{ + static const int white = 0xFFFFFFFF; + static const int mainTextColor = 0xFF121917; + static const int subTextColor = 0xff959595; +} + +//文本设置 +class AppText{ + static const middleSize = 16.0; + + static const middleText = TextStyle( + color: Color(AppColor.mainTextColor), + fontSize: middleSize, + ); + + static const middleSubText = TextStyle( + color: Color(AppColor.subTextColor), + fontSize: middleSize, + ); +} +class WidgetDemoColor { + static const int fontColor = 0xFF607173; + static const int iconColor = 0xFF607173; + static const int borderColor = 0xFFEFEFEF; + +} diff --git a/lib/common/widget_demo.dart b/lib/common/widget_demo.dart index b7c1759d..204c4ca0 100644 --- a/lib/common/widget_demo.dart +++ b/lib/common/widget_demo.dart @@ -18,13 +18,16 @@ class WidgetDemo extends StatefulWidget { final String docUrl; final String title; final String codeUrl; + final Widget bottomNaviBar; WidgetDemo( {Key key, @required this.title, @required this.contentList, @required this.codeUrl, - @required this.docUrl}) + @required this.docUrl, + this.bottomNaviBar + }) : super(key: key); _WidgetDemoState createState() => _WidgetDemoState(); @@ -207,6 +210,8 @@ class _WidgetDemoState extends State { ], ), ), + bottomNavigationBar: (widget.bottomNaviBar is Widget) ? widget + .bottomNaviBar : null ); } } diff --git a/lib/common/widget_name_to_icon.dart b/lib/common/widget_name_to_icon.dart index b3436602..188e848f 100644 --- a/lib/common/widget_name_to_icon.dart +++ b/lib/common/widget_name_to_icon.dart @@ -137,8 +137,14 @@ class WidgetName2Icon { "YearPicker":Icons.event_busy, "ShowdatePicker":Icons.event, "MaterialPageRoute":Icons.album, - "MaterialAccentColor":Icons.brush, - - + "MaterialAccentColor":Icons.brush, + "SnackBarAction":Icons.assessment, + "TabBar":Icons.burst_mode, + "AlertDialog":Icons.sms_failed, + "AboutDialog":Icons.sms, + "SimpleDialog":Icons.message, + "ScaffoldState":Icons.local_bar, + "GridTile":Icons.apps, + "MergeableMaterialItem":Icons.view_list }; } diff --git a/lib/views/widgetPage/cate_card.dart b/lib/components/cate_card.dart similarity index 96% rename from lib/views/widgetPage/cate_card.dart rename to lib/components/cate_card.dart index 7d87e6d1..24c05948 100644 --- a/lib/views/widgetPage/cate_card.dart +++ b/lib/components/cate_card.dart @@ -1,7 +1,7 @@ import 'package:flutter/material.dart'; -import '../../model/cat.dart'; -import '../../common/widget_name_to_icon.dart'; -import '../../components/widget_item_container.dart'; +import '../model/cat.dart'; +import '../common/widget_name_to_icon.dart'; +import '../components/widget_item_container.dart'; class CateCard extends StatefulWidget { final Cat category; diff --git a/lib/components/CompList.dart b/lib/components/comp_list.dart similarity index 98% rename from lib/components/CompList.dart rename to lib/components/comp_list.dart index 580c41da..3183bb5a 100644 --- a/lib/components/CompList.dart +++ b/lib/components/comp_list.dart @@ -1,7 +1,5 @@ import 'package:flutter/material.dart'; -import 'package:flutter_rookie_book/views/Detail.dart'; - - +import 'package:flutter_go/views/Detail.dart'; class CompList extends StatefulWidget { @override diff --git a/lib/components/disclaimer_msg.dart b/lib/components/disclaimer_msg.dart new file mode 100644 index 00000000..999056f1 --- /dev/null +++ b/lib/components/disclaimer_msg.dart @@ -0,0 +1,265 @@ +/** + * Created with Android Studio. + * User: 一晟 + * Date: 2019/1/12 + * Time: 下午9:19 + * email: zhu.yan@alibaba-inc.com + */ +import 'package:flutter/material.dart'; +//import 'package:flutter_rookie_book/model/collection_general.dart'; +//import 'package:flutter_rookie_book/model/collection_general.dart'; + + +const disclaimerText1 = '\r\r\r\r\r\r本APP属于个人的非赢利性开源项目,以供开源社区使用,凡本APP转载的所有的文章 、图片、音频、视频文件等资料的版权归版权所有人所有,本APP采用的非本站原创文章及图片等内容无法一一和版权者联系,如果本网所选内容的文章作者及编辑认为其作品不宜上网供大家浏览,或不应无偿使用请及时用电子邮件或电话通知我们,以迅速采取适当措施,避免给双方造成不必要的经济损失。'; +const disclaimerText2 = '\n\r\r\r\r\r\r对于已经授权本APP独家使用并提供给本站资料的版权所有人的文章、图片等资料,如需转载使用,需取得本站和版权所有人的同意。本APP所刊发、转载的文章,其版权均归原作者所有,如其他媒体、网站或个人从本网下载使用,请在转载有关文章时务必尊重该文章的著作权,保留本网注明的“稿件来源”,并自负版权等法律责任。'; + + +class DisclaimerMsg extends StatefulWidget { + final State pWidget; + DisclaimerMsg({ Key key, this.pWidget }) : super(key: key); + DisclaimerMsgState createState() => DisclaimerMsgState(); +} + +class DisclaimerMsgState extends State { + var _valBool = false; + var _page; + //CollectionControlModel _collectionControl = new CollectionControlModel(); + //List _collectionList = []; + // void init(BuildContext context) { + // Toast.show(context: context, message: "👉 APP免责声明",cb:showAlertDialog); + // } + + @override + void initState() { + super.initState(); +// _collectionList.clear(); +// _collectionControl.getAllCollection().then((resultList) { +// resultList.forEach((item) { +// _collectionList.add(item); +// print('=============db=========${item}'); +// }); +// }); + _page = widget.pWidget; + } + + + + void refs(bool value){ + if(this.mounted){ + setState(() { + _valBool=value; + _page.save(value); + }); + +// _collectionControl +// .insert(CollectionGeneral(key: 'disclaimer', values: value.toString())) +// .then((result) { +// print('result2====${result}'); +// } +// ); + } + } + + void showAlertDialog(BuildContext context) { +// new Future.delayed(Duration(seconds: 5)).then((value) { +// Navigator.of(context).pop(); +// }); + showDialog( + context: context, + barrierDismissible: false, // user must tap button! + builder: (BuildContext context) { + return AlertDialog( + //title: Text('免责声明'), + content:SingleChildScrollView( + child: ListBody( + children: [ + Container( + padding: EdgeInsets.fromLTRB(5.0, 5.0, 10.0, 10.0), + //width: 100, + height: 35, + child: Text('免责声明',style:TextStyle(fontSize: 18,fontWeight:FontWeight.w700 )), + decoration: BoxDecoration( + //color: Colors.blue, + image: DecorationImage( + fit: BoxFit.fitWidth, + image: AssetImage('assets/images/paimaiLogo.png') + ), + borderRadius: BorderRadius.all( + Radius.circular(10.0), + ), + //alignment: Alignment.bottomRight, + ) + ), + SizedBox(height:20), + Text(disclaimerText1), + Text(disclaimerText2), + ], + ), + ), + shape:RoundedRectangleBorder(borderRadius: new BorderRadius.circular(20.0)), // 圆角 + actions: [ + Container( + width: 270, + alignment: Alignment.centerLeft, + padding: new EdgeInsets.fromLTRB(0.0, 0.0, 30.0, 0.0), + child: + Row( + mainAxisAlignment:MainAxisAlignment.spaceAround, + //crossAxisAlignment:CrossAxisAlignment.start, + children: [ + Row( + mainAxisAlignment:MainAxisAlignment.center, + children: [ + Checkbox( + activeColor: Theme.of(context).primaryColor, + tristate:false, + value: _valBool, + onChanged: (bool bol) { + refs(bol); + Navigator.of(context).pop(); // here I pop to avoid multiple Dialogs + showAlertDialog(context); //here i call the same function + } + ), + Text('不再自动提示',style:TextStyle(fontSize: 14)), + ], + ), + new Flexible( + flex: 1, + child: Container(width: 100,) + ), + FlatButton( + child: Text('知道了',style:TextStyle(fontSize: 16,color: Colors.white)), + color: Theme.of(context).primaryColor, + onPressed: () { + Navigator.of(context).pop(); + }, + ), + ] +// SizedBox( +// width:150, +// height:55, +// child: CheckboxListTile( +// title: Text('不再显示',style:TextStyle(fontSize: 14)), +// controlAffinity: ListTileControlAffinity.leading, +// activeColor: Colors.red, +// value: _valBool, +// onChanged: (bool value) { +// refs(value); +// Navigator.of(context).pop(); // here I pop to avoid multiple Dialogs +// showAlertDialog(context); //here i call the same function +// } +// ) +// //secondary: const Icon(Icons.hourglass_empty), +// ), +// Checkbox( +// activeColor: Colors.red, +// tristate:false, +// value: _valBool, +// onChanged: (bool bol) { +// refs(bol); +// Navigator.of(context).pop(); // here I pop to avoid multiple Dialogs +// showAlertDialog(context); //here i call the same function +// } +// ), +// Text('不再显示',style:TextStyle(fontSize: 14)), +// FlatButton( +// child: Text('知道了',style:TextStyle(fontSize: 16,color: Colors.green)), +// onPressed: () { +// Navigator.of(context).pop(); +// }, +// ), +// ], + ) + )], + ); + }, + ); + } + Widget build(BuildContext context) { + return new GestureDetector( + onTap: () { + showAlertDialog(context); + }, + child: Stack( + //alignment: const Alignment(1.6, 1.6), + children: [ + new Container( + width:90.0, + alignment: Alignment.center, + decoration: new BoxDecoration( + borderRadius:new BorderRadius.horizontal(right: Radius.circular(10)), + color: Colors.black45, + ), + child: new Text( + '🔔 免责声明', + style: new TextStyle( + fontSize: 14.0, + //fontWeight: FontWeight.bold, + color: Colors.white, + ), + ), + ), + ], + ) + ); + } + + Widget build2(BuildContext context) { + return Container( + padding: new EdgeInsets.all(0.0), + alignment:Alignment.centerRight, + child:FlatButton( + //padding: new EdgeInsets.fromLTRB(0.0, 0.0, 0.0, 0.0), + child: new Text( + '👉 APP免责声明', + style: new TextStyle( + fontSize: 12.0, //textsize + color: Colors.black54, // textcolor + ), + ), + //color: Theme.of(context).accentColor, + color: Theme.of(context).accentColor, + //elevation: 0.0,//shadow + //splashColor: Colors.blueGrey, + onPressed: () { + showAlertDialog(context); + //Toast.show(context: context, message: "👉 APP免责声明",cb:showAlertDialog); + }) + ); + } +} + +class Toast { + static void show({@required BuildContext context, @required String message,Function cb}) { + //创建一个OverlayEntry对象 + OverlayEntry overlayEntry = new OverlayEntry(builder: (context) { + return new Positioned( + top: MediaQuery.of(context).size.height * 0.12, + right:5.0, + child:RaisedButton( + padding: new EdgeInsets.fromLTRB(10.0, 0.0, 10.0, 0.0), + child: new Text( + '👉 APP免责声明', + style: new TextStyle( + fontSize: 14.0, //textsize + color: Colors.black54, // textcolor + ), + ), + //color: Theme.of(context).accentColor, + color: Colors.red, + //elevation: 0.0,//shadow + //splashColor: Colors.blueGrey, + onPressed: () { + if(cb is Function){ + cb(context); + } + }) + ); + }); + //往Overlay中插入插入OverlayEntry + Overlay.of(context).insert(overlayEntry); + new Future.delayed(Duration(seconds: 2)).then((value) { + //overlayEntry.remove(); + }); + } +} \ No newline at end of file diff --git a/lib/views/widgetFeature/FirstPageItem.dart b/lib/components/first_page_item.dart similarity index 97% rename from lib/views/widgetFeature/FirstPageItem.dart rename to lib/components/first_page_item.dart index f91ffd09..3e4e8604 100644 --- a/lib/views/widgetFeature/FirstPageItem.dart +++ b/lib/components/first_page_item.dart @@ -7,7 +7,7 @@ * tartget: FirstPageItem */ -import '../../common/Util.dart'; +import '../common/Util.dart'; class FirstPageItem { bool hot; diff --git a/lib/components/homeBanner.dart b/lib/components/home_banner.dart similarity index 100% rename from lib/components/homeBanner.dart rename to lib/components/home_banner.dart diff --git a/lib/components/ListRefresh.dart b/lib/components/list_refresh.dart similarity index 94% rename from lib/components/ListRefresh.dart rename to lib/components/list_refresh.dart index 32c11d71..6a8cd00a 100644 --- a/lib/components/ListRefresh.dart +++ b/lib/components/list_refresh.dart @@ -11,8 +11,9 @@ import 'package:flutter/material.dart'; class ListRefresh extends StatefulWidget { final renderItem; final requestApi; + final headerView; - const ListRefresh([this.requestApi, this.renderItem]) : super(); + const ListRefresh([this.requestApi, this.renderItem, this.headerView]) : super(); @override State createState() => _ListRefreshState(); @@ -167,7 +168,11 @@ class _ListRefreshState extends State { itemCount: items.length + 1, itemBuilder: (context, index) { if (index == 0 && index != items.length) { - return Container(height: 0); + if(widget.headerView is Function){ + return widget.headerView(); + }else { + return Container(height: 0); + } } if (index == items.length) { //return _buildLoadText(); @@ -178,7 +183,6 @@ class _ListRefreshState extends State { if (widget.renderItem is Function) { return widget.renderItem(index, items[index]); } - //return makeCard(index,items[index]); } }, controller: _scrollController, diff --git a/lib/components/Pagination.dart b/lib/components/pagination.dart similarity index 82% rename from lib/components/Pagination.dart rename to lib/components/pagination.dart index 61b3b5d4..438be3fe 100644 --- a/lib/components/Pagination.dart +++ b/lib/components/pagination.dart @@ -3,7 +3,7 @@ // found in the LICENSE file. import 'package:flutter/material.dart'; -import './homeBanner.dart'; +import './home_banner.dart'; import '../model/story.dart'; import 'package:url_launcher/url_launcher.dart'; @@ -18,13 +18,11 @@ class Pagination extends StatelessWidget { const Icon(Icons.language, semanticLabel: 'Language'), ]; - final List bannerStories = []; - final List arr = [ {'image': 'https://img.alicdn.com/tfs/TB1W4hMAwHqK1RjSZJnXXbNLpXa-519-260.jpg', 'type': 0, 'id': 9695909, 'url': 'https://www.zhihu.com/question/294145797/answer/551162834', 'title': '为什么阿里巴巴、腾讯和 Google 之类的企业都在使用 Flutter 开发 App?'}, {'image': 'https://img.alicdn.com/tfs/TB1XmFIApzqK1RjSZSgXXcpAVXa-720-338.jpg', 'type': 0, 'id': 9695859, 'url': 'https://zhuanlan.zhihu.com/p/51696594', 'title': 'Flutter 1.0 正式发布: Google 的便携 UI 工具包'}, {'image': 'https://img.alicdn.com/tfs/TB1mClCABLoK1RjSZFuXXXn0XXa-600-362.jpg', 'type': 0, 'id': 96956491409, 'url':'https://zhuanlan.zhihu.com/p/53497167','title': 'Flutter 示范应用现已开源 — 万物起源(The History of Everything)'}, - {'image': 'https://img.alicdn.com/tfs/TB1fXxIAAvoK1RjSZFNXXcxMVXa-600-362.jpg', 'type': 0, 'id': 9695816, 'url': 'https://mp.weixin.qq.com/s?__biz=MzAwODY4OTk2Mg==&mid=2652048101&idx=1&sn=20296088e4bd8ca33c5c9991167d9f7d&chksm=808caaa0b7fb23b65c0e5806209f8d86da6732f3a00a70353f3606018339518b0a8656f14dc5&mpshare=1&scene=2&srcid=0106SZapVysZdIS6Oc5AhNH6&from=timeline&ascene=2&devicetype=android-27&version=27000038&nettype=WIFI&abtest_cookie=BQABAAgACgALABMAFAAFAJ2GHgAjlx4AV5keAJuZHgCcmR4AAAA%3D&lang=zh_CN&pass_ticket=4K1%2FUpsxP4suPj2iubR17wbAP7r9LW9iYrPAC2dppTqv7j7JO5FWMXtcKeBRxueV&wx_header=1', 'title': 'Flutter 与 Material Design 双剑合璧,助您构建精美应用'} + {'image': 'https://img.alicdn.com/tfs/TB1fXxIAAvoK1RjSZFNXXcxMVXa-600-362.jpg', 'type': 0, 'id': 9695816, 'url': 'https://mp.weixin.qq.com/s?__biz=MzAwODY4OTk2Mg==&mid=2652048101&idx=1&sn=20296088e4bd8ca33c5c9991167d9f7d&chksm=808caaa0b7fb23b65c0e5806209f8d86da6732f3a00a70353f3606018339518b0a8656f14dc5&mpsshare=1&scene=2&srcid=0106SZapVysZdIS6Oc5AhNH6&from=timeline&ascene=2&devicetype=android-27&version=27000038&nettype=WIFI&abtest_cookie=BQABAAgACgALABMAFAAFAJ2GHgAjlx4AV5keAJuZHgCcmR4AAAA%3D&lang=zh_CN&pass_ticket=4K1%2FUpsxP4suPj2iubR17wbAP7r9LW9iYrPAC2dppTqv7j7JO5FWMXtcKeBRxueV&wx_header=1', 'title': 'Flutter 与 Material Design 双剑合璧,助您构建精美应用'} ]; void _launchURL(String url) async { @@ -37,6 +35,7 @@ class Pagination extends StatelessWidget { List _pageSelector(BuildContext context) { List list = []; + List bannerStories = []; /// super.initState(); arr.forEach((item) { bannerStories.add(StoryModel.fromJson(item)); @@ -55,6 +54,7 @@ class Pagination extends StatelessWidget { Widget build(BuildContext context) { return Column( + key:Key('__header__'), //physics: AlwaysScrollableScrollPhysics(), //padding: EdgeInsets.only(), children: _pageSelector(context) diff --git a/lib/components/SearchInput.dart b/lib/components/search_input.dart similarity index 94% rename from lib/components/SearchInput.dart rename to lib/components/search_input.dart index 36155575..a62bce1e 100644 --- a/lib/components/SearchInput.dart +++ b/lib/components/search_input.dart @@ -159,7 +159,9 @@ class _MaterialSearchState extends State { _resultsTimer?.cancel(); } Widget buildBody(List results) { - if (_loading) { + if (_criteria.isEmpty) { + return History(); + } else if (_loading) { return new Center( child: new Padding( padding: const EdgeInsets.only(top: 50.0), @@ -396,3 +398,35 @@ class SearchInput extends StatelessWidget { } } // wigdet干掉.=> componets + + +class History extends StatefulWidget { + const History() : super(); + + @override + _History createState() => _History(); +} + +/* +* AppBar 默认的实例,有状态 +* */ +class _History extends State { + + + @override + void initState() { + super.initState(); + } + + @override + void dispose() { + super.dispose(); + } + + @override + Widget build(BuildContext context) { + return new Center( + child: Text('这是一个即将完善的历史记录的面板'), + ); + } +} \ No newline at end of file diff --git a/lib/components/widget_item.dart b/lib/components/widget_item.dart index 20648fa0..b13966cf 100644 --- a/lib/components/widget_item.dart +++ b/lib/components/widget_item.dart @@ -2,16 +2,17 @@ * @author 一凨 */ import 'package:flutter/material.dart'; -import '../common/Style.dart'; +import '../common/style.dart'; import '../common/widget_name_to_icon.dart'; +String _widgetName; + class WidgetItem extends StatelessWidget { final String title; final VoidCallback onTap; final int index; //用于计算border final int totalCount; final int rowLength; - String _widgetName; WidgetItem( {this.title, this.onTap, this.index, this.totalCount, this.rowLength}); diff --git a/lib/main.dart b/lib/main.dart index 40191ce5..e567cfb1 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -2,18 +2,16 @@ import 'package:flutter/material.dart'; import 'package:fluro/fluro.dart'; import 'package:flutter/rendering.dart'; -import 'views/FirstPage.dart'; -import 'views/widgetPage.dart'; -import 'views/FourthPage.dart'; +import 'views/first_page.dart'; +import 'views/widget_page.dart'; +import 'views/fourth_page.dart'; import 'views/collection_page.dart'; import 'routers/routers.dart'; import 'routers/application.dart'; import 'common/provider.dart'; import 'model/widget.dart'; import './widgets/index.dart'; -import 'package:flutter_rookie_book/components/SearchInput.dart'; - - +import 'package:flutter_go/components/search_input.dart'; const int ThemeColor = 0xFFC91B3A; @@ -121,59 +119,63 @@ class _MyHomePageState extends State return list .map((item) => new MaterialSearchResult( - value: item.name, - text: item.name, - onTap: () { - onWidgetTap(item, context); - }, - )) + value: item.name, + text: item.name, + onTap: () { + onWidgetTap(item, context); + }, + )) .toList(); } else { return null; } - }, (value) { - }, () {}); + }, (value) {}, () {}); } @override Widget build(BuildContext context) { return new Scaffold( - appBar: new AppBar(title: buildSearchInput(context)), - body: new TabBarView(controller: controller, children: [ - new FirstPage(), - new WidgetPage(db), - new CollectionPage(), - new FourthPage() - ]), - bottomNavigationBar: new Material( - color: const Color(0xFFF0EEEF), //底部导航栏主题颜色 - child: new Container( - height: 65.0, - decoration: BoxDecoration( - color: const Color(0xFFF0F0F0), - boxShadow: [ - new BoxShadow( - color: const Color(0xFFd0d0d0), - blurRadius: 3.0, - spreadRadius: 2.0, - offset: Offset(-1.0, -1.0), - ), - ], + appBar: new AppBar(title: buildSearchInput(context)), + body: new TabBarView(controller: controller, children: [ + new FirstPage(), + new WidgetPage(db), + new CollectionPage(), + new FourthPage() + ]), + bottomNavigationBar: Material( + color: const Color(0xFFF0EEEF), //底部导航栏主题颜色 + child: SafeArea( + child: Container( + height: 65.0, + decoration: BoxDecoration( + color: const Color(0xFFF0F0F0), + boxShadow: [ + BoxShadow( + color: const Color(0xFFd0d0d0), + blurRadius: 3.0, + spreadRadius: 2.0, + offset: Offset(-1.0, -1.0), ), - child: new TabBar( - controller: controller, - indicatorColor: - Theme.of(context).primaryColor, //tab标签的下划线颜色 - // labelColor: const Color(0xFF000000), - indicatorWeight: 3.0, - labelColor: Theme.of(context).primaryColor, - unselectedLabelColor: const Color(0xFF8E8E8E), - tabs: [ - new Tab(text: '业界动态', icon: new Icon(Icons.language)), - new Tab(text: '组件', icon: new Icon(Icons.extension)), - new Tab(text: '组件收藏', icon: new Icon(Icons.star)), - new Tab(text: '关于手册', icon: new Icon(Icons.favorite)), - ])))); + ], + ), + child: TabBar( + controller: controller, + indicatorColor: Theme.of(context).primaryColor, //tab标签的下划线颜色 + // labelColor: const Color(0xFF000000), + indicatorWeight: 3.0, + labelColor: Theme.of(context).primaryColor, + unselectedLabelColor: const Color(0xFF8E8E8E), + tabs: [ + Tab(text: '业界动态', icon: Icon(Icons.language)), + Tab(text: '组件', icon: Icon(Icons.extension)), + Tab(text: '组件收藏', icon: Icon(Icons.star)), + Tab(text: '关于手册', icon: Icon(Icons.favorite)), + ], + ), + ), + ), + ), + ); } void _onTabChange() { @@ -184,11 +186,11 @@ class _MyHomePageState extends State } } - // void _onDataChange(val) { - // if (this.mounted) { - // setState(() { - // data = val; - // }); - // } - // } +// void _onDataChange(val) { +// if (this.mounted) { +// setState(() { +// data = val; +// }); +// } +// } } diff --git a/lib/model/collection_general.dart b/lib/model/collection_general.dart new file mode 100644 index 00000000..9e23674d --- /dev/null +++ b/lib/model/collection_general.dart @@ -0,0 +1,69 @@ +/** + * Created with Android Studio. + * User: 一晟 + * Date: 2019/1/12 + * Time: 下午9:19 + * email: zhu.yan@alibaba-inc.com + */ +import 'dart:async'; +import '../common/sql.dart'; + +abstract class CollectionInterface { + String get key; + String get values; +} + +class CollectionGeneral implements CollectionInterface { + String key; + String values; + + CollectionGeneral({this.key, this.values}); + + factory CollectionGeneral.fromJSON(Map json){ + return CollectionGeneral(key: json['name'],values: json['values']); + } + + Object toMap() { + return {'key': key, 'values': values}; + } +} + +class CollectionControlModel { + final String table = 'collectionGeneral'; + Sql sql; + + CollectionControlModel() { + sql = Sql.setTable(table); + } + + // 获取所有的收藏 + + // 插入新收藏 + Future insert(CollectionGeneral collection) { + var result = + sql.insert({'key': collection.key, 'values': collection.values}); + return result; + } + + // 获取全部的收藏 + Future> getAllCollection() async { + List list = await sql.getByCondition(); + List resultList = []; + list.forEach((item){ + print(item); + resultList.add(CollectionGeneral.fromJSON(item)); + }); + return resultList; + } + + // 通过收藏名获取router + Future getRouterByName(String key) async { + List list = await sql.getByCondition(conditions: {'key': key}); + return list; + } + + // 删除 + Future deleteByName(String key) async{ + return await sql.delete(key,'key'); + } +} diff --git a/lib/views/FirstPage.dart b/lib/views/FirstPage.dart deleted file mode 100644 index 81032349..00000000 --- a/lib/views/FirstPage.dart +++ /dev/null @@ -1,78 +0,0 @@ -import 'dart:async'; -import 'package:flutter/material.dart'; -import 'package:flutter_rookie_book/common/list_view_item.dart'; -import 'package:flutter_rookie_book/components/ListRefresh.dart' as listComp; -import 'package:flutter_rookie_book/components/Pagination.dart'; -import './widgetFeature/FirstPageItem.dart'; -import '../common/net_utils.dart'; - -class FirstPage extends StatefulWidget { - @override - FirstPageState createState() => new FirstPageState(); -} - -class FirstPageState extends State with AutomaticKeepAliveClientMixin{ - - - @override - bool get wantKeepAlive => true; - - @override - void initState() { - super.initState(); - } - - Future getIndexListData([Map params]) async { - const juejin_flutter = 'https://timeline-merger-ms.juejin.im/v1/get_tag_entry?src=web&tagId=5a96291f6fb9a0535b535438'; - var pageIndex = (params is Map) ? params['pageIndex'] : 0; - final _param = {'page':pageIndex,'pageSize':20,'sort':'rankIndex'}; - - var response = await NetUtils.get(juejin_flutter, params: _param); - var responseList = response['d']['entrylist']; - var pageTotal = response['d']['total']; - if (!(pageTotal is int) || pageTotal <= 0) { - pageTotal = 0; - } - pageIndex += 1; - List resultList = new List(); - for (int i = 0; i < responseList.length; i++) { - try { - FirstPageItem cellData = new FirstPageItem.fromJson(responseList[i]); - resultList.add(cellData); - } catch (e) { - // No specified type, handles all - } - } - Map result = {"list":resultList, 'total':pageTotal, 'pageIndex':pageIndex}; - return result; - } - - Widget makeCard(index,item){ - - var myTitle = '${item.title}'; - var myUsername = '${'👲'}: ${item.username} '; - var codeUrl = '${item.detailUrl}'; - - return new ListViewItem(itemUrl:codeUrl,itemTitle: myTitle,data: myUsername,); - } - - @override - Widget build(BuildContext context) { - super.build(context); - return new Column( - children: [ - new Container( - child: new Pagination(), - ), - SizedBox(height: 2, child:Container(color: Theme.of(context).primaryColor)), - new Expanded( - //child: new List(), - child: listComp.ListRefresh(getIndexListData,makeCard) - ), - ] - - ); - } -} - - diff --git a/lib/views/detail.dart b/lib/views/detail.dart new file mode 100644 index 00000000..0677a2bc --- /dev/null +++ b/lib/views/detail.dart @@ -0,0 +1,22 @@ +import 'package:flutter/material.dart'; + +class Detail extends StatelessWidget { + + final String id ; + Detail(this.id) ; + + + @override + Widget build(BuildContext context) { + return new Scaffold( + appBar: new AppBar( + title: new Text('List Detail'), + ), + body: new Center( + child: new Text('msg:'+ 'id='+id), + ), + ) ; + } + + +} \ No newline at end of file diff --git a/lib/views/first_page.dart b/lib/views/first_page.dart new file mode 100644 index 00000000..d364b3e3 --- /dev/null +++ b/lib/views/first_page.dart @@ -0,0 +1,150 @@ +import 'dart:async'; +import 'package:flutter/material.dart'; + +import 'package:flutter_go/common/list_view_item.dart'; +import 'package:flutter_go/components/list_refresh.dart' as listComp; +import 'package:flutter_go/components/pagination.dart'; +import 'package:flutter_go/components/first_page_item.dart'; +import 'package:flutter_go/components/disclaimer_msg.dart'; +import 'package:shared_preferences/shared_preferences.dart'; + +import '../common/net_utils.dart'; + +GlobalKey key; + +class FirstPage extends StatefulWidget { + @override + FirstPageState createState() => new FirstPageState(); +} + +class FirstPageState extends State with AutomaticKeepAliveClientMixin{ + + @override + bool get wantKeepAlive => true; + + save(bool flag) async{ + //print('=============save=========$flag'); + SharedPreferences prefs = await SharedPreferences.getInstance(); + prefs.setString('disclaimer', flag.toString()); + } + + Future get() async { + var value; + SharedPreferences prefs = await SharedPreferences.getInstance(); + value = prefs.getString('disclaimer'); + return value; + } + + @override + void initState() { + super.initState(); + if(key == null) { + //print('=============111=========${key}'); + delayed(); + } + key = GlobalKey(); + + } + + /* + * 判断是否需要弹出免责声明,已经勾选过不在显示,就不会主动弹 + * */ + Future delayed() async { + await new Future.delayed(const Duration(seconds: 1)); +// if (this.mounted) { +// setState(() { +// print('test=======>${key.currentState}'); +// key.currentState.showAlertDialog(context); +// //key.currentState.init(context); +// }); +// } + Future flag = get(); + flag.then((String value) { + //print('=============get=========$value'); + if(value.toString() == 'false'){ // 如果没有勾选下次开启 + key.currentState.showAlertDialog(context); + } + }); + } + + Future getIndexListData([Map params]) async { + const juejin_flutter = 'https://timeline-merger-ms.juejin.im/v1/get_tag_entry?src=web&tagId=5a96291f6fb9a0535b535438'; + var pageIndex = (params is Map) ? params['pageIndex'] : 0; + final _param = {'page':pageIndex,'pageSize':20,'sort':'rankIndex'}; + + var response = await NetUtils.get(juejin_flutter, params: _param); + var responseList = response['d']['entrylist']; + var pageTotal = response['d']['total']; + if (!(pageTotal is int) || pageTotal <= 0) { + pageTotal = 0; + } + pageIndex += 1; + List resultList = new List(); + for (int i = 0; i < responseList.length; i++) { + try { + FirstPageItem cellData = new FirstPageItem.fromJson(responseList[i]); + resultList.add(cellData); + } catch (e) { + // No specified type, handles all + } + } + Map result = {"list":resultList, 'total':pageTotal, 'pageIndex':pageIndex}; + return result; + } + + Widget makeCard(index,item){ + + var myTitle = '${item.title}'; + var myUsername = '${'👲'}: ${item.username} '; + var codeUrl = '${item.detailUrl}'; + return new ListViewItem(itemUrl:codeUrl,itemTitle: myTitle,data: myUsername,); + } + + headerView(){ + return + Column( + children: [ + Stack( + //alignment: const FractionalOffset(0.9, 0.1),//方法一 + children: [ + Pagination(), + Positioned(//方法二 + top: 10.0, + left: 0.0, + child: DisclaimerMsg(key:key,pWidget:this) + ), + ]), + SizedBox(height: 1, child:Container(color: Theme.of(context).primaryColor)), + SizedBox(height: 10), + ], + ); + + } + + @override + Widget build(BuildContext context) { + super.build(context); + return new Column( + children: [ +// new Stack( +// //alignment: const FractionalOffset(0.9, 0.1),//方法一 +// children: [ +// Pagination(), +// Positioned(//方法二 +// top: 10.0, +// left: 0.0, +// child: DisclaimerMsg(key:key,pWidget:this) +// ), +// ]), +// SizedBox(height: 2, child:Container(color: Theme.of(context).primaryColor)), + new Expanded( + //child: new List(), + child: listComp.ListRefresh(getIndexListData,makeCard,headerView) + ) + ] + + ); + } +} + + diff --git a/lib/views/FourthPage.dart b/lib/views/fourth_page.dart similarity index 89% rename from lib/views/FourthPage.dart rename to lib/views/fourth_page.dart index c4c44af3..fc48f1db 100644 --- a/lib/views/FourthPage.dart +++ b/lib/views/fourth_page.dart @@ -1,7 +1,7 @@ import 'package:flutter/material.dart'; -import '../components/CompList.dart'; +import '../components/comp_list.dart'; class FourthPage extends StatefulWidget { diff --git a/lib/views/widgetPage.dart b/lib/views/widget_page.dart similarity index 96% rename from lib/views/widgetPage.dart rename to lib/views/widget_page.dart index c1382258..baa6666b 100644 --- a/lib/views/widgetPage.dart +++ b/lib/views/widget_page.dart @@ -5,7 +5,7 @@ * @Last Modified time: 2019-01-11 14:40:09 */ import 'package:flutter/material.dart'; -import 'widgetPage/cate_card.dart'; +import 'package:flutter_go/components/cate_card.dart'; import '../model/cat.dart'; class WidgetPage extends StatefulWidget { diff --git a/lib/widgets/components/Bar/AppBar/demo.dart b/lib/widgets/components/Bar/AppBar/demo.dart index d737f8d9..c17eb6e0 100644 --- a/lib/widgets/components/Bar/AppBar/demo.dart +++ b/lib/widgets/components/Bar/AppBar/demo.dart @@ -10,8 +10,8 @@ import 'package:flutter/material.dart'; /* -* Checkbox 默认按钮的实例 -* index 当前checkbox 的索引值 +* 默认 AppBar 的实例 +* index 当前AppBar 的索引值 * */ class AppBarLessDefaultComplex extends StatefulWidget { const AppBarLessDefaultComplex() : super(); diff --git a/lib/widgets/components/Bar/AppBar/index.dart b/lib/widgets/components/Bar/AppBar/index.dart index 372dc873..eda42fc0 100644 --- a/lib/widgets/components/Bar/AppBar/index.dart +++ b/lib/widgets/components/Bar/AppBar/index.dart @@ -6,8 +6,8 @@ * email: zhu.yan@alibaba-inc.com * tartget: AppBar 的示例 */ -import '../../../../common/widget-demo.dart'; -import '../../../../routers/application.dart'; +import '../../../../common/widget_demo.dart'; + import 'package:flutter/material.dart'; import 'package:flutter_markdown/flutter_markdown.dart'; @@ -16,23 +16,24 @@ import './demo.dart' as AppBarDemo; const String _Text0 = """### **简介** > AppBar “应用栏” -- 应用栏由工具栏和可能的其他 widget 组成,例如 TabBar和FlexibleSpaceBar。 -- 应用栏通常用于 Scaffold.appBa r属性,该属性将应用栏放置在屏幕顶部的固定高度小部件中。 -- 对于可滚动的应用栏,请参阅SliverAppBar,它将AppBar嵌入 sliver 中以便在CustomScrollView中使用。 +- 应用栏由工具栏组成,或者是工具栏和其他 widget 组合形成,例如 TabBar和FlexibleSpaceBar; +- 应用栏通常用于 Scaffold.appBar 属性,该属性将应用栏放置在屏幕顶部的固定高度小部件中; +- 对于可滚动的应用栏,请参阅SliverAppBar,它将AppBar嵌入 sliver 中以便在CustomScrollView中使用; """; const String _Text1 = """### **基本用法** > AppBar -- AppBar 在底部上方显示工具栏 widget,前导 leading ,标题 title 和操作 actions。 +- AppBar 在底部上方显示工具栏 widget,前导 leading ,标题 title 和操作 actions; """; const String _Text2 = """### **进阶用法** > AppBar -- 一个完整的 AppBar 的例子, 增加 PopupMenuButton,TabBar 的示例子。 -- 所述底部通常用于一个的TabBar。如果指定了flexibleSpace窗口小部件,则它将堆叠在工具栏和底部窗口 widget 后面。 +- 一个完整的 AppBar 的例子, 增加 PopupMenuButton,TabBar 的示例子; +- 所述底部通常用于一个的 TabBar; +- 如果指定了 flexibleSpace 窗口 widget,则它将堆叠在工具栏和底部窗口 widget 后面; """; class Demo extends StatefulWidget { @@ -47,8 +48,8 @@ class _DemoState extends State { Widget build(BuildContext context) { return WidgetDemo( title: 'AppBar', - codeUrl: '${Application.github['widgetsURL']}componentss/Bar/AppBar/demo.dart', - child: allCheckboxs(context, this), + codeUrl: 'componentss/Bar/AppBar/demo.dart', + contentList: [allDomes(context, this)], docUrl: 'https://docs.flutter.io/flutter/material/AppBar-class.html', ); } @@ -59,7 +60,7 @@ class _DemoState extends State { * context: 运行上下文 * that: 指向有状态的 StatefulWidget */ -Widget allCheckboxs(BuildContext context, _DemoState that) { +Widget allDomes(BuildContext context, _DemoState that) { return Container( //padding: new EdgeInsets.only(bottom: 20.0, top: 20.0, left: 0, right: 0), child: Column( diff --git a/lib/widgets/components/Bar/BottomAppBar/index.dart b/lib/widgets/components/Bar/BottomAppBar/index.dart index 4efdd279..4e70c2f6 100644 --- a/lib/widgets/components/Bar/BottomAppBar/index.dart +++ b/lib/widgets/components/Bar/BottomAppBar/index.dart @@ -6,8 +6,8 @@ * email: zhu.yan@alibaba-inc.com * tartget: BottomAppBar 的示例 */ -import '../../../../common/widget-demo.dart'; -import '../../../../routers/application.dart'; +import '../../../../common/widget_demo.dart'; + import 'package:flutter/material.dart'; import 'package:flutter_markdown/flutter_markdown.dart'; @@ -16,13 +16,13 @@ import './demo.dart' as BottomAppBarDemo; const String _Text0 = """### **简介** > BottomAppBar “底部应用栏” -- 一个通常与 Scaffold.bottomNavigationBar 一起使用的容器,可以在顶部有一个凹口,为重叠的FloatingActionButton腾出空间 。 +- 一个通常与 Scaffold.bottomNavigationBar 一起使用的容器,可以在顶部有一个凹口,为重叠的FloatingActionButton腾出空间; """; const String _Text1 = """### **基本用法** -> 通常与Scaffold和FloatingActionButton一起使用。 +> 通常与 Scaffold 和 FloatingActionButton 一起使用; """; @@ -38,8 +38,8 @@ class _DemoState extends State { Widget build(BuildContext context) { return WidgetDemo( title: 'BottomAppBar', - codeUrl: '${Application.github['widgetsURL']}componentss/Bar/BottomAppBar/demo.dart', - child: allCheckboxs(context, this), + codeUrl: 'componentss/Bar/BottomAppBar/demo.dart', + contentList: [allDomes(context, this)], docUrl: 'https://docs.flutter.io/flutter/material/BottomAppBar-class.html', ); } @@ -50,7 +50,7 @@ class _DemoState extends State { * context: 运行上下文 * that: 指向有状态的 StatefulWidget */ -Widget allCheckboxs(BuildContext context, _DemoState that) { +Widget allDomes(BuildContext context, _DemoState that) { return Container( //padding: new EdgeInsets.only(bottom: 20.0, top: 20.0, left: 0, right: 0), child: Column( diff --git a/lib/widgets/components/Bar/ButtonBar/demo.dart b/lib/widgets/components/Bar/ButtonBar/demo.dart index d7234140..0ce89f0b 100644 --- a/lib/widgets/components/Bar/ButtonBar/demo.dart +++ b/lib/widgets/components/Bar/ButtonBar/demo.dart @@ -10,8 +10,7 @@ import 'package:flutter/material.dart'; /* -* Checkbox 默认按钮的实例 -* index 当前checkbox 的索引值 +* ButtonBar 默认的实例 * */ class ButtonBarFullDefault extends StatefulWidget { const ButtonBarFullDefault() : super(); diff --git a/lib/widgets/components/Bar/ButtonBar/index.dart b/lib/widgets/components/Bar/ButtonBar/index.dart index d57f9a11..bce2b1ce 100644 --- a/lib/widgets/components/Bar/ButtonBar/index.dart +++ b/lib/widgets/components/Bar/ButtonBar/index.dart @@ -6,8 +6,8 @@ * email: zhu.yan@alibaba-inc.com * tartget: ButtonBar 的示例 */ -import '../../../../common/widget-demo.dart'; -import '../../../../routers/application.dart'; +import '../../../../common/widget_demo.dart'; + import 'package:flutter/material.dart'; import 'package:flutter_markdown/flutter_markdown.dart'; @@ -22,8 +22,10 @@ const String _Text0 = const String _Text1 = """### **基本用法** -> 根据当前ButtonTheme中的填充水平放置按钮 。子 button 在布置行与 MainAxisAlignment.end -- 当Directionality为TextDirection.ltr时,按钮栏的子项右对齐,最后一个子项成为最右边的子项。当Directionality TextDirection.rtl时,子项被左对齐,最后一个子项成为最左边的子项。 +> 根据当前 ButtonTheme 中的填充水平放置 button +- 子 button 在布置行与 MainAxisAlignment.end; +- 当 Directionality为TextDirection.ltr 时,按钮栏的子项右对齐,最后一个子项成为最右边的子项; +- 当 Directionality TextDirection.rtl 时,子项被左对齐,最后一个子项成为最左边的子项; """; @@ -39,9 +41,8 @@ class _DemoState extends State { Widget build(BuildContext context) { return WidgetDemo( title: 'ButtonBar', - codeUrl: '${Application - .github['widgetsURL']}componentss//Bar/ButtonBar/demo.dart', - child: allCheckboxs(context, this), + codeUrl: 'components/Bar/ButtonBar/demo.dart', + contentList: [allDomes(context, this)], docUrl: 'https://docs.flutter.io/flutter/material/ButtonBar-class.html', ); } @@ -52,7 +53,7 @@ class _DemoState extends State { * context: 运行上下文 * that: 指向有状态的 StatefulWidget */ -Widget allCheckboxs(BuildContext context, _DemoState that) { +Widget allDomes(BuildContext context, _DemoState that) { return Container( //padding: new EdgeInsets.only(bottom: 20.0, top: 20.0, left: 0, right: 0), child: Column( diff --git a/lib/widgets/components/Bar/FlexibleSpaceBar/demo.dart b/lib/widgets/components/Bar/FlexibleSpaceBar/demo.dart index 2b9c7d17..ca1aeb8b 100644 --- a/lib/widgets/components/Bar/FlexibleSpaceBar/demo.dart +++ b/lib/widgets/components/Bar/FlexibleSpaceBar/demo.dart @@ -11,8 +11,7 @@ import 'package:flutter/material.dart'; /* -* Checkbox 默认按钮的实例 -* index 当前checkbox 的索引值 +* Checkbox 默认FlexibleSpaceBar的实例 * */ class FlexibleSpaceBarFullDefault extends StatefulWidget { const FlexibleSpaceBarFullDefault() : super(); diff --git a/lib/widgets/components/Bar/FlexibleSpaceBar/index.dart b/lib/widgets/components/Bar/FlexibleSpaceBar/index.dart index ff80c04d..d6dbc972 100644 --- a/lib/widgets/components/Bar/FlexibleSpaceBar/index.dart +++ b/lib/widgets/components/Bar/FlexibleSpaceBar/index.dart @@ -6,8 +6,8 @@ * email: zhu.yan@alibaba-inc.com * tartget: FlexibleSpaceBar 的示例 */ -import '../../../../common/widget-demo.dart'; -import '../../../../routers/application.dart'; +import '../../../../common/widget_demo.dart'; + import 'package:flutter/material.dart'; import 'package:flutter_markdown/flutter_markdown.dart'; @@ -16,15 +16,15 @@ import './demo.dart' as FlexibleSpaceBarDemo; const String _Text0 = """### **简介** > FlexibleSpaceBar “扩展和折叠的应用栏” -- AppBar的一部分,可以扩展和折叠。 +- AppBar 的一部分,可以扩展和折叠; """; const String _Text1 = """### **基本用法** > 最常用于 SliverAppBar.flexibleSpace 字段 -- 灵活的空格键随着应用滚动而扩展和收缩,以便AppBar 从应用程序的顶部到达应用程序滚动内容的顶部。 -- 要调整 AppBar 大小,必须将其包装在 FlexibleSpaceBar.createSettings 返回的 widget 中 ,以将大小调整信息传递给 FlexibleSpaceBar。 +- 灵活的空格键随着应用滚动而扩展和收缩,以便 AppBar 从应用程序的顶部到达应用程序滚动内容的顶部; +- 要调整 AppBar 大小,必须将其包装在 FlexibleSpaceBar.createSettings 返回的 widget 中 ,以将大小调整信息传递给 FlexibleSpaceBar; """; @@ -40,9 +40,8 @@ class _DemoState extends State { Widget build(BuildContext context) { return WidgetDemo( title: 'FlexibleSpaceBar', - codeUrl: '${Application - .github['widgetsURL']}componentss/Bar/FlexibleSpaceBar/demo.dart', - child: allCheckboxs(context, this), + codeUrl: 'components/Bar/FlexibleSpaceBar/demo.dart', + contentList: [allDomes(context, this)], docUrl: 'https://docs.flutter.io/flutter/material/FlexibleSpaceBar-class.html', ); } @@ -53,7 +52,7 @@ class _DemoState extends State { * context: 运行上下文 * that: 指向有状态的 StatefulWidget */ -Widget allCheckboxs(BuildContext context, _DemoState that) { +Widget allDomes(BuildContext context, _DemoState that) { return Container( //padding: new EdgeInsets.only(bottom: 20.0, top: 20.0, left: 0, right: 0), child: Column( diff --git a/lib/widgets/components/Bar/SliverAppBar/demo.dart b/lib/widgets/components/Bar/SliverAppBar/demo.dart index f843b00d..3bc2c5fb 100644 --- a/lib/widgets/components/Bar/SliverAppBar/demo.dart +++ b/lib/widgets/components/Bar/SliverAppBar/demo.dart @@ -10,8 +10,7 @@ import 'package:flutter/material.dart'; /* -* Checkbox 默认按钮的实例 -* index 当前checkbox 的索引值 +* 默认 SliverAppBar 的实例 * */ class SliverAppBarFullDefault extends StatefulWidget { const SliverAppBarFullDefault() : super(); diff --git a/lib/widgets/components/Bar/SliverAppBar/index.dart b/lib/widgets/components/Bar/SliverAppBar/index.dart index acd001cf..4205f09d 100644 --- a/lib/widgets/components/Bar/SliverAppBar/index.dart +++ b/lib/widgets/components/Bar/SliverAppBar/index.dart @@ -6,8 +6,8 @@ * email: zhu.yan@alibaba-inc.com * tartget: SliverAppBar 的示例 */ -import '../../../../common/widget-demo.dart'; -import '../../../../routers/application.dart'; +import '../../../../common/widget_demo.dart'; + import 'package:flutter/material.dart'; import 'package:flutter_markdown/flutter_markdown.dart'; @@ -16,16 +16,16 @@ import './demo.dart' as SliverAppBarDemo; const String _Text0 = """### **简介** > SliverAppBar “应用栏” -- 它类似于Android中的toolbar。 +- 它类似于Android中的toolbar; """; const String _Text1 = """### **基本用法** -> 虽然基本相同,构造方法也是非常的简单,但是却不能直接使用它,由官方文档可以看到通常结合ScrollView来使用它。 -- AppBar 和 SliverAppBar 都是继承StatefulWidget 类,都代表 Toobar。 -- 二者的区别在于 AppBar 位置的固定的应用最上面的;而 SliverAppBar 是可以跟随内容滚动的。 -- 下面的示例,放在 NestedScrollView 实现上提到顶的悬停。 +> 虽然基本相同,构造方法也是非常的简单,但是却不能直接使用它,由官方文档可以看到通常结合 ScrollView 来使用它; +- AppBar 和 SliverAppBar 都是继承StatefulWidget 类,都代表 Toobar; +- 二者的区别在于 AppBar 位置的固定的应用最上面的;而 SliverAppBar 是可以跟随内容滚动的; +- 下面的示例,放在 NestedScrollView 实现上提到顶的悬停; """; class Demo extends StatefulWidget { @@ -40,8 +40,8 @@ class _DemoState extends State { Widget build(BuildContext context) { return WidgetDemo( title: 'SliverAppBar', - codeUrl: '${Application.github['widgetsURL']}componentss/Bar/SliverAppBar/demo.dart', - child: allCheckboxs(context, this), + codeUrl: 'componentss/Bar/SliverAppBar/demo.dart', + contentList:[allDomes(context, this)], docUrl: 'https://docs.flutter.io/flutter/widgets/SliverAppBar-class.html', ); } @@ -52,7 +52,7 @@ class _DemoState extends State { * context: 运行上下文 * that: 指向有状态的 StatefulWidget */ -Widget allCheckboxs(BuildContext context, _DemoState that) { +Widget allDomes(BuildContext context, _DemoState that) { return Container( //padding: new EdgeInsets.only(bottom: 20.0, top: 20.0, left: 0, right: 0), child: Column( diff --git a/lib/widgets/components/Bar/SnackBar/demo.dart b/lib/widgets/components/Bar/SnackBar/demo.dart index 82451572..d4413982 100644 --- a/lib/widgets/components/Bar/SnackBar/demo.dart +++ b/lib/widgets/components/Bar/SnackBar/demo.dart @@ -10,7 +10,6 @@ import 'package:flutter/material.dart'; - /* * SnackBar 默认的实例,无状态 * */ diff --git a/lib/widgets/components/Bar/SnackBar/index.dart b/lib/widgets/components/Bar/SnackBar/index.dart index 6b9ac9c9..4e7adbb2 100644 --- a/lib/widgets/components/Bar/SnackBar/index.dart +++ b/lib/widgets/components/Bar/SnackBar/index.dart @@ -6,8 +6,8 @@ * email: zhu.yan@alibaba-inc.com * tartget: SnackBar 的示例 */ -import '../../../../common/widget-demo.dart'; -import '../../../../routers/application.dart'; +import '../../../../common/widget_demo.dart'; + import 'package:flutter/material.dart'; import 'package:flutter_markdown/flutter_markdown.dart'; @@ -16,14 +16,14 @@ import './demo.dart' as SnackBarDemo; const String _Text0 = """### **简介** > SnackBar “屏幕底部消息” -- 带有可选操作的轻量级消息,短暂显示在屏幕底部。 -- SnackBar是用户操作后,显示提示信息的一个控件,类似Toast,会自动隐藏。 +- 带有可选操作的轻量级消息,短暂显示在屏幕底部 +- SnackBar是用户操作后,显示提示信息的一个控件,类似Toast,会自动隐藏; """; const String _Text1 = """### **基本用法** -> Scaffold.of(context).showSnackBar(),传递描述消息的SnackBar实例。 +> Scaffold.of(context).showSnackBar(),传递描述消息的 SnackBar 实例; - 要控制SnackBar保持可见的时间,请指定持续时间。 """; @@ -40,8 +40,8 @@ class _DemoState extends State { Widget build(BuildContext context) { return WidgetDemo( title: 'SnackBar', - codeUrl: '${Application.github['widgetsURL']}componentss/Bar/SnackBar/demo.dart', - child: allCheckboxs(context, this), + codeUrl: 'componentss/Bar/SnackBar/demo.dart', + contentList: [allDomes(context, this)], docUrl: 'https://docs.flutter.io/flutter/material/SnackBar-class.html', ); } @@ -52,7 +52,7 @@ class _DemoState extends State { * context: 运行上下文 * that: 指向有状态的 StatefulWidget */ -Widget allCheckboxs(BuildContext context, _DemoState that) { +Widget allDomes(BuildContext context, _DemoState that) { return Container( //padding: new EdgeInsets.only(bottom: 20.0, top: 20.0, left: 0, right: 0), child: Column( diff --git a/lib/widgets/components/Bar/SnackBarAction/index.dart b/lib/widgets/components/Bar/SnackBarAction/index.dart index bd4f62a0..4d213c0c 100644 --- a/lib/widgets/components/Bar/SnackBarAction/index.dart +++ b/lib/widgets/components/Bar/SnackBarAction/index.dart @@ -14,11 +14,11 @@ const String _Text0 = """ ### **简介** > SnackBarAction “屏幕底部消息右侧可操作的行为” -带有可选操作的轻量级消息,短暂显示在屏幕底部, 并提供按钮交互。 +- 带有可选操作的轻量级消息,短暂显示在屏幕底部, 并提供按钮交互。 ### **基本用法** -> 为SnackBar加入action[SnackBarAction]显示按区, 默认下是隐藏的. +> 为SnackBar加入action[SnackBarAction]显示按区, 默认下是隐藏的 """; diff --git a/lib/widgets/components/Bar/TabBar/index.dart b/lib/widgets/components/Bar/TabBar/index.dart index 78270cad..bb2b364d 100644 --- a/lib/widgets/components/Bar/TabBar/index.dart +++ b/lib/widgets/components/Bar/TabBar/index.dart @@ -15,7 +15,7 @@ const String _Text0 = """ ### **简介** > SnackBarAction 来实现并行界面的横向滑动展示 -TabBar,是材料设计中很常用的一种横向标签. 来实现并行界面的横向滑动展示,在Flutter的世界中,TabBar有着相同的作用。通常,我们会在AppBar的底部部分结合TabBarView来使用TabBar。 +- TabBar,是材料设计中很常用的一种横向标签. 来实现并行界面的横向滑动展示,在Flutter的世界中,TabBar有着相同的作用。通常,我们会在AppBar的底部部分结合TabBarView来使用TabBar; diff --git a/lib/widgets/components/Card/Card/demo.dart b/lib/widgets/components/Card/Card/demo.dart index b15a94a1..107a6bd5 100644 --- a/lib/widgets/components/Card/Card/demo.dart +++ b/lib/widgets/components/Card/Card/demo.dart @@ -10,8 +10,7 @@ import 'package:flutter/material.dart'; /* -* Checkbox 默认按钮的实例 -* index 当前checkbox 的索引值 +* Checkbox 默认Card的实例 * */ class CardFullDefault extends StatefulWidget { const CardFullDefault() : super(); diff --git a/lib/widgets/components/Card/Card/index.dart b/lib/widgets/components/Card/Card/index.dart index e9d5fc70..0ee2d452 100644 --- a/lib/widgets/components/Card/Card/index.dart +++ b/lib/widgets/components/Card/Card/index.dart @@ -6,8 +6,8 @@ * email: zhu.yan@alibaba-inc.com * tartget: Card 的示例 */ -import '../../../../common/widget-demo.dart'; -import '../../../../routers/application.dart'; +import '../../../../common/widget_demo.dart'; + import 'package:flutter/material.dart'; import 'package:flutter_markdown/flutter_markdown.dart'; @@ -16,7 +16,7 @@ import './demo.dart' as CardDemo; const String _Text0 = """### **简介** > Card “卡片” -- 卡片是用于表示一些相关信息的一张材料,例如相册,地理位置,用餐,联系方式等 +- 卡片用于表示一些相关信息,例如相册,地理位置,用餐,联系方式等 """; @@ -38,9 +38,8 @@ class _DemoState extends State { Widget build(BuildContext context) { return WidgetDemo( title: 'Card', - codeUrl: '${Application - .github['widgetsURL']}componentss/Card/Card/demo.dart', - child: allCheckboxs(context, this), + codeUrl: 'components/Card/Card/demo.dart', + contentList: [allDomes(context, this)], docUrl: 'https://docs.flutter.io/flutter/material/Card-class.html', ); } @@ -51,7 +50,7 @@ class _DemoState extends State { * context: 运行上下文 * that: 指向有状态的 StatefulWidget */ -Widget allCheckboxs(BuildContext context, _DemoState that) { +Widget allDomes(BuildContext context, _DemoState that) { return Container( //padding: new EdgeInsets.only(bottom: 20.0, top: 20.0, left: 0, right: 0), child: Column( diff --git a/lib/widgets/components/Chip/ChipThemeData/index.dart b/lib/widgets/components/Chip/ChipThemeData/index.dart index 11cef164..908b4c6f 100644 --- a/lib/widgets/components/Chip/ChipThemeData/index.dart +++ b/lib/widgets/components/Chip/ChipThemeData/index.dart @@ -17,7 +17,7 @@ const String content0 = ''' const String content1 = ''' ### **基本用法** - 创建ChipThemeData最简单的方法是使用copyWith您从得到一个ChipTheme.of, -或创建一个全新的一个具有 ChipThemeData..fromDefaults。。 +或创建一个全新的一个具有 ChipThemeData..fromDefaults '''; class Demo extends StatefulWidget { diff --git a/lib/widgets/components/Chip/FilterChip/index.dart b/lib/widgets/components/Chip/FilterChip/index.dart index b8976379..a7a7db79 100644 --- a/lib/widgets/components/Chip/FilterChip/index.dart +++ b/lib/widgets/components/Chip/FilterChip/index.dart @@ -11,7 +11,7 @@ import 'demo.dart'; const String content0 = ''' ### **简介** > 通过使用标签或者描述性词语来过滤内容 -- FilterChip是checkbox或switch widget 的替换品。 +- FilterChip 是 checkbox 或 switch widget 的替换品。 '''; const String content1 = ''' diff --git a/lib/widgets/components/Dialog/AboutDialog/index.dart b/lib/widgets/components/Dialog/AboutDialog/index.dart index 47d1bfca..6b88c60c 100644 --- a/lib/widgets/components/Dialog/AboutDialog/index.dart +++ b/lib/widgets/components/Dialog/AboutDialog/index.dart @@ -13,12 +13,13 @@ import 'demo.dart'; const String _Text0 = """ ### **简介** > AboutDialog 通常用于传递企业或者app的官方信息 - +- 这个对话框包含应用程序的图标,名称,版本号,版权和应用程序使用到的软件许可证的按钮 ### **基本用法** - -> 通常作为子窗口小部件传递给showDialog,后者显示对话框。 +> 要显示的AboutDialog,使用showAboutDialog。 +- 如果应用程序具有Drawer,则AboutListTile可以使显示AboutDialog的过程更简单。 +- AboutDialog通过showAboutDialog 显示按钮调用 showLicensePage。 """; diff --git a/lib/widgets/components/Dialog/AlertDialog/index.dart b/lib/widgets/components/Dialog/AlertDialog/index.dart index 4022860c..e9364564 100644 --- a/lib/widgets/components/Dialog/AlertDialog/index.dart +++ b/lib/widgets/components/Dialog/AlertDialog/index.dart @@ -12,18 +12,14 @@ import 'demo.dart'; const String _Text0 = """ ### **简介** -> AlertDialog 向用户传递信息的弹出层。 - - +> AlertDialog 向用户传递信息的弹出层。警报对话框 +- 一般使用在通知用户需要确认的情况,具有可选标题和可选的操纵列表。标题显示在上方,操纵内容显示在内容区域,即下方 ### **基本用法** - > 通常作为子窗口小部件传递给showDialog,后者显示对话框。 - -当**AlertDialog**的的元素过多过长时, 请优先考虑**SingleChildScrollView** 用来避免内容溢出 - - - +- 当**AlertDialog**的的元素过多过长时, 请优先考虑**SingleChildScrollView** 用来避免内容溢出 +- 需要注意的是,由于AlertDialog 通常使用child的大小来调整自身大小,所以使用一些widget(如ListView,GridView和CustomScrollView)将无法正常工作 +- 当需要给用户提供多个选项的供选择时,请使用SimpleDialog """; diff --git a/lib/widgets/components/Dialog/Dialog/demo.dart b/lib/widgets/components/Dialog/Dialog/demo.dart index b2911327..4f7f3818 100644 --- a/lib/widgets/components/Dialog/Dialog/demo.dart +++ b/lib/widgets/components/Dialog/Dialog/demo.dart @@ -22,7 +22,21 @@ class _Demo extends State { barrierDismissible: false, // user must tap button! builder: (BuildContext context) { return Dialog( - child: Text("我是一个Dialog"), + child: Container( + height: 100, + child: Column( + mainAxisAlignment: MainAxisAlignment.spaceAround, + children: [ + Text('我是一个dialog'), + RaisedButton( + child: Text('取消'), + onPressed: () { + Navigator.of(context).pop(); + }, + ) + ], + ), + ) ); }, ); @@ -63,15 +77,30 @@ class _DialogMoreDemo extends State { return StatefulBuilder( builder: (context, state) { return Dialog( - child: RaisedButton( - onPressed: () { - print("print $value"); - state(() { - value += 1; - }); - }, - child: Text("我是一个Dialog, 点我更新value: $value"), - ) + child: Container( + height: 150, + child: Column( + mainAxisAlignment: MainAxisAlignment.spaceAround, + children: [ + Text('我是一个dialog'), + RaisedButton( + onPressed: () { + state(() { + value += 1; + }); + }, + child: Text("我是一个Dialog, 点我更新value: $value"), + ), + RaisedButton( + onPressed: () { + Navigator.of(context).pop(); + }, + child: Text("取消"), + ) + ], + ), + ), + ); } ); diff --git a/lib/widgets/components/Dialog/Dialog/index.dart b/lib/widgets/components/Dialog/Dialog/index.dart index 268802f1..626cdc92 100644 --- a/lib/widgets/components/Dialog/Dialog/index.dart +++ b/lib/widgets/components/Dialog/Dialog/index.dart @@ -12,17 +12,14 @@ import 'demo.dart'; const String _Text0 = """ ### **简介** -> AlertDialog 向用户传递信息的弹出层。 - -这个组件没有任何可操作的选项. 相比使用这个组件, 通常我们更喜欢使用 **AlertDialog**或者**SimpleDialog** +> Dialog 向用户传递信息的弹出层。 +-这个组件没有任何可操作的选项. 相比使用这个组件, 通常我们更喜欢使用 **AlertDialog**或者**SimpleDialog** ### **基本用法** - > 通常作为子窗口小部件传递给showDialog,后者显示对话框。 - """; const String _Text1 = """ diff --git a/lib/widgets/components/Dialog/SimpleDialog/index.dart b/lib/widgets/components/Dialog/SimpleDialog/index.dart index 641b9e5a..4f607d73 100644 --- a/lib/widgets/components/Dialog/SimpleDialog/index.dart +++ b/lib/widgets/components/Dialog/SimpleDialog/index.dart @@ -13,12 +13,15 @@ import 'demo.dart'; const String _Text0 = """ ### **简介** > SimpleDialog 是一个用于向用户传递确定信息并提供选项的弹出层 +- SimpleDialog 可为用户提供多个选项选择。有一个可选的标题,显示在选项上方 ### **基本用法** > 通常作为子窗口小部件传递给showDialog,后者显示对话框。 +- 选择通常使用SimpleDialogOption表示 +- 对于通知用户情况的对话框,请考虑使用 AlertDialog。 """; diff --git a/lib/widgets/components/Grid/GridPaper/demo.dart b/lib/widgets/components/Grid/GridPaper/demo.dart new file mode 100644 index 00000000..5a0f17e8 --- /dev/null +++ b/lib/widgets/components/Grid/GridPaper/demo.dart @@ -0,0 +1,62 @@ +/** + * Created with Android Studio. + * User: 三帆 + * Date: 07/01/2019 + * Time: 10:31 + * email: sanfan.hx@alibaba-inc.com + * tartget: xxx + */ + +import 'package:flutter/material.dart'; + + +class GridPaperDemo extends StatefulWidget { + _Demo createState() => _Demo(); +} + +class _Demo extends State { + + + Widget build(BuildContext context) { + return Container( + height: 400, + color: Color(0xffc91b3a), + child: new GridView.count( + crossAxisCount: 2, + mainAxisSpacing: 10.0, + crossAxisSpacing: 4.0, + padding: const EdgeInsets.all(4.0), + childAspectRatio: 1.3, + children: [ + GridTile( + header: GridTileBar( + title: Text('title'), + subtitle: Text('subtitle'), + leading: Icon(Icons.add), + trailing: Text("trailing"), + ), + child: Container(), + + ), + GridPaper( + color: Colors.red, + child: new Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover), + ), + new Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover), + new Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover), + new Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover), + new Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover), + new Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover), + new Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover), + new Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover), + new Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover), + new Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover), + new Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover), + new Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover), + new Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover), + new Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover), + ], + ) + ); + } +} diff --git a/lib/widgets/components/Grid/GridPaper/index.dart b/lib/widgets/components/Grid/GridPaper/index.dart new file mode 100644 index 00000000..1044d44a --- /dev/null +++ b/lib/widgets/components/Grid/GridPaper/index.dart @@ -0,0 +1,44 @@ +/** + * Created with Android Studio. + * User: 三帆 + * Date: 07/01/2019 + * Time: 10:26 + * email: sanfan.hx@alibaba-inc.com + * tartget: xxx + */ +import '../../../../common/widget_demo.dart'; +import 'package:flutter/material.dart'; +import 'demo.dart'; + +const String _Text0 = """ +### **简介** +> GridViewPaper是GridView中的item的一种展现形式, 会在上层浮现一层网络. + +"""; + + + +class Demo extends StatefulWidget { + static const String routeName = '/components/Grid/GridPaper'; + + @override + _DemoState createState() => _DemoState(); +} + +class _DemoState extends State { + @override + Widget build(BuildContext context) { + return WidgetDemo( + title: 'GridPaper', + codeUrl: 'components/Grid/GridPaper/demo.dart', + contentList: [ + _Text0, + GridPaperDemo(), + SizedBox( + height: 100.0, + ) + ], + docUrl: 'https://docs.flutter.io/flutter/material/GridPaper-class.html', + ); + } +} diff --git a/lib/widgets/components/Grid/GridView/index.dart b/lib/widgets/components/Grid/GridView/index.dart index 45b75165..dac9fcd2 100644 --- a/lib/widgets/components/Grid/GridView/index.dart +++ b/lib/widgets/components/Grid/GridView/index.dart @@ -12,12 +12,41 @@ import 'demo.dart'; const String _Text0 = """ ### **简介** -> GridView 通常用来做GridTile的header与footer组件; +> GridView在移动端上非常的常见的滚动列表, 会占满给出的空间区域. ### **基本用法** -> 1231 +> 创建一个列表 + +属性介绍 + +- scrollDirection:滚动的方向,有垂直和水平两种,默认为垂直方向(Axis.vertical)。 + +- reverse:默认是从上或者左向下或者右滚动的,这个属性控制是否反向,默认值为false,不反向滚动。 + +- controller:控制child滚动时候的位置。 + +- primary:是否是与父节点的PrimaryScrollController所关联的主滚动视图。 + +- physics:滚动的视图如何响应用户的输入。 + +- shrinkWrap:滚动方向的滚动视图内容是否应该由正在查看的内容所决定。 + +- padding:四周的空白区域。 + +- gridDelegate:控制GridView中子节点布局的delegate。 + +- cacheExtent:缓存区域。 + +### **进阶用法** + +> GridView 提供其他四种构造方法 + +- GridView.builder +- GridView.custom +- GridView.count +- GridView.extent """; @@ -33,11 +62,14 @@ class _DemoState extends State { @override Widget build(BuildContext context) { return WidgetDemo( - title: 'GridTileBar', + title: 'GridView', codeUrl: 'components/Grid/GridView/demo.dart', contentList: [ _Text0, GridTileDemo(), + SizedBox( + height: 100.0, + ) ], docUrl: 'https://docs.flutter.io/flutter/material/GridView-class.html', ); diff --git a/lib/widgets/components/Grid/SliverGrid/demo.dart b/lib/widgets/components/Grid/SliverGrid/demo.dart new file mode 100644 index 00000000..8950e17f --- /dev/null +++ b/lib/widgets/components/Grid/SliverGrid/demo.dart @@ -0,0 +1,63 @@ +/** + * Created with Android Studio. + * User: 三帆 + * Date: 07/01/2019 + * Time: 10:31 + * email: sanfan.hx@alibaba-inc.com + * tartget: xxx + */ + +import 'package:flutter/material.dart'; + + +class SliverGridDemo extends StatefulWidget { + _Demo createState() => _Demo(); +} + +class _Demo extends State { + + Widget showCustomScrollView() { + return new CustomScrollView( + slivers: [ + new SliverGrid( + gridDelegate: new SliverGridDelegateWithMaxCrossAxisExtent( + maxCrossAxisExtent: 200.0, + mainAxisSpacing: 10.0, + crossAxisSpacing: 10.0, + childAspectRatio: 4.0, + ), + delegate: new SliverChildBuilderDelegate( + (BuildContext context, int index) { + return new Container( + alignment: Alignment.center, + color: Colors.cyan[100 * (index % 5)], + child: new Text('grid item $index'), + ); + }, + childCount: 20, + ), + ), +// new SliverFixedExtentList( +// itemExtent: 100.0, +// delegate: new SliverChildBuilderDelegate( +// (BuildContext context, int index) { +// return new Container( +// alignment: Alignment.center, +// color: Colors.lightBlue[100 * (index % 9)], +// child: new Text('list item $index'), +// ); +// }, +// ), +// ), + ], + ); + } + + Widget build(BuildContext context) { + return Container( + height: 400, + color: Color(0xffc91b3a), + child: showCustomScrollView() + ); + } +} diff --git a/lib/widgets/components/Grid/SliverGrid/index.dart b/lib/widgets/components/Grid/SliverGrid/index.dart new file mode 100644 index 00000000..6b8c2a6a --- /dev/null +++ b/lib/widgets/components/Grid/SliverGrid/index.dart @@ -0,0 +1,54 @@ +/** + * Created with Android Studio. + * User: 三帆 + * Date: 07/01/2019 + * Time: 10:26 + * email: sanfan.hx@alibaba-inc.com + * tartget: xxx + */ +import '../../../../common/widget_demo.dart'; +import 'package:flutter/material.dart'; +import 'demo.dart'; + +const String _Text0 = """ +### **简介** +> SliverGrid 将多个item以每行二个的形式, 进行排列. + +### **基本用法** + +> 创建 + +在排列列表时,将基于现有的小部件, 延迟创建可见子项的元素、状态和呈现对象。 也就是只有视口中的元素, 才会被创建, 类似于我们网页中的懒加载. + +> 销毁 + +当元素滚动到视图之外时,关联的元素子树、状态和渲染对象将被销毁, 进入视觉窗口的元素将以懒加载的形式进行创建。 + +"""; + + + +class Demo extends StatefulWidget { + static const String routeName = '/components/Grid/SliverGrid'; + + @override + _DemoState createState() => _DemoState(); +} + +class _DemoState extends State { + @override + Widget build(BuildContext context) { + return WidgetDemo( + title: 'SliverGrid', + codeUrl: 'components/Grid/GridPaper/demo.dart', + contentList: [ + _Text0, + SliverGridDemo(), + SizedBox( + height: 100.0, + ) + ], + docUrl: 'https://docs.flutter.io/flutter/material/SliverGrid-class.html', + ); + } +} diff --git a/lib/widgets/components/Grid/index.dart b/lib/widgets/components/Grid/index.dart index 0cc69956..f2f4b06c 100644 --- a/lib/widgets/components/Grid/index.dart +++ b/lib/widgets/components/Grid/index.dart @@ -10,8 +10,10 @@ import "package:flutter/material.dart"; import '../../../model/widget.dart'; import 'GridTile/index.dart' as GridTile; - +import 'GridView/index.dart' as GridView; import 'GridTileBar/index.dart' as GridTileBar; +import 'GridPaper/index.dart' as GridPaper; +import 'SliverGrid/index.dart' as SliverGrid; List widgetPoints = [ WidgetPoint( name: 'GridTile', @@ -22,5 +24,20 @@ List widgetPoints = [ name: 'GridTileBar', routerName: GridTileBar.Demo.routeName, buildRouter: (BuildContext context) => GridTileBar.Demo(), + ), + WidgetPoint( + name: 'GridView', + routerName: GridView.Demo.routeName, + buildRouter: (BuildContext context) => GridView.Demo(), + ), + WidgetPoint( + name: 'GridPaper', + routerName: GridPaper.Demo.routeName, + buildRouter: (BuildContext context) => GridPaper.Demo(), + ), + WidgetPoint( + name: 'SliverGrid', + routerName: SliverGrid.Demo.routeName, + buildRouter: (BuildContext context) => SliverGrid.Demo(), ) ]; diff --git a/lib/widgets/components/LIst/AnimatedList/index.dart b/lib/widgets/components/LIst/AnimatedList/index.dart index 33305765..39a82dcf 100644 --- a/lib/widgets/components/LIst/AnimatedList/index.dart +++ b/lib/widgets/components/LIst/AnimatedList/index.dart @@ -6,8 +6,7 @@ * email: zhu.yan@alibaba-inc.com * tartget: AnimatedList 的示例 */ -import '../../../../common/widget-demo.dart'; -import '../../../../routers/application.dart'; +import '../../../../common/widget_demo.dart'; import 'package:flutter/material.dart'; import 'package:flutter_markdown/flutter_markdown.dart'; @@ -40,12 +39,13 @@ class Demo extends StatefulWidget { } class _DemoState extends State { + State animatedList; @override Widget build(BuildContext context) { return WidgetDemo( title: 'AnimatedList', - codeUrl: '${Application.github['widgetsURL']}componentss/List/AnimatedList/demo.dart', - child: allCheckboxs(context, this), + codeUrl: 'components/List/AnimatedList/demo.dart', + contentList: [allDemoBoxs(context, this)], docUrl: 'https://docs.flutter.io/flutter/widgets/AnimatedList-class.html', ); } @@ -56,7 +56,7 @@ class _DemoState extends State { * context: 运行上下文 * that: 指向有状态的 StatefulWidget */ -Widget allCheckboxs(BuildContext context, _DemoState that) { +Widget allDemoBoxs(BuildContext context, _DemoState that) { return Container( //padding: new EdgeInsets.only(bottom: 20.0, top: 20.0, left: 0, right: 0), child: Column( diff --git a/lib/widgets/components/LIst/ListBody/demo.dart b/lib/widgets/components/LIst/ListBody/demo.dart index 5e21ba0c..76a1f679 100644 --- a/lib/widgets/components/LIst/ListBody/demo.dart +++ b/lib/widgets/components/LIst/ListBody/demo.dart @@ -10,8 +10,7 @@ import 'package:flutter/material.dart'; /* -* Checkbox 默认按钮的实例 -* index 当前checkbox 的索引值 +* Checkbox 默认ListBody的实例 * */ class ListBodyFullDefault extends StatefulWidget { const ListBodyFullDefault() : super(); diff --git a/lib/widgets/components/LIst/ListBody/index.dart b/lib/widgets/components/LIst/ListBody/index.dart index a308ab8c..8dc071da 100644 --- a/lib/widgets/components/LIst/ListBody/index.dart +++ b/lib/widgets/components/LIst/ListBody/index.dart @@ -6,8 +6,8 @@ * email: zhu.yan@alibaba-inc.com * tartget: ListBody 的示例 */ -import '../../../../common/widget-demo.dart'; -import '../../../../routers/application.dart'; +import '../../../../common/widget_demo.dart'; + import 'package:flutter/material.dart'; import 'package:flutter_markdown/flutter_markdown.dart'; @@ -41,9 +41,8 @@ class _DemoState extends State { Widget build(BuildContext context) { return WidgetDemo( title: 'ListBody', - codeUrl: '${Application - .github['widgetsURL']}/componentss/List/ListBody/demo.dart', - child: allCheckboxs(context, this), + codeUrl: 'components/List/ListBody/demo.dart', + contentList: [allCheckboxs(context, this)], docUrl: 'https://docs.flutter.io/flutter/widgets/ListBody-class.html', ); } diff --git a/lib/widgets/components/LIst/ListView/demo.dart b/lib/widgets/components/LIst/ListView/demo.dart index cbfde28e..728db57f 100644 --- a/lib/widgets/components/LIst/ListView/demo.dart +++ b/lib/widgets/components/LIst/ListView/demo.dart @@ -10,8 +10,7 @@ import 'package:flutter/material.dart'; /* -* Checkbox 默认按钮的实例 -* index 当前checkbox 的索引值 +* ListView 默认ListView的实例 * */ class ListViewFullDefault extends StatefulWidget { const ListViewFullDefault() : super(); @@ -135,7 +134,9 @@ class ListViewLessDefault extends StatelessWidget { ), ); break; + default: + return null; + break; } - } } \ No newline at end of file diff --git a/lib/widgets/components/LIst/ListView/index.dart b/lib/widgets/components/LIst/ListView/index.dart index 4bf7ab07..375d50ad 100644 --- a/lib/widgets/components/LIst/ListView/index.dart +++ b/lib/widgets/components/LIst/ListView/index.dart @@ -6,8 +6,7 @@ * email: zhu.yan@alibaba-inc.com * tartget: ListView 的示例 */ -import '../../../../common/widget-demo.dart'; -import '../../../../routers/application.dart'; +import '../../../../common/widget_demo.dart'; import 'package:flutter/material.dart'; import 'package:flutter_markdown/flutter_markdown.dart'; @@ -68,8 +67,8 @@ class _DemoState extends State { Widget build(BuildContext context) { return WidgetDemo( title: 'ListView', - codeUrl: '${Application.github['widgetsURL']}/componentss/List/ListView/demo.dart', - child: allCheckboxs(context, this), + codeUrl: '/componentss/List/ListView/demo.dart', + contentList: [allCheckboxs(context, this)], docUrl: 'https://docs.flutter.io/flutter/widgets/ListView-class.html', ); } diff --git a/lib/widgets/components/Menu/PopupMenuButton/index.dart b/lib/widgets/components/Menu/PopupMenuButton/index.dart index 61466760..ae6b45e9 100644 --- a/lib/widgets/components/Menu/PopupMenuButton/index.dart +++ b/lib/widgets/components/Menu/PopupMenuButton/index.dart @@ -12,7 +12,7 @@ const String content0 = ''' ### **简介** > 一个提供菜单栏弹出对话框的按钮 - 点击的时候弹出菜单栏对话框,当选择其中一项后会调用 onSelected方法。传递其所选的菜单项的值 -- 可以提供child子widget或者一个icon给它,但是并不能两者都提供 +- 可以提供一个child widget或者提供一个icon给它,但是并不能两者都提供 - 如果什么都没有提供给 PopupMenuButton ,则会根据运行平台创建一个overflow icon '''; diff --git a/lib/widgets/components/Menu/index.dart b/lib/widgets/components/Menu/index.dart index 697fad9d..323fb8d9 100644 --- a/lib/widgets/components/Menu/index.dart +++ b/lib/widgets/components/Menu/index.dart @@ -13,6 +13,7 @@ import './PopupMenuButton/index.dart' as PopupMenuButton; import './PopupMenuDivider/index.dart' as PopupMenuDivider; import './PopupMenuEntry/index.dart' as PopupMenuEntry; import './PopupMenuItemState/index.dart' as PopupMenuItemState; +import './PopupMenuItem/index.dart' as PopupMenuItem; List widgetPoints = [ @@ -46,4 +47,9 @@ List widgetPoints = [ routerName: PopupMenuItemState.Demo.routeName, buildRouter: (BuildContext context) => PopupMenuItemState.Demo(), ), + WidgetPoint( + name:'PopupMenuItem', + routerName: PopupMenuItem.Demo.routeName, + buildRouter: (BuildContext context) => PopupMenuItem.Demo(), + ), ]; \ No newline at end of file diff --git a/lib/widgets/components/Navigation/BottomNavigationBar/demo.dart b/lib/widgets/components/Navigation/BottomNavigationBar/demo.dart index 65061ede..a34335e1 100644 --- a/lib/widgets/components/Navigation/BottomNavigationBar/demo.dart +++ b/lib/widgets/components/Navigation/BottomNavigationBar/demo.dart @@ -10,8 +10,7 @@ import 'package:flutter/material.dart'; /* -* Checkbox 默认按钮的实例 -* index 当前checkbox 的索引值 +* BottomNavigationBar 默认的实例 * */ class BottomNavigationBarFullDefault extends StatefulWidget { const BottomNavigationBarFullDefault() : super(); diff --git a/lib/widgets/components/Navigation/BottomNavigationBar/index.dart b/lib/widgets/components/Navigation/BottomNavigationBar/index.dart index baa6a4e2..d5241c19 100644 --- a/lib/widgets/components/Navigation/BottomNavigationBar/index.dart +++ b/lib/widgets/components/Navigation/BottomNavigationBar/index.dart @@ -6,28 +6,28 @@ * email: zhu.yan@alibaba-inc.com * tartget: BottomNavigationBar 的示例 */ -import '../customDemo.dart'; -import '../../../../routers/application.dart'; + import 'package:flutter/material.dart'; +import '../../../../common/widget_demo.dart'; import 'package:flutter_markdown/flutter_markdown.dart'; import './demo.dart' as BottomNavigationBarDemo; const String _text0 = """### **简介** -> BottomNavigationBar “底部导航栏”, -- 显示在应用程序底部的导航栏,由文本标签,图标或两者形式的多个项目组成。 -- 它提供了应用程序顶级视图之间的快速导航。 +> BottomNavigationBar “底部导航栏” +- 显示在应用程序底部的导航栏,由文本标签,图标或两者形式的多个项目组成; +- 它提供了应用程序顶级视图之间的快速导航; """; const String _text1 = """### **基本用法** > BottomNavigationBar 底部导航栏通常与Scaffold结合使用 -- 它作为Scaffold.bottomNavigationBar参数。 -- BottomNavigationBar金支持0-4个之间个底部按钮数量,超出4个系统将会报异常。 -- 默认0-3个底部按钮数量时,BottomNavigationBar采用fixed的模式摆放底部按钮,当超过4个时默认使用 BottomNavigationBarType.shifting 模式摆放底部按钮 -- 下面的底部导航即是效果。 +- 它作为 Scaffold.bottomNavigationBar 参数; +- BottomNavigationBar 支持0-4个之间个底部按钮数量,超出4个系统将会报异常; +- 默认0-3个底部按钮数量时,BottomNavigationBar采用fixed的模式摆放底部按钮,当有4个时默认使用 BottomNavigationBarType.shifting 模式摆放底部按钮; +- 下面的底部导航即是效果; """; class Demo extends StatefulWidget { @@ -40,10 +40,10 @@ class Demo extends StatefulWidget { class _DemoState extends State { @override Widget build(BuildContext context) { - return CustomDemo( + return WidgetDemo( title: 'BottomNavigationBar', - codeUrl: '${Application.github['widgetsURL']}components/Navigation/BottomNavigationBar/demo.dart', - child: allCheckboxs(context, this), + codeUrl: 'components/Navigation/BottomNavigationBar/demo.dart', + contentList: [allDemoBoxs(context, this)], docUrl: 'https://docs.flutter.io/flutter/material/BottomNavigationBar-class.html', bottomNaviBar:BottomNavigationBarDemo.BottomNavigationBarFullDefault() ); @@ -55,7 +55,7 @@ class _DemoState extends State { * context: 运行上下文 * that: 指向有状态的 StatefulWidget */ -Widget allCheckboxs(BuildContext context, _DemoState that) { +Widget allDemoBoxs(BuildContext context, _DemoState that) { return Container( //padding: new EdgeInsets.only(bottom: 20.0, top: 20.0, left: 0, right: 0), child: Column( diff --git a/lib/widgets/components/Navigation/BottomNavigationBarItem/demo.dart b/lib/widgets/components/Navigation/BottomNavigationBarItem/demo.dart index f4fae608..03851151 100644 --- a/lib/widgets/components/Navigation/BottomNavigationBarItem/demo.dart +++ b/lib/widgets/components/Navigation/BottomNavigationBarItem/demo.dart @@ -9,7 +9,6 @@ import 'package:flutter/material.dart'; - /* * BottomNavigationBarItem 默认的实例,无状态 * */ diff --git a/lib/widgets/components/Navigation/BottomNavigationBarItem/index.dart b/lib/widgets/components/Navigation/BottomNavigationBarItem/index.dart index 0f14bffb..f28b77a5 100644 --- a/lib/widgets/components/Navigation/BottomNavigationBarItem/index.dart +++ b/lib/widgets/components/Navigation/BottomNavigationBarItem/index.dart @@ -6,8 +6,8 @@ * email: zhu.yan@alibaba-inc.com * tartget: BottomNavigationBarItem 的示例 */ -import '../../../../common/widget-demo.dart'; -import '../../../../routers/application.dart'; +import '../../../../common/widget_demo.dart'; + import 'package:flutter/material.dart'; import 'package:flutter_markdown/flutter_markdown.dart'; @@ -16,13 +16,13 @@ import './demo.dart' as BottomNavigationBarItemDemo; const String _Text0 = """### **简介** > BottomNavigationBarItem “底部导航应用栏” -- material 的 BottomNavigationBar 或带有图标和标题的 iOS主题 CupertinoTabBar 中的交互式按钮。 +- material 的 BottomNavigationBar 或带有图标和标题的 iOS主题 CupertinoTabBar 中的交互式按钮; """; const String _Text1 = """### **基本用法** -> 这个类很少单独使用。通常嵌入在上面的一个底部 bottom navigation widgets 中。 +> 这个类很少单独使用。通常嵌入在上面的一个底部 bottom navigation widgets 中; """; @@ -38,8 +38,8 @@ class _DemoState extends State { Widget build(BuildContext context) { return WidgetDemo( title: 'BottomNavigationBarItem', - codeUrl: '${Application.github['widgetsURL']}componentss/Bar/BottomNavigationBarItem/demo.dart', - child: allCheckboxs(context, this), + codeUrl: 'components/Bar/BottomNavigationBarItem/demo.dart', + contentList: [allCheckboxs(context, this)], docUrl: 'https://docs.flutter.io/flutter/widgets/BottomNavigationBarItem-class.html', ); } diff --git a/lib/widgets/components/Navigation/customDemo.dart b/lib/widgets/components/Navigation/customDemo.dart deleted file mode 100644 index e584df3b..00000000 --- a/lib/widgets/components/Navigation/customDemo.dart +++ /dev/null @@ -1,35 +0,0 @@ -/** - * Created with Android Studio. - * User: 一晟 - * Date: 2018/12/27 - * Time: 下午10:12 - * email: zhu.yan@alibaba-inc.com - * tartget: FlatButton 的示例 - */ -import '../../../common/widget-demo.dart'; -import 'package:flutter/material.dart'; - -class CustomDemo extends WidgetDemo { - - final Widget child; - final String docUrl; - final String title; - final String codeUrl; - final Widget bottomNaviBar; - CustomDemo( - {Key key, - @required this.title, - @required this.child, - @required this.codeUrl, - @required this.docUrl, - this.bottomNaviBar - }) - : super(key: key); - - @override - Widget build(BuildContext context,[bottomNavigationBar]) { - print('bottomNavigationBar:${bottomNaviBar}'); - final factory = super.build(context,bottomNaviBar); - return factory; - } -} \ No newline at end of file diff --git a/lib/widgets/elements/Form/Button/DropdownButton/demo.dart b/lib/widgets/elements/Form/Button/DropdownButton/demo.dart index 2bf5b846..a2a97503 100644 --- a/lib/widgets/elements/Form/Button/DropdownButton/demo.dart +++ b/lib/widgets/elements/Form/Button/DropdownButton/demo.dart @@ -12,6 +12,9 @@ import 'package:flutter/material.dart'; * DropdownButton 默认按钮的实例 * isDisabled:是否是禁用,isDisabled 默认为true * */ +var selectItValue; +var selectItemValue; + class DropdownButtonDefault extends StatelessWidget { List generateItemList() { final List items = new List(); @@ -30,15 +33,13 @@ class DropdownButtonDefault extends StatelessWidget { return items; } - var selectItemValue; - @override Widget build(BuildContext context) { return DropdownButton( hint: new Text('下拉菜单选择一个人名'), //设置这个value之后,选中对应位置的item, //再次呼出下拉菜单,会自动定位item位置在当前按钮显示的位置处 - value: selectItemValue, + value: selectItValue, items: generateItemList(), onChanged: (T){ // setState(() { @@ -103,7 +104,6 @@ List getListData(){ items.add(dropdownMenuItem10); return items; } -var selectItemValue; /* * DropdownButton 自定义的实例 diff --git a/lib/widgets/elements/Form/Button/DropdownButton/index.dart b/lib/widgets/elements/Form/Button/DropdownButton/index.dart index 8381681b..4274f5dc 100644 --- a/lib/widgets/elements/Form/Button/DropdownButton/index.dart +++ b/lib/widgets/elements/Form/Button/DropdownButton/index.dart @@ -7,8 +7,8 @@ * target: DropdownButton 的示例 * 对应文档地址:https://docs.flutter.io/flutter/material/DropdownButton-class.html */ -import '../../../../../common/widget-demo.dart'; -import '../../../../../routers/application.dart'; +import '../../../../../common/widget_demo.dart'; + import 'package:flutter/material.dart'; import 'package:flutter_markdown/flutter_markdown.dart'; @@ -18,7 +18,7 @@ import './demo.dart' as dropdownButton; const String _dropdownText0 = """### **简介** > Dropdown button “用于从项目列表中进行选择的按钮” -- 类型T是下拉菜单表示的值的类型。给定菜单中的所有条目必须表示具有一致类型的值。通常,使用枚举。每个DropdownMenuItem在项目必须专门与同类型的说法。。 +- 参数类型 T 是下拉菜单表示的值的类型。给定菜单中的所有条目必须表示具有一致类型的值。通常,使用枚举。每个DropdownMenuItem在项目必须专门与同类型的说法; """; const String _dropdownText1 = @@ -50,8 +50,8 @@ class _DemoState extends State { Widget build(BuildContext context) { return WidgetDemo( title: 'DropdownButton', - codeUrl: '${Application.github['widgetsURL']}elements/Form/Button/DropdownButton/demo.dart', - child: allDropdownButtons(context,this), + codeUrl: 'elements/Form/Button/DropdownButton/demo.dart', + contentList: [allDropdownButtons(context,this)], docUrl: 'https://docs.flutter.io/flutter/material/DropdownButton-class.html', ); } diff --git a/lib/widgets/elements/Form/Button/FlatButton/index.dart b/lib/widgets/elements/Form/Button/FlatButton/index.dart index 1917e63a..58fa6ba3 100644 --- a/lib/widgets/elements/Form/Button/FlatButton/index.dart +++ b/lib/widgets/elements/Form/Button/FlatButton/index.dart @@ -7,8 +7,8 @@ * target: FlatButton 的示例 * 对应文档地址:https://docs.flutter.io/flutter/material/FlatButton-class.html */ -import '../../../../../common/widget-demo.dart'; -import '../../../../../routers/application.dart'; +import '../../../../../common/widget_demo.dart'; + import 'package:flutter/material.dart'; import 'package:flutter_markdown/flutter_markdown.dart'; @@ -18,29 +18,27 @@ import './demo.dart' as flatButton; const String _flatText0 = """### **简介** -> Flat button 是显示在(零高程)material widget上的文本标签 -- 通过填充颜色对触摸作出反应在工具栏上, -- 在对话框中使用Flat button,或与其他内容内联,但使用填充从该内容偏移,以便按钮的存在是显而易见的。 -- Flat buttons 故意不具有可见边框,因此必须依赖于它们相对于其他内容的位置以用于上下文。 -- 在对话框和卡片中,它们应该组合在一个底角中。避免使用平面按钮,它们会与其他内容混合,例如在列表中间。"""; +> FlatButton 是显示在(零高程)material widget 上的文本标签 +- 通过填充颜色对触摸作出反应在工具栏上; +- FlatButtons 故意不具有可见边框,因此必须依赖于它们相对于其他内容的位置以用于上下文; +- 在对话框和卡片中,它们应该组合在一个底角中。避免使用平面按钮,它们会与其他内容混合,例如在列表中间;"""; const String _flatText1 = """### **基本用法** -> 参数的默认的按钮和禁用按钮 -- 如果onPressed回调为null,则该按钮将被禁用,不会对触摸做出反应,并且将按 disabledColor 属性而不是color属性指定的颜色进行着色。 -- 如果您尝试更改按钮的颜色并且没有任何效果,请检查您是否正在传递非null onPressed处理程序。"""; +> 参数的默认的 button 和禁用 button +- 如果 onPressed 回调为null,则该按钮将被禁用,不会对触摸做出反应,并且将按 disabledColor 属性而不是color属性指定的颜色进行着色; +- 如果您尝试更改按钮的颜色并且没有任何效果,请检查您是否正在传递非null onPressed处理程序;。"""; const String _flatText2 = """### **进阶用法1** -> FlatButton.icon,按钮图标和标签的widget创建文本按钮。"""; +> FlatButton.icon ,button 图标和标签的 widget 创建文本按钮;"""; const String _flatText3 = """### **进阶用法2** -> 更改项参数的自定义,比如:边框,点击效果,内容文字颜色等 -- Material design Flat buttons 按钮具有全帽标签,一些内部填充和一些定义的尺寸。 -- 要使应用程序的一部分具有交互式,使用墨水溅,而不是承诺这些样式选择,请考虑使用InkWell。 -- Flat button 的最小尺寸为88.0×36.0,可以用 ButtonTheme 覆盖。该clipBehavior参数不能为空。"""; +> 更改参数的自定义,比如:边框,点击效果,内容文字颜色等; +- 要使应用程序的一部分具有交互式,使用 ink splashes,请考虑使用InkWell; +- Flat button 的最小尺寸为88.0×36.0,可以用 ButtonTheme 覆盖。该clipBehavior参数不能为空;"""; class Demo extends StatefulWidget { static const String routeName = '/element/Form/Button/FlatButton'; @@ -54,8 +52,8 @@ class _DemoState extends State { Widget build(BuildContext context) { return WidgetDemo( title: 'FlatButton', - codeUrl: '${Application.github['widgetsURL']}elements/Form/Button/FlatButton/demo.dart', - child: allFlatButtons(context), + codeUrl: 'elements/Form/Button/FlatButton/demo.dart', + contentList: [allFlatButtons(context)], docUrl: 'https://docs.flutter.io/flutter/material/FlatButton-class.html', ); } diff --git a/lib/widgets/elements/Form/Button/FloatingActionButton/index.dart b/lib/widgets/elements/Form/Button/FloatingActionButton/index.dart index 9dd616e6..efabb752 100644 --- a/lib/widgets/elements/Form/Button/FloatingActionButton/index.dart +++ b/lib/widgets/elements/Form/Button/FloatingActionButton/index.dart @@ -7,8 +7,7 @@ * target: FloatingActionButton 的示例 * 对应文档地址:https://docs.flutter.io/flutter/material/FloatingActionButton-class.html */ -import '../../../../../common/widget-demo.dart'; -import '../../../../../routers/application.dart'; +import '../../../../../common/widget_demo.dart'; import 'dart:math'; import 'package:flutter/material.dart'; @@ -19,15 +18,15 @@ import './demo.dart' as floatingActionButton; const String _floatingActionText0 = """### **简介** > FloatingAction Button “浮动动作按钮” -- FloatingActionButton 按钮是一个圆形图标按钮,悬停在内容上以提升应用程序中的主要操作。浮动操作按钮最常用于Scaffold.floatingActionButton字段中。。 -- 每个屏幕最多使用一个浮动操作按钮。浮动操作按钮应用于积极操作,例如“创建”,“共享”或“导航”。 -- 一般用来处理界面中最常用,最基础的用户动作。它一般出现在屏幕内容的前面,通常是一个圆形,中间有一个图标。 FAB有三种类型:regular, mini, and extended。不要强行使用FAB,只有当使用场景符合FAB功能的时候使用才最为恰当 +- FloatingActionButton 按钮是一个圆形图标按钮,悬停在内容上以提升应用程序中的主要操作。浮动操作按钮最常用于Scaffold.floatingActionButton字段中; +- 每个屏幕最多使用一个浮动操作按钮。浮动操作按钮应用于积极操作,例如“创建”,“共享”或“导航”; +- 一般用来处理界面中最常用,最基础的用户动作。它一般出现在屏幕内容的前面,通常是一个圆形,中间有一个图标。 FAB有三种类型:regular, mini, extended。不要强行使用FAB,只有当使用场景符合FAB功能的时候使用才最为恰当; """; const String _floatingActionText1 = """### **基本用法** -> 默认参数的按钮和禁用按钮 -- 如果onPressed回调为null,则该按钮将被禁用,并且不会对触摸作出反应,不会变成灰色。 +> 默认参数的 button 和禁用 button +- 如果 onPressed 回调为null,则该 button 将被禁用,并且不会对触摸作出反应,不会变成灰色; """; const String _floatingActionText2 = @@ -60,9 +59,8 @@ class _DemoState extends State { return WidgetDemo( title: 'FloatingActionButton', // desc: _floatingActionTitle, - codeUrl: '${Application.github['widgetsURL']}elements/Form/Button/FloatingActionButton/demo.dart', - child: allFloatingActionButtons(context,this), - //child: Text('123'), + codeUrl: 'elements/Form/Button/FloatingActionButton/demo.dart', + contentList: [allFloatingActionButtons(context,this)], docUrl: 'https://docs.flutter.io/flutter/material/FloatingActionButton-class.html', ); } diff --git a/lib/widgets/elements/Form/Button/IconButton/demo.dart b/lib/widgets/elements/Form/Button/IconButton/demo.dart index 8f18ef00..cb7a9baa 100644 --- a/lib/widgets/elements/Form/Button/IconButton/demo.dart +++ b/lib/widgets/elements/Form/Button/IconButton/demo.dart @@ -8,9 +8,11 @@ */ import 'dart:math'; import 'package:flutter/material.dart'; -import 'package:flutter_rookie_book/common/iconNames.dart'; -final int len = IconNames.Names.length; +import 'package:flutter_go/common/icon_names.dart'; + + +final int len = IconNames.names.length; /* * IconButton 默认按钮的实例 @@ -56,7 +58,7 @@ class IconButtonCustom extends StatelessWidget { @override Widget build(BuildContext context) { final int iconIndex = Random.secure().nextInt(len); - final IconData type = IconNames.Names[iconIndex]; + final IconData type = IconNames.names[iconIndex]; final _onPressed = onPressed; return IconButton( // 定义图标在IconButton中的定位方式,AlignmentGeometry 如果父Widget尺寸大于child Widget尺寸,这个属性设置会起作用,有很多种对齐方式。 diff --git a/lib/widgets/elements/Form/Button/IconButton/index.dart b/lib/widgets/elements/Form/Button/IconButton/index.dart index d6619004..1d742771 100644 --- a/lib/widgets/elements/Form/Button/IconButton/index.dart +++ b/lib/widgets/elements/Form/Button/IconButton/index.dart @@ -7,8 +7,7 @@ * target: IconButton 的示例 * 对应文档地址:https://docs.flutter.io/flutter/material/IconButton-class.html */ -import '../../../../../common/widget-demo.dart'; -import '../../../../../routers/application.dart'; +import '../../../../../common/widget_demo.dart'; import 'dart:math'; import 'package:flutter/material.dart'; @@ -19,19 +18,19 @@ import './demo.dart' as iconButton; const String _iconText0 = """### **简介** > Icon button “图标按钮” -- IconButton widget上的图片,通过填充颜色(墨水)来对触摸作出反应。 +- IconButton widget上的图片,通过填充颜色(墨水)来对触摸作出反应; """; const String _iconText1 = """### **基本用法** > 参数的默认的按钮和禁用按钮 -- 图标按钮通常在AppBar.actions字段中使用,但它们也可以在许多其他地方使用。。 -- 如果您尝试更改按钮的颜色并且没有任何效果,请检查您是否正在传递非null onPressed处理程序。"""; +- 图标按钮通常在AppBar.actions字段中使用,但它们也可以在许多其他地方使用; +- 如果您尝试更改按钮的颜色并且没有任何效果,请检查您是否正在传递非null onPressed处理程序;"""; const String _iconText2 = """### **进阶用法** -> 更改项参数的自定义,比如:边框,点击效果,内容文字,颜色,圆角等 -- 如果可能,图标按钮的命中区域的大小至少为48.0像素,与实际的iconSize无关,以满足 Material Design规范中的触摸目标大小要求。的对准控制图标本身如何定位命中区域内。 +> 更改项参数的自定义,比如:边框,点击效果,内容文字,颜色,圆角等; +- 如果可能,图标按钮的命中区域的大小至少为48.0像素,与实际的iconSize无关,以满足 Material Design规范中的触摸目标大小要求。的对准控制图标本身如何定位命中区域内; - ** 长按可弹出 tip 文字 ** """; @@ -54,8 +53,8 @@ class _DemoState extends State { Widget build(BuildContext context) { return WidgetDemo( title: 'IconButton', - codeUrl: '${Application.github['widgetsURL']}elements/Form/Button/IconButton/demo.dart', - child: allIconButtons(context,this), + codeUrl: 'elements/Form/Button/IconButton/demo.dart', + contentList: [ allIconButtons(context,this)], docUrl: 'https://docs.flutter.io/flutter/material/IconButton-class.html', ); } diff --git a/lib/widgets/elements/Form/Button/OutlineButton/index.dart b/lib/widgets/elements/Form/Button/OutlineButton/index.dart index aef9a20a..8c2aaa26 100644 --- a/lib/widgets/elements/Form/Button/OutlineButton/index.dart +++ b/lib/widgets/elements/Form/Button/OutlineButton/index.dart @@ -7,8 +7,7 @@ * target: OutlineButton 的示例 * 对应文档地址:https://docs.flutter.io/flutter/material/OutlineButton-class.html */ -import '../../../../../common/widget-demo.dart'; -import '../../../../../routers/application.dart'; +import '../../../../../common/widget_demo.dart'; import 'dart:math'; import 'package:flutter/material.dart'; @@ -19,29 +18,29 @@ import './demo.dart' as outlineButton; const String _outlineText0 = """### **简介** > Outline button “边框按钮” -- RaisedButton和FlatButton之间的交叉:一个有边框的按钮,当按下按钮时,其高度增加,背景变得不透明。。 -- 高程最初为0.0,其背景颜色 为透明。按下按钮时,其背景变为不透明,然后其高程增加到highlightElevation。 +- RaisedButton和FlatButton之间的交叉:一个有边框的按钮,当按下按钮时,其高度增加,背景变得不透明; +- 高程最初为0.0,其背景颜色 为透明。按下按钮时,其背景变为不透明,然后其高程增加到highlightElevation; """; const String _outlineText1 = """### **基本用法** -> 参数的默认的按钮和禁用按钮 -- 如果onPressed回调为null,则该按钮将被禁用,不会对触摸做出反应,并且将按 disabledColor 属性而不是color属性指定的颜色进行着色。 -- 如果您尝试更改按钮的颜色并且没有任何效果,请检查您是否正在传递非null onPressed处理程序。"""; +> 参数的默认的 button 和禁用 button +- 如果onPressed回调为null,则该按钮将被禁用,不会对触摸做出反应,并且将按 disabledColor 属性而不是color属性指定的颜色进行着色; +- 如果您尝试更改按钮的颜色并且没有任何效果,请检查您是否正在传递非null onPressed处理程序;"""; const String _outlineText2 = """### **进阶用法1** -> OutlineButton.icon 的用法,按钮图标和标签的widget创建文本按钮。"""; +> OutlineButton.icon 的用法,按钮图标和标签的widget创建文本按钮"""; const String _outlineText3 = """### **进阶用法2** -> 更改项参数的自定义,比如:边框,点击效果,内容文字,颜色,圆角等 -- Outline buttons 按钮有一个边框,其形状由形状定义 ,其外观由borderSide,disabledBorderColor和highlightedBorderColor定义。 -- 如果您想要水龙头的墨水效果,但又不想使用按钮,请考虑直接使用InkWell。 -- Outline buttons 的最小尺寸为88.0×36.0,可以用ButtonTheme 覆盖。 -- 通过 shape 属性的设置,改变边框样式和圆角。 -- 可以尝试长按按钮,按钮突出显示。 +> 更改参数的自定义,比如:边框,点击效果,内容文字,颜色,圆角等; +- Outline buttons 按钮有一个边框,其形状由形状定义 ,其外观由borderSide,disabledBorderColor 和 highlightedBorderColor 定义; +- 如果您想要 ink-splash 效果,但又不想使用 button ,请考虑直接使用 InkWell; +- Outline buttons 的最小尺寸为88.0×36.0,可以用 ButtonTheme 覆盖; +- 通过 shape 属性的设置,改变边框样式和圆角; +- 可以尝试长按按钮,button 突出显示; """; class Demo extends StatefulWidget { @@ -63,8 +62,8 @@ class _DemoState extends State { Widget build(BuildContext context) { return WidgetDemo( title: 'OutlineButton', - codeUrl: '${Application.github['widgetsURL']}elements/Form/Button/OutlineButton/demo.dart', - child: allOutlineButtons(context,this), + codeUrl: 'elements/Form/Button/OutlineButton/demo.dart', + contentList: [allOutlineButtons(context,this)], docUrl: 'https://docs.flutter.io/flutter/material/OutlineButton-class.html', ); } diff --git a/lib/widgets/elements/Form/Button/PopupMenuButton/index.dart b/lib/widgets/elements/Form/Button/PopupMenuButton/index.dart index dd5df9d7..bb708a73 100644 --- a/lib/widgets/elements/Form/Button/PopupMenuButton/index.dart +++ b/lib/widgets/elements/Form/Button/PopupMenuButton/index.dart @@ -8,8 +8,8 @@ * 对应文档地址:https://docs.flutter.io/flutter/material/PopupMenuButton-class.html */ -import '../../../../../common/widget-demo.dart'; -import '../../../../../routers/application.dart'; +import '../../../../../common/widget_demo.dart'; + import 'package:flutter/material.dart'; import 'package:flutter_markdown/flutter_markdown.dart'; import './demo.dart' as popupMenuButton; @@ -17,21 +17,21 @@ import './demo.dart' as popupMenuButton; const String _titleText0 = """ ### **简介** > 按下时显示菜单 -- 当菜单因为选择了项目而被解除时调用onSelected。传递给onSelected的值是所选菜单项的值。 -- 可以提供 `child` 或 `icon` 中的一个,但不是能同时设置两者。如果提供了 `icon` ,则 `PopupMenuButton` 的行为类似于 `IconButton`。 -- 如果两者都为null,则创建一个标准 overflow icon(取决于平台)。 +- 当菜单因为选择了项目而被解除时调用onSelected。传递给onSelected的值是所选菜单项的值; +- 可以提供 `child` 或 `icon` 中的一个,但不是能同时设置两者。如果提供了 `icon` ,则 `PopupMenuButton` 的行为类似于 `IconButton`; +- 如果两者都为null,则创建一个标准 overflow icon(取决于平台); """; const String _titleText1 = """ ### **基本用法** > 此示例显示一个包含四个项目的菜单 -- 在枚举值之间进行选择,并_selection根据选择设置字段。 +- 在枚举值之间进行选择,并_selection根据选择设置字段; """; const String _titleText2 = """ ### **进阶用法** > 此示例尝试调整所有属性,展示出效果 -- 默认选择第二个。 -- 再次打开,`PopupMenuItem` 保留上次的选择结果。 +- 默认选择第二个; +- 再次打开,`PopupMenuItem` 保留上次的选择结果; """; class Demo extends StatefulWidget { @@ -55,8 +55,8 @@ class _DemoState extends State { Widget build(BuildContext context) { return WidgetDemo( title: 'PopupMenuButton', - codeUrl: '${Application.github['widgetsURL']}elements/Form/Button/RaisedButton/demo.dart', - child: allPopupMenuButton(widget,this), + codeUrl: 'elements/Form/Button/RaisedButton/demo.dart', + contentList: [allPopupMenuButton(widget,this)], docUrl: 'https://docs.flutter.io/flutter/material/PopupMenuButton-class.html', ); } diff --git a/lib/widgets/elements/Form/Button/RaisedButton/index.dart b/lib/widgets/elements/Form/Button/RaisedButton/index.dart index 649a083c..26d7ad7e 100644 --- a/lib/widgets/elements/Form/Button/RaisedButton/index.dart +++ b/lib/widgets/elements/Form/Button/RaisedButton/index.dart @@ -7,8 +7,7 @@ * target: RaisedButton 的示例 * 对应文档地址:https://docs.flutter.io/flutter/material/RaisedButton-class.html */ -import '../../../../../common/widget-demo.dart'; -import '../../../../../routers/application.dart'; +import '../../../../../common/widget_demo.dart'; import 'dart:math'; import 'package:flutter/material.dart'; @@ -19,29 +18,28 @@ import './demo.dart' as raisedButton; const String _raisedText0 = """### **简介** > Raised button “凸起按钮” -- Raised button 基于 a Material widget 窗口widget,按下按钮时,Material.elevation 会增加。 -- 使用 Raised button 可将尺寸添加到大多数平面布局中。 -- 例如在复杂的内容列表中,或在宽阔的空间中。避免在已经提出的内容(例如对话框或卡片)上使用 Raised button 。 +- Raised button 基于 a Material widget 窗口widget,按下 button 时,Material.elevation 会增加; +- 使用 Raised button 可将尺寸添加到大多数平面布局中; +- 例如在复杂的内容列表中,或在宽阔的空间中。避免在已经提出的内容(例如对话框或卡片)上使用 Raised button; """; const String _raisedText1 = """### **基本用法** -> 参数的默认的按钮和禁用按钮 -- 如果onPressed回调为null,则该按钮将被禁用,不会对触摸做出反应,并且将按 disabledColor 属性而不是color属性指定的颜色进行着色。 -- 如果您尝试更改按钮的颜色并且没有任何效果,请检查您是否正在传递非null onPressed处理程序。"""; +> 参数的默认的 button 和禁用 button; +- 如果onPressed回调为null,则该按钮将被禁用,不会对触摸做出反应,并且将按 disabledColor 属性而不是color属性指定的颜色进行着色; +- 如果您尝试更改按钮的颜色并且没有任何效果,请检查您是否正在传递非null onPressed处理程序;"""; const String _raisedText2 = """### **进阶用法1** -> RaisedButton.icon 的用方法,按钮图标和标签的widget创建文本按钮。"""; +> RaisedButton.icon 的用方法,按钮图标和标签的widget创建文本按钮;"""; const String _raisedText3 = """### **进阶用法2** > 更改项参数的自定义,比如:边框,点击效果,内容文字,颜色,圆角等 -- Raised buttons 按钮具有全帽标签,一些内部填充和一些定义的尺寸。 -- 如果您想要水龙头的墨水效果,但又不想使用按钮,请考虑直接使用InkWell。 -- Raised buttons 的最小尺寸为88.0×36.0,可以用ButtonTheme 覆盖。 -- 通过 shape 属性的设置,改变边框样式和圆角。 +- 如果您想要 ink-splash 的墨水效果,但又不想使用按钮,请考虑直接使用InkWell; +- Raised buttons 的最小尺寸为88.0×36.0,可以用 ButtonTheme 覆盖; +- 通过 shape 属性的设置,改变边框样式和圆角; """; class Demo extends StatefulWidget { @@ -63,8 +61,8 @@ class _DemoState extends State { Widget build(BuildContext context) { return WidgetDemo( title: 'RaisedButton', - codeUrl: '${Application.github['widgetsURL']}elements/Form/Button/RaisedButton/demo.dart', - child: allRaisedButtons(context,this), + codeUrl: 'elements/Form/Button/RaisedButton/demo.dart', + contentList: [allRaisedButtons(context,this)], docUrl: 'https://docs.flutter.io/flutter/material/RaisedButton-class.html', ); } diff --git a/lib/widgets/elements/Form/Button/RawMaterialButton/index.dart b/lib/widgets/elements/Form/Button/RawMaterialButton/index.dart index 481fa240..3bffb8cd 100644 --- a/lib/widgets/elements/Form/Button/RawMaterialButton/index.dart +++ b/lib/widgets/elements/Form/Button/RawMaterialButton/index.dart @@ -7,8 +7,7 @@ * target: RawMaterialButton 的示例 * 对应文档地址:https://docs.flutter.io/flutter/material/RawMaterialButton-class.html */ -import '../../../../../common/widget-demo.dart'; -import '../../../../../routers/application.dart'; +import '../../../../../common/widget_demo.dart'; import 'dart:math'; import 'package:flutter/material.dart'; @@ -19,13 +18,13 @@ import './demo.dart' as rawMaterialButton; const String _rawMaterialText0 = """### **简介** > RawMaterial button “RawMaterial 按钮” -- 基于Semantics,Material和InkWell 小部件创建按钮。 -- 此类不使用当前Theme或ButtonTheme来计算未指定参数的默认值。它旨在用于自定义材质按钮,可选择包含主题或特定于应用程序源的默认值。 +- 基于 Semantics,Material 和InkWell 小部件创建按钮; +- 此类不使用当前 Theme 或 ButtonTheme 来计算未指定参数的默认值。它旨在用于自定义 Material button,可选择包含主题或特定于应用程序源的默认值; """; const String _rawMaterialText1 = """### **基本用法** -> 参数的默认的按钮和禁用按钮 +> 参数的默认的 button 和禁用 button """; const String _rawMaterialText2 = @@ -52,8 +51,8 @@ class _DemoState extends State { Widget build(BuildContext context) { return WidgetDemo( title: 'RawMaterialButton', - codeUrl: '${Application.github['widgetsURL']}elements/Form/Button/RawMaterialButton/demo.dart', - child: allRawMaterialButtons(context,this), + codeUrl: 'elements/Form/Button/RawMaterialButton/demo.dart', + contentList: [allRawMaterialButtons(context,this)], docUrl: 'https://docs.flutter.io/flutter/material/RawMaterialButton-class.html', ); } diff --git a/lib/widgets/elements/Form/CheckBox/Checkbox/demo.dart b/lib/widgets/elements/Form/CheckBox/Checkbox/demo.dart index c77c8ac0..60ebf8c8 100644 --- a/lib/widgets/elements/Form/CheckBox/Checkbox/demo.dart +++ b/lib/widgets/elements/Form/CheckBox/Checkbox/demo.dart @@ -10,7 +10,7 @@ import 'dart:math'; import 'package:flutter/material.dart'; /* -* Checkbox 默认按钮的实例 +* Checkbox 默认的实例 * index 当前checkbox 的索引值 * */ class CheckboxDefault extends StatefulWidget{ @@ -39,7 +39,7 @@ class _CheckboxDefault extends State { } /* -* Checkbox 默认按钮的实例 +* Checkbox 默认的实例 * index 当前checkbox 的索引值 * */ class CheckboxSelect extends StatelessWidget { diff --git a/lib/widgets/elements/Form/CheckBox/Checkbox/index.dart b/lib/widgets/elements/Form/CheckBox/Checkbox/index.dart index df98da5c..5f0d40d9 100644 --- a/lib/widgets/elements/Form/CheckBox/Checkbox/index.dart +++ b/lib/widgets/elements/Form/CheckBox/Checkbox/index.dart @@ -7,8 +7,8 @@ * target: Checkbox 的示例 * 对应文档地址:https://docs.flutter.io/flutter/material/Checkbox-class.html */ -import '../../../../../common/widget-demo.dart'; -import '../../../../../routers/application.dart'; +import '../../../../../common/widget_demo.dart'; + import 'package:flutter/material.dart'; import 'package:flutter_markdown/flutter_markdown.dart'; @@ -17,21 +17,21 @@ import './demo.dart' as checkbox; const String _checkboxText0 = """### **简介** > checkbox “复选框” -- 复选框本身不保持任何状态 -- 当复选框的状态发生变化时,窗口小部件会调用onChanged回调。 -- 大多数使用复选框的小部件将侦听onChanged回调,并使用新值重建复选框以更新复选框的可视外观。"""; +- 复选框本身不保持任何状态; +- 当复选框的状态发生变化时,窗口小部件会调用onChanged回调; +- 大多数使用复选框的小部件将侦听onChanged回调,并使用新值重建复选框以更新复选框的可视外观;"""; const String _checkboxText1 = """### **基本用法** > 下面示例展示多个颜色(随机)样式的 `checkbox` -- 一个多选的 `checkbox` +- 一个多选的 `checkbox`; """; const String _checkboxText2 = """### **进阶用法** > 下面示例展示多个颜色(随机)样式的 `checkbox` -- 一个单选 `checkbox` 操作 +- 一个单选 `checkbox` 操作; """; class Demo extends StatefulWidget { @@ -47,8 +47,8 @@ class _DemoState extends State { Widget build(BuildContext context) { return WidgetDemo( title: 'Checkbox', - codeUrl: '${Application.github['widgetsURL']}elements/Form/Checkbox/Checkbox/demo.dart', - child: allCheckboxs(context,this), + codeUrl: 'elements/Form/Checkbox/Checkbox/demo.dart', + contentList: [allCheckboxs(context,this)], docUrl: 'https://docs.flutter.io/flutter/material/Checkbox-class.html', ); } diff --git a/lib/widgets/elements/Form/CheckBox/CheckboxListTile/demo.dart b/lib/widgets/elements/Form/CheckBox/CheckboxListTile/demo.dart index 500b549c..ce63afa7 100644 --- a/lib/widgets/elements/Form/CheckBox/CheckboxListTile/demo.dart +++ b/lib/widgets/elements/Form/CheckBox/CheckboxListTile/demo.dart @@ -10,7 +10,7 @@ import 'package:flutter/material.dart'; /* -* Checkbox 默认按钮的实例 +* Checkbox 默认的实例 * index 当前checkbox 的索引值 * */ class CheckboxListTileStateDefault extends StatefulWidget { @@ -119,9 +119,9 @@ class CheckboxListTileDefault extends StatelessWidget { return CheckboxListTile( title: Text('一个简单的例子'), activeColor: Colors.red, - value: widget.valBool, + value: widget.valBool['val'], onChanged: (bool value) { - parant.setState(()=> widget.valBool = value); + parant.setState(()=> widget.valBool['val'] = value); }, secondary: const Icon(Icons.hourglass_empty), ); diff --git a/lib/widgets/elements/Form/CheckBox/CheckboxListTile/index.dart b/lib/widgets/elements/Form/CheckBox/CheckboxListTile/index.dart index 2754c175..a38f9cbc 100644 --- a/lib/widgets/elements/Form/CheckBox/CheckboxListTile/index.dart +++ b/lib/widgets/elements/Form/CheckBox/CheckboxListTile/index.dart @@ -6,8 +6,8 @@ * email: zhu.yan@alibaba-inc.com * tartget: CheckboxListTile 的示例 */ -import '../../../../../common/widget-demo.dart'; -import '../../../../../routers/application.dart'; +import '../../../../../common/widget_demo.dart'; + import 'package:flutter/material.dart'; import 'package:flutter_markdown/flutter_markdown.dart'; @@ -16,18 +16,18 @@ import './demo.dart' as CheckboxListTileDemo; const String _CheckboxListTileText0 = """### **简介** > CheckboxListTile “下拉复选框” -- 带有复选框的ListTile,带有标签的复选框。 -- 整个列表图块是交互式的:点击图块中的任意位置可切换复选框。 +- 带有复选框的 ListTile,带有标签的 ListTile; +- 整个列表图块是交互式的:点击图块中的任意位置可切换复选框; """; const String _CheckboxListTileText1 = """### **基本用法** > CheckboxListTile 的属性特征 -- Checkbox类似的命名属性,比如:onChanged和activeColor。 -- 和ListTile类似的命名属性,比如:title, subtitle, isThreeLine,dense。 -- selected属性和ListTile.selected 属性类似,但使用的颜色是activeColor属性,默认为当前Theme的颜色。 -- onChanged 回调函数为 null,显示禁用 +- 与 Checkbox 类似的命名属性,比如:onChanged 和 activeColor; +- 和 ListTile 类似的命名属性,比如:title, subtitle, isThreeLine,dense; +- selected 属性和 ListTile.selected 属性类似,但使用的颜色是 activeColor 属性,默认为当前 Theme 的颜色; +- onChanged 回调函数为 null,显示禁用; """; const String _CheckboxListTileText2 = @@ -37,7 +37,7 @@ const String _CheckboxListTileText2 = class Demo extends StatefulWidget { static const String routeName = '/element/Form/Checkbox/CheckboxListTile'; - final bool valBool = true; + final Map valBool = {'val':true}; @override _DemoState createState() => _DemoState(); } @@ -47,8 +47,8 @@ class _DemoState extends State { Widget build(BuildContext context) { return WidgetDemo( title: 'CheckboxListTile', - codeUrl: '${Application.github['widgetsURL']}elements/Form/Checkbox/CheckboxListTile/demo.dart', - child: allCheckboxs(context, this), + codeUrl: 'elements/Form/Checkbox/CheckboxListTile/demo.dart', + contentList: [allCheckboxs(context, this)], docUrl: 'https://docs.flutter.io/flutter/material/CheckboxListTile-class.html', ); } diff --git a/lib/widgets/elements/Form/Text/RichText/index.dart b/lib/widgets/elements/Form/Text/RichText/index.dart index 43811bc9..6b3c9f98 100644 --- a/lib/widgets/elements/Form/Text/RichText/index.dart +++ b/lib/widgets/elements/Form/Text/RichText/index.dart @@ -1,6 +1,6 @@ import 'package:flutter/material.dart'; import 'package:flutter_markdown/flutter_markdown.dart'; -import '../../../../../common/widget-demo.dart'; +import '../../../../../common/widget_demo.dart'; const String intro = """ # 富文本显示 @@ -67,7 +67,7 @@ class _Demo extends State { title: 'Rich Text', docUrl: 'https://docs.flutter.io/flutter/widgets/RichText-class.html', codeUrl: '', - child: new Column( + contentList: [new Column( children: [ MarkdownBody(data: markDesc['intro']), Container( @@ -87,6 +87,6 @@ class _Demo extends State { MarkdownBody(data: markDesc['diff']), ], ), - ); + ]); } } diff --git a/lib/widgets/elements/Form/Text/Text/index.dart b/lib/widgets/elements/Form/Text/Text/index.dart index 95c15584..9cfc92f5 100644 --- a/lib/widgets/elements/Form/Text/Text/index.dart +++ b/lib/widgets/elements/Form/Text/Text/index.dart @@ -1,6 +1,6 @@ import 'package:flutter/material.dart'; //import 'package:flutter_markdown/flutter_markdown.dart'; -import '../../../../../common/widget-demo.dart'; +import '../../../../../common/widget_demo.dart'; import '../../../../../components/markdown.dart'; const String intro = """ @@ -79,7 +79,7 @@ class _Demo extends State { title: "Text", docUrl: 'flutter/widgets/Text-class.html', codeUrl: 'elements/Form/Text/Text/index.dart', - child: new Column( + contentList: [new Column( children: [ MarkdownBody(markDesc['intro']), Text( @@ -110,7 +110,7 @@ class _Demo extends State { ), ) ], - ) + )] ); } } diff --git a/lib/widgets/elements/Frame/Align/index.dart b/lib/widgets/elements/Frame/Align/index.dart index 65984579..a45c6ae3 100644 --- a/lib/widgets/elements/Frame/Align/index.dart +++ b/lib/widgets/elements/Frame/Align/index.dart @@ -1,5 +1,5 @@ import 'package:flutter/material.dart'; -import 'package:flutter_rookie_book/model/widget.dart'; +import 'package:flutter_go/model/widget.dart'; import './Align/index.dart' as Align; diff --git a/lib/widgets/elements/Frame/Spacing/SliverPadding/index.dart b/lib/widgets/elements/Frame/Spacing/SliverPadding/index.dart index fc536b24..451936b7 100644 --- a/lib/widgets/elements/Frame/Spacing/SliverPadding/index.dart +++ b/lib/widgets/elements/Frame/Spacing/SliverPadding/index.dart @@ -5,7 +5,7 @@ * @Last Modified time: 2018-11-28 20:39:28 */ import 'package:flutter/material.dart'; -import 'package:flutter_rookie_book/common/widget_demo.dart'; +import 'package:flutter_go/common/widget_demo.dart'; import './sliverpadding_demo.dart'; const contentDesc0 = ''' diff --git a/lib/widgets/elements/Frame/Stack/index.dart b/lib/widgets/elements/Frame/Stack/index.dart index e28b9c67..e24bf8b8 100644 --- a/lib/widgets/elements/Frame/Stack/index.dart +++ b/lib/widgets/elements/Frame/Stack/index.dart @@ -1,5 +1,5 @@ import 'package:flutter/material.dart'; -import 'package:flutter_rookie_book/model/widget.dart'; +import 'package:flutter_go/model/widget.dart'; import './Stack/index.dart' as Stack; import './IndexedStack/index.dart' as IndexedStack; diff --git a/lib/widgets/themes/Material/MaterialAccentColor/index.dart b/lib/widgets/themes/Material/MaterialAccentColor/index.dart index 1d0c220e..66f39a3a 100644 --- a/lib/widgets/themes/Material/MaterialAccentColor/index.dart +++ b/lib/widgets/themes/Material/MaterialAccentColor/index.dart @@ -1,6 +1,6 @@ import 'package:flutter/material.dart'; -import 'package:flutter_rookie_book/common/widget_demo.dart'; -import 'package:flutter_rookie_book/widgets/themes/Material/MaterialColor/demo.dart'; +import 'package:flutter_go/common/widget_demo.dart'; +import 'package:flutter_go/widgets/themes/Material/MaterialColor/demo.dart'; const Text0 = ''' ### **简介** diff --git a/lib/widgets/themes/Material/MaterialPageRoute/index.dart b/lib/widgets/themes/Material/MaterialPageRoute/index.dart index fee37767..0408084d 100644 --- a/lib/widgets/themes/Material/MaterialPageRoute/index.dart +++ b/lib/widgets/themes/Material/MaterialPageRoute/index.dart @@ -1,5 +1,5 @@ import 'package:flutter/material.dart'; -import 'package:flutter_rookie_book/common/widget_demo.dart'; +import 'package:flutter_go/common/widget_demo.dart'; import './demo.dart'; const Text0 = ''' diff --git a/pubspec.yaml b/pubspec.yaml index 7a74f787..1d9e769d 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,5 +1,5 @@ -name: flutter_rookie_book -description: flutter_rookie_book +name: flutter_go +description: flutter_go # The following defines the version and build number for your application. # A version number is three numbers separated by dots, like 1.2.43 diff --git a/test/widget_test.dart b/test/widget_test.dart index 6f5f270c..49aed263 100644 --- a/test/widget_test.dart +++ b/test/widget_test.dart @@ -7,7 +7,7 @@ import 'package:flutter/material.dart'; import 'package:flutter_test/flutter_test.dart'; -import 'package:flutter_rookie_book/main.dart'; +import 'package:flutter_go/main.dart'; void main() { testWidgets('Counter increments smoke test', (WidgetTester tester) async {