diff --git a/CHANGELOG.md b/CHANGELOG.md index ac07159..937a6d5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,5 @@ -## [0.0.1] - TODO: Add release date. +# CHANGELOGS -* TODO: Describe initial release. +## [0.0.2] - first release + +## [0.0.1] - init Repo diff --git a/example/lib/data/color_object.dart b/example/lib/data/color_object.dart new file mode 100644 index 0000000..c5a1601 --- /dev/null +++ b/example/lib/data/color_object.dart @@ -0,0 +1,46 @@ +import 'package:ansu_ui/ansu_ui.dart'; +import 'package:flutter/material.dart'; + +class ColorObject { + Color color; + String name; + String codeName; + ColorObject({ + this.color, + this.name, + this.codeName, + }); +} + +List colorObjects = [ + ColorObject( + color: Color(0xFF333333), + name: '主要暗色', + codeName: 'kDarkColor', + ), + ColorObject( + color: kDarkColor, + name: '文本默认颜色', + codeName: 'kTextColor', + ), + ColorObject( + color: Color.fromRGBO(0, 0, 0, 0.65), + name: '次文本颜色', + codeName: 'kTextSubColor', + ), + ColorObject( + color: Color(0xFFF6B72D), + name: '主题色', + codeName: 'kPrimaryColor', + ), + ColorObject( + color: Color(0xFFFFFFFF), + name: '前景色', + codeName: 'kForegroundColor', + ), + ColorObject( + color: Color(0xFFF6F6F6), + name: '背景色', + codeName: 'kBackgroundColor', + ), +]; diff --git a/example/lib/example_style_color.dart b/example/lib/example_style_color.dart new file mode 100644 index 0000000..5edc661 --- /dev/null +++ b/example/lib/example_style_color.dart @@ -0,0 +1,39 @@ +import 'package:flutter/material.dart'; +import 'package:example/data/color_object.dart'; +import 'package:ansu_ui/ansu_ui.dart'; + +class ExampleStyleColor extends StatefulWidget { + ExampleStyleColor({Key key}) : super(key: key); + + @override + _ExampleStyleColorState createState() => _ExampleStyleColorState(); +} + +class _ExampleStyleColorState extends State { + _buildCard(ColorObject object) { + return Column( + children: [ + Text(object.name), + Text(object.codeName), + Card( + color: object.color, + child: SizedBox(height: 50.w, width: double.infinity), + ), + SizedBox(height: 16.w), + ], + ); + } + + @override + Widget build(BuildContext context) { + return ASScaffold( + title: 'Color', + body: ListView.builder( + itemBuilder: (context, index) { + return _buildCard(colorObjects[index]); + }, + itemCount: colorObjects.length, + ), + ); + } +} diff --git a/example/lib/main.dart b/example/lib/main.dart index c341306..e2b209f 100644 --- a/example/lib/main.dart +++ b/example/lib/main.dart @@ -10,6 +10,7 @@ import 'example_scaffold.dart'; import 'example_button.dart'; import 'example_tab_bar.dart'; import 'example_picker.dart'; +import 'example_style_color.dart'; void main() { runApp(MyApp()); @@ -59,6 +60,9 @@ class _MyHomePageState extends State { children: [ Image.asset('assets/logo.webp', height: 50), SizedBox(height: 16.w), + ASButton.info( + title: '颜色 Style Color', + onPressed: () => Get.to(ExampleStyleColor())), ASButton.info( title: '按钮 Button', onPressed: () => Get.to(ExampleButton())), ASButton.info( diff --git a/example/pubspec.lock b/example/pubspec.lock index 3690eee..c64d43b 100644 --- a/example/pubspec.lock +++ b/example/pubspec.lock @@ -7,7 +7,7 @@ packages: path: ".." relative: true source: path - version: "0.0.1" + version: "0.0.2" async: dependency: transitive description: diff --git a/lib/bar/as_tabbar.dart b/lib/bar/as_tabbar.dart index 9da69d4..033efa1 100644 --- a/lib/bar/as_tabbar.dart +++ b/lib/bar/as_tabbar.dart @@ -8,7 +8,10 @@ import 'package:flutter/material.dart'; /// /// [controller] see more TabController class ASTabBar extends StatefulWidget implements PreferredSizeWidget { + ///items final List items; + + /// TabController final TabController controller; ///可滚动 @@ -30,22 +33,25 @@ class ASTabBar extends StatefulWidget implements PreferredSizeWidget { class _ASTabBarState extends State { @override Widget build(BuildContext context) { - return TabBar( - isScrollable: widget.isScrollable, - controller: widget.controller, - tabs: widget.items.map((e) => Tab(text: e)).toList(), - labelStyle: TextStyle( - fontSize: 14, - fontWeight: FontWeight.bold, - ), - unselectedLabelStyle: TextStyle( - fontWeight: FontWeight.normal, + return Align( + alignment: Alignment.center, + child: TabBar( + isScrollable: widget.isScrollable, + controller: widget.controller, + tabs: widget.items.map((e) => Tab(text: e)).toList(), + labelStyle: TextStyle( + fontSize: 14, + fontWeight: FontWeight.bold, + ), + unselectedLabelStyle: TextStyle( + fontWeight: FontWeight.normal, + ), + labelColor: kTextColor, + unselectedLabelColor: kTextSubColor, + indicatorSize: TabBarIndicatorSize.label, + indicatorPadding: EdgeInsets.zero, + indicator: ASTabIndicator(), ), - labelColor: kTextColor, - unselectedLabelColor: kTextSubColor, - indicatorSize: TabBarIndicatorSize.label, - indicatorPadding: EdgeInsets.zero, - indicator: ASTabIndicator(), ); } } diff --git a/lib/styles/as_colors.dart b/lib/styles/as_colors.dart index 7ad10d6..a287086 100644 --- a/lib/styles/as_colors.dart +++ b/lib/styles/as_colors.dart @@ -6,6 +6,7 @@ const Color kDarkColor = Color(0xFF333333); ///文本默认颜色 const Color kTextColor = kDarkColor; +///次文本颜色 const Color kTextSubColor = Color.fromRGBO(0, 0, 0, 0.65); ///主题色 diff --git a/pubspec.yaml b/pubspec.yaml index 8e6c041..aa9dcf8 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,6 +1,6 @@ name: ansu_ui description: A new Flutter package. -version: 0.0.1 +version: 0.0.2 author: environment: diff --git a/test/ansu_ui_test.dart b/test/ansu_ui_test.dart deleted file mode 100644 index aae6e6c..0000000 --- a/test/ansu_ui_test.dart +++ /dev/null @@ -1,13 +0,0 @@ -import 'package:flutter_test/flutter_test.dart'; - -import 'package:ansu_ui/ansu_ui.dart'; - -void main() { - test('adds one to input values', () { - final calculator = Calculator(); - expect(calculator.addOne(2), 3); - expect(calculator.addOne(-7), -6); - expect(calculator.addOne(0), 1); - expect(() => calculator.addOne(null), throwsNoSuchMethodError); - }); -}