├── .gitignore ├── .metadata ├── .vscode └── settings.json ├── CHANGELOG.md ├── LICENSE ├── README.md ├── analysis_options.yaml ├── example └── main.dart ├── lib ├── ant_design_flutter.dart └── src │ ├── enum │ ├── placement.dart │ ├── size.dart │ ├── status.dart │ ├── theme.dart │ └── trigger.dart │ ├── style │ ├── color.dart │ └── icon.dart │ └── widget │ ├── affix.dart │ ├── alert.dart │ ├── anchor.dart │ ├── app.dart │ ├── auto_complete.dart │ ├── avatar.dart │ ├── badge.dart │ ├── breadcrumb.dart │ ├── button.dart │ ├── calendar.dart │ ├── card.dart │ ├── carousel.dart │ ├── cascader.dart │ ├── checkbox.dart │ ├── collapse.dart │ ├── color_picker.dart │ ├── config_provider.dart │ ├── date_picker.dart │ ├── descriptions.dart │ ├── divider.dart │ ├── drawer.dart │ ├── dropdown.dart │ ├── empty.dart │ ├── flex.dart │ ├── float_button.dart │ ├── form.dart │ ├── grid.dart │ ├── icon.dart │ ├── image.dart │ ├── input.dart │ ├── input_number.dart │ ├── layout.dart │ ├── list.dart │ ├── mentions.dart │ ├── menu.dart │ ├── message.dart │ ├── modal.dart │ ├── nested_gesture_detector.dart │ ├── notification.dart │ ├── page_header.dart │ ├── pagination.dart │ ├── popconfirm.dart │ ├── popover.dart │ ├── progress.dart │ ├── qr_code.dart │ ├── radio.dart │ ├── rate.dart │ ├── result.dart │ ├── scaffold.dart │ ├── segmented.dart │ ├── select.dart │ ├── skeleton.dart │ ├── slider.dart │ ├── space.dart │ ├── spin.dart │ ├── statistic.dart │ ├── steps.dart │ ├── switch.dart │ ├── table.dart │ ├── tabs.dart │ ├── tag.dart │ ├── time_picker.dart │ ├── tooltip.dart │ ├── tour.dart │ ├── transfer.dart │ ├── tree.dart │ ├── tree_select.dart │ ├── typography.dart │ ├── upload.dart │ └── watermark.dart ├── pubspec.yaml └── test └── antdf_test.dart /.gitignore: -------------------------------------------------------------------------------- 1 | # Miscellaneous 2 | *.class 3 | *.log 4 | *.pyc 5 | *.swp 6 | .DS_Store 7 | .atom/ 8 | .buildlog/ 9 | .history 10 | .svn/ 11 | 12 | # IntelliJ related 13 | *.iml 14 | *.ipr 15 | *.iws 16 | .idea/ 17 | 18 | # The .vscode folder contains launch configuration and tasks you configure in 19 | # VS Code which you may wish to be included in version control, so this line 20 | # is commented out by default. 21 | #.vscode/ 22 | 23 | # Flutter/Dart/Pub related 24 | # Libraries should not include pubspec.lock, per https://dart.dev/guides/libraries/private-files#pubspeclock. 25 | /pubspec.lock 26 | **/doc/api/ 27 | .dart_tool/ 28 | .packages 29 | build/ 30 | -------------------------------------------------------------------------------- /.metadata: -------------------------------------------------------------------------------- 1 | # This file tracks properties of this Flutter project. 2 | # Used by Flutter tool to assess capabilities and perform upgrades etc. 3 | # 4 | # This file should be version controlled and should not be manually edited. 5 | 6 | version: 7 | revision: 7e9793dee1b85a243edd0e06cb1658e98b077561 8 | channel: stable 9 | 10 | project_type: package 11 | -------------------------------------------------------------------------------- /.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "cSpell.words": ["cascader", "vsync"] 3 | } 4 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | ## 0.0.1+5 2 | 3 | - Redesign color of button 4 | 5 | ## 0.0.1+4 6 | 7 | - Upgrade flutter_lints to 2.0 8 | - Some feature of Button widget 9 | 10 | ## 0.0.1+3 11 | 12 | - Hide raw MenuItem to avoid comflict since Flutter 3.0 brings PlatformMenuBar 13 | - Some feature of widgets 14 | 15 | ## 0.0.1+2 16 | 17 | - Remove 'Ant' prefix of some widgets and hide the same name raw widget to avoid comflict. 18 | 19 | ## 0.0.1+1 20 | 21 | - Update README.md. 22 | 23 | ## 0.0.1 24 | 25 | - Build some common widgets. 26 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT LICENSE 2 | 3 | Copyright (c) 2022 Cals Ranna, https://github.com/CalsRanna 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 6 | 7 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 8 | 9 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 10 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 |

2 | 3 | 4 | 5 |

6 | 7 |

Ant Design Flutter

