Dart & import show & import hide & import as & part & part of
// 部分导入,即仅仅导入 dart:ui 库里面的 Color 模块
import 'dart:ui' show Color;
https://riptutorial.com/dart/example/11450/importing-only-part-of-a-library
// Import only foo and bar.
import 'package:lib1/lib1.dart' show foo, bar;
// Import all names EXCEPT foo.
import 'package:lib2/lib2.dart' hide foo;
Learning dart eBook (PDF)
https://riptutorial.com/Download/dart.pdf
dart:ui & Color
https://api.flutter.dev/flutter/dart-ui/Color-class.html
https://github.com/flutter/engine/blob/master/lib/ui/ui.dart
Color demo
Color c = const Color(0xFF42A5F5);
Color c = const Color.fromARGB(0xFF, 0x42, 0xA5, 0xF5);
Color c = const Color.fromARGB(255, 66, 165, 245);
Color c = const Color.fromRGBO(66, 165, 245, 1.0);
Color c1 = const Color(0xFFFFFF);
// fully transparent white (invisible)
Color c2 = const Color(0xFFFFFFFF);
// fully opaque white (visible)
https://github.com/flutter/css_colors/blob/master/lib/css_colors.dart
import 'dart:ui' show Color;
class CSSColors {
static const Color aliceBlue = const Color(0xFFF0F8FF);
static const Color antiqueWhite = const Color(0xFFFAEBD7);
static const Color aqua = const Color(0xFF00FFFF);
static const Color aquamarine = const Color(0xFF7FFFD4);
static const Color azure = const Color(0xFFF0FFFF);
static const Color beige = const Color(0xFFF5F5DC);
static const Color bisque = const Color(0xFFFFE4C4);
static const Color black = const Color(0xFF000000);
static const Color blanchedAlmond = const Color(0xFFFFEBCD);
static const Color blue = const Color(0xFF0000FF);
static const Color blueViolet = const Color(0xFF8A2BE2);
static const Color brown = const Color(0xFFA52A2A);
static const Color burlyWood = const Color(0xFFDEB887);
static const Color cadetBlue = const Color(0xFF5F9EA0);
static const Color chartreuse = const Color(0xFF7FFF00);
static const Color chocolate = const Color(0xFFD2691E);
static const Color coral = const Color(0xFFFF7F50);
static const Color cornflowerBlue = const Color(0xFF6495ED);
static const Color cornsilk = const Color(0xFFFFF8DC);
static const Color crimson = const Color(0xFFDC143C);
static const Color cyan = const Color(0xFF00FFFF);
static const Color darkBlue = const Color(0xFF00008B);
static const Color darkCyan = const Color(0xFF008B8B);
static const Color darkGoldenRod = const Color(0xFFB8860B);
static const Color darkGray = const Color(0xFFA9A9A9);
static const Color darkGreen = const Color(0xFF006400);
static const Color darkGrey = const Color(0xFFA9A9A9);
static const Color darkKhaki = const Color(0xFFBDB76B);
static const Color darkMagenta = const Color(0xFF8B008B);
static const Color darkOliveGreen = const Color(0xFF556B2F);
static const Color darkOrange = const Color(0xFFFF8C00);
static const Color darkOrchid = const Color(0xFF9932CC);
static const Color darkRed = const Color(0xFF8B0000);
static const Color darkSalmon = const Color(0xFFE9967A);
static const Color darkSeaGreen = const Color(0xFF8FBC8F);
static const Color darkSlateBlue = const Color(0xFF483D8B);
static const Color darkSlateGray = const Color(0xFF2F4F4F);
static const Color darkSlateGrey = const Color(0xFF2F4F4F);
static const Color darkTurquoise = const Color(0xFF00CED1);
static const Color darkViolet = const Color(0xFF9400D3);
static const Color deepPink = const Color(0xFFFF1493);
static const Color deepSkyBlue = const Color(0xFF00BFFF);
static const Color dimGray = const Color(0xFF696969);
static const Color dimGrey = const Color(0xFF696969);
static const Color dodgerBlue = const Color(0xFF1E90FF);
static const Color fireBrick = const Color(0xFFB22222);
static const Color floralWhite = const Color(0xFFFFFAF0);
static const Color forestGreen = const Color(0xFF228B22);
static const Color fuchsia = const Color(0xFFFF00FF);
static const Color gainsboro = const Color(0xFFDCDCDC);
static const Color ghostWhite = const Color(0xFFF8F8FF);
static const Color gold = const Color(0xFFFFD700);
static const Color goldenRod = const Color(0xFFDAA520);
static const Color gray = const Color(0xFF808080);
static const Color green = const Color(0xFF008000);
static const Color greenYellow = const Color(0xFFADFF2F);
static const Color grey = const Color(0xFF808080);
static const Color honeyDew = const Color(0xFFF0FFF0);
static const Color hotPink = const Color(0xFFFF69B4);
static const Color indianRed = const Color(0xFFCD5C5C);
static const Color indigo = const Color(0xFF4B0082);
static const Color ivory = const Color(0xFFFFFFF0);
static const Color khaki = const Color(0xFFF0E68C);
static const Color lavender = const Color(0xFFE6E6FA);
static const Color lavenderBlush = const Color(0xFFFFF0F5);
static const Color lawnGreen = const Color(0xFF7CFC00);
static const Color lemonChiffon = const Color(0xFFFFFACD);
static const Color lightBlue = const Color(0xFFADD8E6);
static const Color lightCoral = const Color(0xFFF08080);
static const Color lightCyan = const Color(0xFFE0FFFF);
static const Color lightGoldenRodYellow = const Color(0xFFFAFAD2);
static const Color lightGray = const Color(0xFFD3D3D3);
static const Color lightGreen = const Color(0xFF90EE90);
static const Color lightGrey = const Color(0xFFD3D3D3);
static const Color lightPink = const Color(0xFFFFB6C1);
static const Color lightSalmon = const Color(0xFFFFA07A);
static const Color lightSeaGreen = const Color(0xFF20B2AA);
static const Color lightSkyBlue = const Color(0xFF87CEFA);
static const Color lightSlateGray = const Color(0xFF778899);
static const Color lightSlateGrey = const Color(0xFF778899);
static const Color lightSteelBlue = const Color(0xFFB0C4DE);
static const Color lightYellow = const Color(0xFFFFFFE0);
static const Color lime = const Color(0xFF00FF00);
static const Color limeGreen = const Color(0xFF32CD32);
static const Color linen = const Color(0xFFFAF0E6);
static const Color magenta = const Color(0xFFFF00FF);
static const Color maroon = const Color(0xFF800000);
static const Color mediumAquaMarine = const Color(0xFF66CDAA);
static const Color mediumBlue = const Color(0xFF0000CD);
static const Color mediumOrchid = const Color(0xFFBA55D3);
static const Color mediumPurple = const Color(0xFF9370DB);
static const Color mediumSeaGreen = const Color(0xFF3CB371);
static const Color mediumSlateBlue = const Color(0xFF7B68EE);
static const Color mediumSpringGreen = const Color(0xFF00FA9A);
static const Color mediumTurquoise = const Color(0xFF48D1CC);
static const Color mediumVioletRed = const Color(0xFFC71585);
static const Color midnightBlue = const Color(0xFF191970);
static const Color mintCream = const Color(0xFFF5FFFA);
static const Color mistyRose = const Color(0xFFFFE4E1);
static const Color moccasin = const Color(0xFFFFE4B5);
static const Color navajoWhite = const Color(0xFFFFDEAD);
static const Color navy = const Color(0xFF000080);
static const Color oldLace = const Color(0xFFFDF5E6);
static const Color olive = const Color(0xFF808000);
static const Color oliveDrab = const Color(0xFF6B8E23);
static const Color orange = const Color(0xFFFFA500);
static const Color orangeRed = const Color(0xFFFF4500);
static const Color orchid = const Color(0xFFDA70D6);
static const Color paleGoldenRod = const Color(0xFFEEE8AA);
static const Color paleGreen = const Color(0xFF98FB98);
static const Color paleTurquoise = const Color(0xFFAFEEEE);
static const Color paleVioletRed = const Color(0xFFDB7093);
static const Color papayaWhip = const Color(0xFFFFEFD5);
static const Color peachPuff = const Color(0xFFFFDAB9);
static const Color peru = const Color(0xFFCD853F);
static const Color pink = const Color(0xFFFFC0CB);
static const Color plum = const Color(0xFFDDA0DD);
static const Color powderBlue = const Color(0xFFB0E0E6);
static const Color purple = const Color(0xFF800080);
static const Color rebeccaPurple = const Color(0xFF663399);
static const Color red = const Color(0xFFFF0000);
static const Color rosyBrown = const Color(0xFFBC8F8F);
static const Color royalBlue = const Color(0xFF4169E1);
static const Color saddleBrown = const Color(0xFF8B4513);
static const Color salmon = const Color(0xFFFA8072);
static const Color sandyBrown = const Color(0xFFF4A460);
static const Color seaGreen = const Color(0xFF2E8B57);
static const Color seaShell = const Color(0xFFFFF5EE);
static const Color sienna = const Color(0xFFA0522D);
static const Color silver = const Color(0xFFC0C0C0);
static const Color skyBlue = const Color(0xFF87CEEB);
static const Color slateBlue = const Color(0xFF6A5ACD);
static const Color slateGray = const Color(0xFF708090);
static const Color slateGrey = const Color(0xFF708090);
static const Color snow = const Color(0xFFFFFAFA);
static const Color springGreen = const Color(0xFF00FF7F);
static const Color steelBlue = const Color(0xFF4682B4);
static const Color tan = const Color(0xFFD2B48C);
static const Color teal = const Color(0xFF008080);
static const Color thistle = const Color(0xFFD8BFD8);
static const Color tomato = const Color(0xFFFF6347);
static const Color turquoise = const Color(0xFF40E0D0);
static const Color violet = const Color(0xFFEE82EE);
static const Color wheat = const Color(0xFFF5DEB3);
static const Color white = const Color(0xFFFFFFFF);
static const Color whiteSmoke = const Color(0xFFF5F5F5);
static const Color yellow = const Color(0xFFFFFF00);
static const Color yellowGreen = const Color(0xFF9ACD32);
}
flutter material/colors
https://github.com/flutter/flutter/blob/master/packages/flutter/lib/src/material/colors.dart
https://github.com/flutter/flutter/blob/master/packages/flutter/lib/material.dart#L48
export 'src/material/colors.dart';
create-library-packages
创建 dart 库文件
https://dart.dev/guides/libraries/create-library-packages
https://github.com/flutter/flutter/blob/master/packages/flutter/pubspec.yaml
dart part
您可能听说过part指令,该指令可将库拆分为多个Dart文件。
我们建议您避免使用part而是创建小型库。
https://dart.dev/guides/libraries/create-library-packages#organizing-a-library-package
part of
https://livebook.manning.com/book/dart-in-action/chapter-5/1
demo
https://github.com/flutter/engine/blob/master/lib/ui/ui.dart
// @dart = 2.9
library dart.ui;
import 'dart:_internal' hide Symbol; // ignore: unused_import
import 'dart:async';
import 'dart:collection' as collection;
import 'dart:convert';
import 'dart:developer' as developer;
import 'dart:io'; // ignore: unused_import
import 'dart:isolate' show SendPort;
import 'dart:math' as math;
import 'dart:nativewrappers';
import 'dart:typed_data';
part 'annotations.dart';
part 'channel_buffers.dart';
part 'compositing.dart';
part 'geometry.dart';
part 'hash_codes.dart';
part 'hooks.dart';
part 'isolate_name_server.dart';
part 'lerp.dart';
part 'natives.dart';
part 'painting.dart';
part 'plugins.dart';
part 'pointer.dart';
part 'semantics.dart';
part 'text.dart';
part 'window.dart';
©xgqfrms 2012-2020
www.cnblogs.com 发布文章使用:只允许注册用户才可以访问!