8 | 9 |
10 | 11 | A Flutter UI framework designed for web / pc application, contains some high quality widgets. 12 | 13 | Since antdf is designed for pc application at very first, so it wasn't recommand to use in mobile application even can be used. 14 | 15 | ![Status](https://img.shields.io/badge/STATUS-WIP-orange?style=for-the-badge&color=blue) ![Pub Version](https://img.shields.io/pub/v/ant_design_flutter?style=for-the-badge) ![GitHub](https://img.shields.io/github/license/CalsRanna/ant_design_flutter?style=for-the-badge) 16 | 17 |
18 | 19 | [![](https://gw.alipayobjects.com/mdn/rms_08e378/afts/img/A*Yl83RJhUE7kAAAAAAAAAAABkARQnAQ)](https://doc.antdf.xyz) 20 | 21 | ## ✨ Features 22 | 23 | - 🌈 Enterprise-class UI designed for web / desktop applications. 24 | - 📦 A set of high-quality Flutter widgets out of the box. 25 | - 🛡 Written in pure Dart with null safety. 26 | 27 | ## 🖥 Environment Support 28 | 29 | - Working on Windows and Mac OS 30 | 31 | ## 📦 Install 32 | 33 | ```bash 34 | flutter pub add ant_design_flutter 35 | ``` 36 | 37 | ## 🔨 Usage 38 | 39 | ```dart 40 | import 'package:ant_design_flutter/antdf.dart'; 41 | 42 | void main() { 43 | runApp(const AntApp( 44 | home: Scaffold( 45 | body: Center( 46 | child: Button( 47 | type: ButtonType.primary, 48 | child: Text("Click Me"), 49 | ), 50 | ) 51 | ), 52 | )); 53 | } 54 | ``` 55 | 56 | ### Null Safety 57 | 58 | `antdf` is written in dart with null safety, check [Sound Null Safety](https://flutter.cn/posts/announcing-dart-2-12#%E5%81%A5%E5%85%A8%E7%9A%84%E7%A9%BA%E5%AE%89%E5%85%A8) to get started. 59 | 60 | ## 🔗 Links 61 | 62 | - [Home page](https://doc.antdf.xyz) 63 | - [Widgets Overview](https://doc.antdf.xyz/#/overview) 64 | 65 | ## ⌨️ Development 66 | 67 | Use Gitpod, a free online dev environment for GitHub. 68 | 69 | [![Open in Gitpod](https://gitpod.io/button/open-in-gitpod.svg)](https://gitpod.io/#https://github.com/CalsRanna/ant_design_flutter) 70 | 71 | Or clone locally: 72 | 73 | ```bash 74 | $ git git@github.com:CalsRanna/ant_design_flutter 75 | $ cd ant_design_flutter 76 | $ flutter pub get 77 | $ flutter run 78 | ``` 79 | 80 | Now flutter will run on the connected device in your environment. 81 | 82 | ## 🤝 Contributing [![PR Welcome](https://img.shields.io/badge/PR-WELCOME-brightgreen.svg?style=flat-square)](https://github.com/CalsRanna/ant_design_flutter/pulls) 83 | 84 | We welcome all contributions. You can submit any ideas as [pull requests](https://github.com/CalsRanna/ant_design_flutter/pulls) or as [GitHub issues](https://github.com/CalsRanna/ant_design_flutter/issues). 85 | 86 | [![Let's fund issues in this repository](https://issuehunt.io/static/embed/issuehunt-button-v1.svg)](https://issuehunt.io/r/CalsRanna/ant_design_flutter) 87 | 88 | ## ❤️ Sponsors and Backers 89 | -------------------------------------------------------------------------------- /analysis_options.yaml: -------------------------------------------------------------------------------- 1 | include: package:flutter_lints/flutter.yaml 2 | 3 | # Additional information about this file can be found at 4 | # https://dart.dev/guides/language/analysis-options 5 | -------------------------------------------------------------------------------- /example/main.dart: -------------------------------------------------------------------------------- 1 | import 'package:ant_design_flutter/ant_design_flutter.dart'; 2 | 3 | void main() { 4 | runApp(const MyApp()); 5 | } 6 | 7 | class MyApp extends StatefulWidget { 8 | const MyApp({Key? key}) : super(key: key); 9 | 10 | @override 11 | State createState() => _MyAppState(); 12 | } 13 | 14 | class _MyAppState extends State { 15 | int count = 0; 16 | 17 | @override 18 | Widget build(BuildContext context) { 19 | return AntApp( 20 | home: Scaffold( 21 | body: Center( 22 | child: Column( 23 | mainAxisAlignment: MainAxisAlignment.center, 24 | children: [ 25 | Text('You have clicked the button $count times'), 26 | const SizedBox(height: 8), 27 | Button( 28 | type: ButtonType.primary, 29 | onClick: () => setState(() => count++), 30 | child: const Text('Click'), 31 | ), 32 | ], 33 | ), 34 | ), 35 | ), 36 | ); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /lib/ant_design_flutter.dart: -------------------------------------------------------------------------------- 1 | /// Flutter widget implementing Ant Design. 2 | /// 3 | /// To use, import `package:ant_design_flutter/ant_design_flutter.dart`. 4 | library ant_design_flutter; 5 | 6 | export 'package:ant_design_flutter/src/enum/placement.dart'; 7 | export 'package:ant_design_flutter/src/enum/status.dart'; 8 | export 'package:ant_design_flutter/src/enum/size.dart'; 9 | export 'package:ant_design_flutter/src/enum/theme.dart'; 10 | export 'package:ant_design_flutter/src/enum/trigger.dart'; 11 | 12 | export 'package:ant_design_flutter/src/style/color.dart'; 13 | export 'package:ant_design_flutter/src/style/icon.dart'; 14 | 15 | export 'package:ant_design_flutter/src/widget/affix.dart'; 16 | export 'package:ant_design_flutter/src/widget/alert.dart'; 17 | export 'package:ant_design_flutter/src/widget/app.dart'; 18 | export 'package:ant_design_flutter/src/widget/auto_complete.dart'; 19 | export 'package:ant_design_flutter/src/widget/breadcrumb.dart'; 20 | export 'package:ant_design_flutter/src/widget/button.dart'; 21 | export 'package:ant_design_flutter/src/widget/card.dart'; 22 | export 'package:ant_design_flutter/src/widget/cascader.dart'; 23 | export 'package:ant_design_flutter/src/widget/checkbox.dart'; 24 | export 'package:ant_design_flutter/src/widget/date_picker.dart'; 25 | export 'package:ant_design_flutter/src/widget/divider.dart'; 26 | export 'package:ant_design_flutter/src/widget/drawer.dart'; 27 | export 'package:ant_design_flutter/src/widget/dropdown.dart'; 28 | export 'package:ant_design_flutter/src/widget/icon.dart'; 29 | export 'package:ant_design_flutter/src/widget/image.dart'; 30 | export 'package:ant_design_flutter/src/widget/input.dart'; 31 | export 'package:ant_design_flutter/src/widget/input_number.dart'; 32 | export 'package:ant_design_flutter/src/widget/layout.dart'; 33 | export 'package:ant_design_flutter/src/widget/modal.dart'; 34 | export 'package:ant_design_flutter/src/widget/menu.dart'; 35 | export 'package:ant_design_flutter/src/widget/message.dart'; 36 | export 'package:ant_design_flutter/src/widget/notification.dart'; 37 | export 'package:ant_design_flutter/src/widget/page_header.dart'; 38 | export 'package:ant_design_flutter/src/widget/pagination.dart'; 39 | export 'package:ant_design_flutter/src/widget/radio.dart'; 40 | export 'package:ant_design_flutter/src/widget/scaffold.dart'; 41 | export 'package:ant_design_flutter/src/widget/select.dart'; 42 | export 'package:ant_design_flutter/src/widget/slider.dart'; 43 | export 'package:ant_design_flutter/src/widget/space.dart'; 44 | export 'package:ant_design_flutter/src/widget/steps.dart'; 45 | export 'package:ant_design_flutter/src/widget/switch.dart'; 46 | export 'package:ant_design_flutter/src/widget/table.dart'; 47 | export 'package:ant_design_flutter/src/widget/tabs.dart'; 48 | export 'package:ant_design_flutter/src/widget/tag.dart'; 49 | export 'package:ant_design_flutter/src/widget/tooltip.dart'; 50 | export 'package:ant_design_flutter/src/widget/typography.dart'; 51 | 52 | export 'package:ant_design_flutter/src/widget/nested_gesture_detector.dart'; 53 | 54 | export 'package:flutter/widgets.dart' 55 | hide Icon, Image, Notification, Size, Table; 56 | -------------------------------------------------------------------------------- /lib/src/enum/placement.dart: -------------------------------------------------------------------------------- 1 | enum Placement { 2 | topLeft, 3 | top, 4 | topRight, 5 | rightTop, 6 | right, 7 | rightBottom, 8 | bottomRight, 9 | bottom, 10 | bottomLeft, 11 | leftBottom, 12 | left, 13 | leftTop, 14 | } 15 | -------------------------------------------------------------------------------- /lib/src/enum/size.dart: -------------------------------------------------------------------------------- 1 | enum Size { large, middle, small } 2 | -------------------------------------------------------------------------------- /lib/src/enum/status.dart: -------------------------------------------------------------------------------- 1 | enum Status { error, info, success, warning } 2 | -------------------------------------------------------------------------------- /lib/src/enum/theme.dart: -------------------------------------------------------------------------------- 1 | enum Theme { light, dark } 2 | -------------------------------------------------------------------------------- /lib/src/enum/trigger.dart: -------------------------------------------------------------------------------- 1 | enum Trigger { hover, focus, click, contextMenu } 2 | -------------------------------------------------------------------------------- /lib/src/style/color.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/widgets.dart'; 2 | 3 | class Colors { 4 | static const red_1 = Color(0xfffff1f0); 5 | static const red_2 = Color(0xffffccc7); 6 | static const red_3 = Color(0xffffa39e); 7 | static const red_4 = Color(0xffff7875); 8 | static const red_5 = Color(0xffff4d4f); 9 | static const red_6 = Color(0xfff5222d); 10 | static const red_7 = Color(0xffcf1322); 11 | static const red_8 = Color(0xffa8071a); 12 | static const red_9 = Color(0xff820014); 13 | static const red_10 = Color(0xff5c0011); 14 | 15 | static const volcano_1 = Color(0xfffff2e8); 16 | static const volcano_2 = Color(0xffffd8bf); 17 | static const volcano_3 = Color(0xffffbb96); 18 | static const volcano_4 = Color(0xffff9c6e); 19 | static const volcano_5 = Color(0xffff7a45); 20 | static const volcano_6 = Color(0xfffa541c); 21 | static const volcano_7 = Color(0xffd4380d); 22 | static const volcano_8 = Color(0xffad2102); 23 | static const volcano_9 = Color(0xff871400); 24 | static const volcano_10 = Color(0xff610b00); 25 | 26 | static const orange_1 = Color(0xfffff7e6); 27 | static const orange_2 = Color(0xffffe7ba); 28 | static const orange_3 = Color(0xffffd591); 29 | static const orange_4 = Color(0xffffc069); 30 | static const orange_5 = Color(0xffffa940); 31 | static const orange_6 = Color(0xfffa8c16); 32 | static const orange_7 = Color(0xffd46b08); 33 | static const orange_8 = Color(0xffad4e00); 34 | static const orange_9 = Color(0xff873800); 35 | static const orange_10 = Color(0xff612500); 36 | 37 | static const gold_1 = Color(0xfffffbe6); 38 | static const gold_2 = Color(0xfffff1b8); 39 | static const gold_3 = Color(0xffffe58f); 40 | static const gold_4 = Color(0xffffd666); 41 | static const gold_5 = Color(0xffffc53d); 42 | static const gold_6 = Color(0xfffaad14); 43 | static const gold_7 = Color(0xffd48806); 44 | static const gold_8 = Color(0xffad6800); 45 | static const gold_9 = Color(0xff874d00); 46 | static const gold_10 = Color(0xff613400); 47 | 48 | static const yellow_1 = Color(0xfffeffe6); 49 | static const yellow_2 = Color(0xffffffb8); 50 | static const yellow_3 = Color(0xfffffb8f); 51 | static const yellow_4 = Color(0xfffff566); 52 | static const yellow_5 = Color(0xffffec3d); 53 | static const yellow_6 = Color(0xfffadb14); 54 | static const yellow_7 = Color(0xffd4b106); 55 | static const yellow_8 = Color(0xffad8b00); 56 | static const yellow_9 = Color(0xff876800); 57 | static const yellow_10 = Color(0xff614700); 58 | 59 | static const lime_1 = Color(0xfffcffe6); 60 | static const lime_2 = Color(0xfff4ffb8); 61 | static const lime_3 = Color(0xffeaff8f); 62 | static const lime_4 = Color(0xffd3f261); 63 | static const lime_5 = Color(0xffbae637); 64 | static const lime_6 = Color(0xffa0d911); 65 | static const lime_7 = Color(0xff7cb305); 66 | static const lime_8 = Color(0xff5b8c00); 67 | static const lime_9 = Color(0xff3f6600); 68 | static const lime_10 = Color(0xff254000); 69 | 70 | static const green_1 = Color(0xfff6ffed); 71 | static const green_2 = Color(0xffd9f7be); 72 | static const green_3 = Color(0xffb7eb8f); 73 | static const green_4 = Color(0xff95de64); 74 | static const green_5 = Color(0xff73d13d); 75 | static const green_6 = Color(0xff52c41a); 76 | static const green_7 = Color(0xff389e0d); 77 | static const green_8 = Color(0xff237804); 78 | static const green_9 = Color(0xff135200); 79 | static const green_10 = Color(0xff092b00); 80 | 81 | static const cyan_1 = Color(0xffe6fffb); 82 | static const cyan_2 = Color(0xffb5f5ec); 83 | static const cyan_3 = Color(0xff87e8de); 84 | static const cyan_4 = Color(0xff5cdbd3); 85 | static const cyan_5 = Color(0xff36cfc9); 86 | static const cyan_6 = Color(0xff13c2c2); 87 | static const cyan_7 = Color(0xff08979c); 88 | static const cyan_8 = Color(0xff006d75); 89 | static const cyan_9 = Color(0xff00474f); 90 | static const cyan_10 = Color(0xff002329); 91 | 92 | static const blue_1 = Color(0xffe6f7ff); 93 | static const blue_2 = Color(0xffbae7ff); 94 | static const blue_3 = Color(0xff91d5ff); 95 | static const blue_4 = Color(0xff69c0ff); 96 | static const blue_5 = Color(0xff40a9ff); 97 | static const blue_6 = Color(0xff1890ff); 98 | static const blue_7 = Color(0xff096dd9); 99 | static const blue_8 = Color(0xff0050b3); 100 | static const blue_9 = Color(0xff003a8c); 101 | static const blue_10 = Color(0xff002766); 102 | 103 | static const geekblue_1 = Color(0xfff0f5ff); 104 | static const geekblue_2 = Color(0xffd6e4ff); 105 | static const geekblue_3 = Color(0xffadc6ff); 106 | static const geekblue_4 = Color(0xff85a5ff); 107 | static const geekblue_5 = Color(0xff597ef7); 108 | static const geekblue_6 = Color(0xff2f54eb); 109 | static const geekblue_7 = Color(0xff1d39c4); 110 | static const geekblue_8 = Color(0xff10239e); 111 | static const geekblue_9 = Color(0xff061178); 112 | static const geekblue_10 = Color(0xff030852); 113 | 114 | static const purple_1 = Color(0xfff9f0ff); 115 | static const purple_2 = Color(0xffefdbff); 116 | static const purple_3 = Color(0xffd3adf7); 117 | static const purple_4 = Color(0xffb37feb); 118 | static const purple_5 = Color(0xff9254de); 119 | static const purple_6 = Color(0xff722ed1); 120 | static const purple_7 = Color(0xff531dab); 121 | static const purple_8 = Color(0xff391085); 122 | static const purple_9 = Color(0xff22075e); 123 | static const purple_10 = Color(0xff120338); 124 | 125 | static const magenta_1 = Color(0xfffff0f6); 126 | static const magenta_2 = Color(0xffffd6e7); 127 | static const magenta_3 = Color(0xffffadd2); 128 | static const magenta_4 = Color(0xffff85c0); 129 | static const magenta_5 = Color(0xfff759ab); 130 | static const magenta_6 = Color(0xffeb2f96); 131 | static const magenta_7 = Color(0xffc41d7f); 132 | static const magenta_8 = Color(0xff9e1068); 133 | static const magenta_9 = Color(0xff780650); 134 | static const magenta_10 = Color(0xff520339); 135 | 136 | static const gray_1 = Color(0xffffffff); 137 | static const gray_2 = Color(0xfffafafa); 138 | static const gray_3 = Color(0xfff5f5f5); 139 | static const gray_4 = Color(0xfff0f0f0); 140 | static const gray_5 = Color(0xffd9d9d9); 141 | static const gray_6 = Color(0xffbfbfbf); 142 | static const gray_7 = Color(0xff8c8c8c); 143 | static const gray_8 = Color(0xff595959); 144 | static const gray_9 = Color(0xff434343); 145 | static const gray_10 = Color(0xff262626); 146 | static const gray_11 = Color(0xff1f1f1f); 147 | static const gray_12 = Color(0xff141414); 148 | static const gray_13 = Color(0xff000000); 149 | 150 | static const black = Color(0xff000000); 151 | static const transparent = Color(0x00000000); 152 | static const white = Color(0xffffffff); 153 | } 154 | -------------------------------------------------------------------------------- /lib/src/style/icon.dart: -------------------------------------------------------------------------------- 1 | // ignore_for_file: constant_identifier_names 2 | 3 | import 'package:flutter/material.dart' as material show Icons; 4 | 5 | class Icons { 6 | /// arrow_back — material icon named "arrow left". 7 | static const arrow_left = material.Icons.arrow_back; 8 | 9 | /// arrow_forward — material icon named "arrow right". 10 | static const arrow_right = material.Icons.arrow_forward; 11 | 12 | /// check — material icon named "check". 13 | static const check = material.Icons.check; 14 | 15 | /// expand_more — material icon named "chevron down". 16 | static const chevron_down = material.Icons.expand_more; 17 | 18 | /// chevron_left — material icon named "chevron left". 19 | static const chevron_left = material.Icons.chevron_left; 20 | 21 | /// chevron_right — material icon named "chevron right". 22 | static const chevron_right = material.Icons.chevron_right; 23 | 24 | /// expand_less — material icon named "chevron up". 25 | static const chevron_up = material.Icons.expand_less; 26 | 27 | /// cancel — material icon named "clear". 28 | static const clear = material.Icons.cancel; 29 | 30 | /// close — material icon named "close". 31 | static const close = material.Icons.close; 32 | 33 | /// code — material icon named "code". 34 | static const code = material.Icons.code; 35 | 36 | /// copy_all — material icon named "copy". 37 | static const copy = material.Icons.copy_all; 38 | 39 | /// view_in_ar — material icon named "dart pad". 40 | static const dart_pad = material.Icons.view_in_ar; 41 | 42 | /// bug_report — material icon named "debug". 43 | static const debug = material.Icons.bug_report; 44 | 45 | /// download — material icon named "download". 46 | static const download = material.Icons.download; 47 | 48 | /// cancel — material icon named "error". 49 | static const error = material.Icons.cancel; 50 | 51 | /// info — material icon named "info". 52 | static const info = material.Icons.info; 53 | 54 | /// autorenew — material icon named "loading". 55 | static const loading = material.Icons.autorenew; 56 | 57 | /// power_settings_new — material icon named "power off". 58 | static const power_off = material.Icons.power_settings_new; 59 | 60 | /// search — material icon named "search". 61 | static const search = material.Icons.search; 62 | 63 | /// check_circle — material icon named "success". 64 | static const success = material.Icons.check_circle; 65 | 66 | /// error — material icon named "warning". 67 | static const warning = material.Icons.error; 68 | } 69 | -------------------------------------------------------------------------------- /lib/src/widget/affix.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/widgets.dart'; 2 | 3 | class Affix extends StatefulWidget { 4 | const Affix({ 5 | Key? key, 6 | required this.child, 7 | this.offsetBottom, 8 | this.offsetTop = 0, 9 | this.target, 10 | this.onChange, 11 | }) : super(key: key); 12 | 13 | final Widget child; 14 | final double? offsetBottom; 15 | final double offsetTop; 16 | final void Function()? target; 17 | final void Function(bool affixed)? onChange; 18 | 19 | @override 20 | State createState() => _AffixState(); 21 | } 22 | 23 | class _AffixState extends State { 24 | @override 25 | Widget build(BuildContext context) { 26 | return widget.child; 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /lib/src/widget/alert.dart: -------------------------------------------------------------------------------- 1 | import 'package:ant_design_flutter/src/enum/status.dart'; 2 | import 'package:ant_design_flutter/src/style/color.dart'; 3 | import 'package:ant_design_flutter/src/style/icon.dart'; 4 | import 'package:flutter/widgets.dart'; 5 | 6 | class Alert extends StatefulWidget { 7 | const Alert({ 8 | Key? key, 9 | this.action, 10 | this.afterClose, 11 | this.banner = false, 12 | this.closable, 13 | this.closeText, 14 | this.closeIcon = const Icon(Icons.close), 15 | this.description, 16 | this.icon, 17 | required this.message, 18 | this.showIcon = false, 19 | this.type = Status.info, 20 | this.onClose, 21 | }) : super(key: key); 22 | 23 | final Widget? action; 24 | final void Function()? afterClose; 25 | final bool banner; 26 | final bool? closable; 27 | final Widget? closeText; 28 | final Widget closeIcon; 29 | final Widget? description; 30 | final Widget? icon; 31 | final Widget message; 32 | final bool showIcon; 33 | final Status type; 34 | final void Function()? onClose; 35 | 36 | @override 37 | State createState() => _AlertState(); 38 | } 39 | 40 | class _AlertState extends State { 41 | @override 42 | Widget build(BuildContext context) { 43 | return Container( 44 | decoration: BoxDecoration( 45 | border: Border.all(color: Colors.blue_3), 46 | borderRadius: BorderRadius.circular(2), 47 | color: Colors.blue_1, 48 | ), 49 | padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 8), 50 | width: double.infinity, 51 | child: widget.message, 52 | ); 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /lib/src/widget/anchor.dart: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CalsRanna/ant_design_flutter/719d321fd738d81e73da59375ee91b8562e6ceae/lib/src/widget/anchor.dart -------------------------------------------------------------------------------- /lib/src/widget/app.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart' show MaterialApp; 2 | import 'package:flutter/widgets.dart'; 3 | 4 | /// An application that uses Ant Design. 5 | /// 6 | /// A root widget which should be used as the application entry point. It provide 7 | /// [GlobalQuery] to solve overlay entry's offset and other feature. 8 | /// 9 | /// It basic was a sub class of Material App and some few params provided to use. 10 | class AntApp extends StatefulWidget { 11 | const AntApp({ 12 | Key? key, 13 | this.home, 14 | this.showPerformanceOverlay = false, 15 | }) : routeInformationParser = null, 16 | routerDelegate = null, 17 | super(key: key); 18 | 19 | const AntApp.router({ 20 | Key? key, 21 | required this.showPerformanceOverlay, 22 | required this.routeInformationParser, 23 | required this.routerDelegate, 24 | }) : home = null, 25 | super(key: key); 26 | 27 | final Widget? home; 28 | final bool showPerformanceOverlay; 29 | final RouteInformationParser? routeInformationParser; 30 | final RouterDelegate? routerDelegate; 31 | 32 | @override 33 | State createState() => _AntAppState(); 34 | } 35 | 36 | class _AntAppState extends State { 37 | int messageCount = 0; 38 | Map tops = {}; 39 | Map notificationTops = {}; 40 | 41 | @override 42 | Widget build(BuildContext context) { 43 | Widget app = MaterialApp( 44 | debugShowCheckedModeBanner: false, 45 | home: widget.home, 46 | showPerformanceOverlay: widget.showPerformanceOverlay, 47 | ); 48 | if (widget.routerDelegate != null) { 49 | app = MaterialApp.router( 50 | debugShowCheckedModeBanner: false, 51 | routeInformationParser: widget.routeInformationParser!, 52 | routerDelegate: widget.routerDelegate!, 53 | showPerformanceOverlay: widget.showPerformanceOverlay, 54 | ); 55 | } 56 | 57 | return GlobalQuery( 58 | tops: tops, 59 | notificationTops: notificationTops, 60 | insert: _insert, 61 | remove: _remove, 62 | insertNotification: _insertNotification, 63 | removeNotification: _removeNotification, 64 | child: app, 65 | ); 66 | } 67 | 68 | void _insert(ValueKey key, double top) { 69 | setState(() { 70 | tops[key] = top; 71 | }); 72 | } 73 | 74 | void _remove(ValueKey key) { 75 | setState(() { 76 | tops.remove(key); 77 | }); 78 | } 79 | 80 | void _insertNotification(Key key, double top) { 81 | setState(() { 82 | notificationTops[key] = top; 83 | }); 84 | } 85 | 86 | void _removeNotification(Key key) { 87 | setState(() { 88 | notificationTops.remove(key); 89 | }); 90 | } 91 | } 92 | 93 | class GlobalQuery extends InheritedWidget { 94 | const GlobalQuery({ 95 | Key? key, 96 | required Widget child, 97 | required this.tops, 98 | required this.notificationTops, 99 | required this.insert(ValueKey key, double top), 100 | required this.remove(ValueKey key), 101 | required this.insertNotification(Key key, double top), 102 | required this.removeNotification(Key key), 103 | }) : super(key: key, child: child); 104 | 105 | final Map tops; 106 | final Map notificationTops; 107 | final void Function(ValueKey key, double top) insert; 108 | final void Function(ValueKey key) remove; 109 | final void Function(Key key, double top) insertNotification; 110 | final void Function(Key key) removeNotification; 111 | 112 | static GlobalQuery? of(BuildContext context) { 113 | return context.dependOnInheritedWidgetOfExactType(); 114 | } 115 | 116 | @override 117 | bool updateShouldNotify(GlobalQuery oldWidget) { 118 | return oldWidget.tops != tops || 119 | oldWidget.notificationTops != notificationTops; 120 | } 121 | } 122 | -------------------------------------------------------------------------------- /lib/src/widget/auto_complete.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/widgets.dart'; 2 | 3 | class AutoComplete extends StatefulWidget { 4 | const AutoComplete( 5 | {Key? key, 6 | this.allowClear = false, 7 | this.autoFocus = false, 8 | this.backfill = false, 9 | this.chidlren, 10 | this.defaultActiveFirstOption = true, 11 | this.defaultOpen, 12 | this.defaultValue, 13 | this.disabled = false, 14 | this.dropdownMatchSelectWidth, 15 | this.filterOption = true, 16 | this.getPopupContainer, 17 | this.notFoundContent, 18 | this.open, 19 | this.options, 20 | this.placeholder, 21 | this.status, 22 | this.value, 23 | this.onBlur, 24 | this.onChange, 25 | this.onDropdownVisibleChange, 26 | this.onFocus, 27 | this.onSearch, 28 | this.onSelect, 29 | this.onClear}) 30 | : super(key: key); 31 | 32 | final bool allowClear; 33 | final bool autoFocus; 34 | final bool backfill; 35 | final List? chidlren; 36 | final bool defaultActiveFirstOption; 37 | final bool? defaultOpen; 38 | final String? defaultValue; 39 | final bool disabled; 40 | final double? dropdownMatchSelectWidth; 41 | final bool filterOption; 42 | final Widget Function()? getPopupContainer; 43 | final Widget? notFoundContent; 44 | final bool? open; 45 | final List>? options; 46 | final String? placeholder; 47 | final AutoCompleteStatus? status; 48 | final String? value; 49 | final void Function()? onBlur; 50 | final void Function(String value)? onChange; 51 | final void Function(bool open)? onDropdownVisibleChange; 52 | final void Function()? onFocus; 53 | final void Function(String value)? onSearch; 54 | final void Function(String value, Map option)? onSelect; 55 | final void Function()? onClear; 56 | 57 | @override 58 | State createState() => _AutoCompleteState(); 59 | 60 | void blur() {} 61 | 62 | void focus() {} 63 | } 64 | 65 | class _AutoCompleteState extends State { 66 | @override 67 | Widget build(BuildContext context) { 68 | return Container(); 69 | } 70 | } 71 | 72 | enum AutoCompleteStatus { error, warning } 73 | -------------------------------------------------------------------------------- /lib/src/widget/avatar.dart: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CalsRanna/ant_design_flutter/719d321fd738d81e73da59375ee91b8562e6ceae/lib/src/widget/avatar.dart -------------------------------------------------------------------------------- /lib/src/widget/badge.dart: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CalsRanna/ant_design_flutter/719d321fd738d81e73da59375ee91b8562e6ceae/lib/src/widget/badge.dart -------------------------------------------------------------------------------- /lib/src/widget/breadcrumb.dart: -------------------------------------------------------------------------------- 1 | import 'package:ant_design_flutter/src/style/color.dart'; 2 | import 'package:flutter/widgets.dart'; 3 | 4 | class Breadcrumb extends StatelessWidget { 5 | const Breadcrumb({ 6 | Key? key, 7 | this.children, 8 | this.itemBuilder, 9 | this.itemCount, 10 | this.params, 11 | this.separator, 12 | }) : super(key: key); 13 | 14 | final List? children; 15 | final Widget Function(BuildContext context, int index)? itemBuilder; 16 | final int? itemCount; 17 | final Map? params; 18 | final Widget? separator; 19 | 20 | @override 21 | Widget build(BuildContext context) { 22 | return _BreadcrumbInhertedWidget( 23 | current: _getCurrent(context), 24 | child: Row( 25 | children: _buildChildren(context), 26 | ), 27 | ); 28 | } 29 | 30 | List _buildChildren(BuildContext context) { 31 | var realSeparator = separator ?? 32 | const Padding( 33 | padding: EdgeInsets.symmetric(horizontal: 8), 34 | child: Text( 35 | '/', 36 | style: TextStyle(color: Colors.gray_7, height: 1), 37 | ), 38 | ); 39 | final List children = []; 40 | if (itemBuilder != null && itemCount != null) { 41 | for (int i = 0; i < itemCount!; i++) { 42 | children.add(itemBuilder!(context, i)); 43 | if (i != itemCount! - 1) { 44 | children.add(realSeparator); 45 | } 46 | } 47 | } else { 48 | for (int i = 0; i < children.length; i++) { 49 | children.add(children[i]); 50 | if (i != children.length - 1) { 51 | children.add(realSeparator); 52 | } 53 | } 54 | } 55 | return children; 56 | } 57 | 58 | String _getCurrent(BuildContext context) { 59 | BreadcrumbItem? currentWidget; 60 | if (itemBuilder != null && itemCount != null) { 61 | currentWidget = itemBuilder!(context, itemCount! - 1) as BreadcrumbItem; 62 | } else if (children != null) { 63 | currentWidget = children![children!.length - 1] as BreadcrumbItem; 64 | } 65 | return currentWidget?.href ?? ''; 66 | } 67 | } 68 | 69 | class BreadcrumbItem extends StatefulWidget { 70 | const BreadcrumbItem({ 71 | Key? key, 72 | required this.child, 73 | required this.href, 74 | this.onClick, 75 | }) : super(key: key); 76 | 77 | final Widget child; 78 | final String href; 79 | final void Function()? onClick; 80 | 81 | @override 82 | State createState() => _BreadcrumbItemState(); 83 | } 84 | 85 | class _BreadcrumbItemState extends State { 86 | bool hovered = false; 87 | 88 | @override 89 | Widget build(BuildContext context) { 90 | var current = _BreadcrumbInhertedWidget.of(context)!.current; 91 | return widget.href != current 92 | ? MouseRegion( 93 | cursor: SystemMouseCursors.click, 94 | onEnter: (_) { 95 | setState(() { 96 | hovered = true; 97 | }); 98 | }, 99 | onExit: (_) { 100 | setState(() { 101 | hovered = false; 102 | }); 103 | }, 104 | child: DefaultTextStyle.merge( 105 | style: TextStyle( 106 | color: hovered ? Colors.blue_6 : Colors.gray_7, 107 | ), 108 | child: widget.child, 109 | ), 110 | ) 111 | : DefaultTextStyle.merge( 112 | style: const TextStyle(color: Colors.black), 113 | child: widget.child, 114 | ); 115 | } 116 | } 117 | 118 | class BreadcrumbSeparator extends StatelessWidget { 119 | const BreadcrumbSeparator({Key? key, required this.child}) : super(key: key); 120 | 121 | final Widget child; 122 | 123 | @override 124 | Widget build(BuildContext context) { 125 | return const Padding( 126 | padding: EdgeInsets.symmetric(horizontal: 8), 127 | child: Text( 128 | '/', 129 | style: TextStyle(color: Colors.gray_7, height: 1), 130 | ), 131 | ); 132 | } 133 | } 134 | 135 | class _BreadcrumbInhertedWidget extends InheritedWidget { 136 | const _BreadcrumbInhertedWidget({ 137 | Key? key, 138 | required this.current, 139 | required Widget child, 140 | }) : super(key: key, child: child); 141 | 142 | final String current; 143 | 144 | static _BreadcrumbInhertedWidget? of(BuildContext context) { 145 | return context 146 | .dependOnInheritedWidgetOfExactType<_BreadcrumbInhertedWidget>(); 147 | } 148 | 149 | @override 150 | bool updateShouldNotify(_BreadcrumbInhertedWidget oldWidget) { 151 | return oldWidget.current != current; 152 | } 153 | } 154 | -------------------------------------------------------------------------------- /lib/src/widget/button.dart: -------------------------------------------------------------------------------- 1 | import 'package:ant_design_flutter/src/enum/size.dart'; 2 | import 'package:ant_design_flutter/src/style/color.dart'; 3 | import 'package:ant_design_flutter/src/style/icon.dart'; 4 | import 'package:dotted_border/dotted_border.dart'; 5 | import 'package:flutter/gestures.dart'; 6 | import 'package:flutter/widgets.dart'; 7 | 8 | /// [Button] is completely a [Container] but can be clicked. 9 | /// 10 | /// Its height is determined by [size] and [shape], and can't override. 11 | /// 12 | /// At least one of [child], [icon] must be non-null. 13 | class Button extends StatefulWidget { 14 | const Button({ 15 | Key? key, 16 | this.block = false, 17 | this.danger = false, 18 | this.disabled = false, 19 | this.ghost = false, 20 | this.href, 21 | this.icon, 22 | this.loading = false, 23 | this.shape = ButtonShape.square, 24 | this.size = Size.middle, 25 | this.type = ButtonType.normal, 26 | this.onClick, 27 | this.child, 28 | }) : assert(child != null || icon != null, 29 | 'Child and icon can not be both null'), 30 | super(key: key); 31 | 32 | final bool block; 33 | final bool danger; 34 | final bool disabled; 35 | final bool ghost; 36 | final String? href; 37 | final Widget? icon; 38 | final bool loading; 39 | final ButtonShape shape; 40 | final Size size; 41 | final ButtonType type; 42 | final void Function()? onClick; 43 | final Widget? child; 44 | 45 | @override 46 | State