From fae4a1e9b9e7afc58e50208c06286683cd0d0f08 Mon Sep 17 00:00:00 2001 From: laiiihz Date: Thu, 7 Jan 2021 16:23:15 +0800 Subject: [PATCH] add string ext,num ext code. --- README.md | 4 ++-- .../{data => }/extension/example_num_ext.dart | 22 +++++++++++++++++++ .../extension/example_string_ext.dart | 18 +++++++++++++++ example/lib/main_extention.dart | 4 ++-- 4 files changed, 44 insertions(+), 4 deletions(-) rename example/lib/{data => }/extension/example_num_ext.dart (84%) rename example/lib/{data => }/extension/example_string_ext.dart (63%) diff --git a/README.md b/README.md index c22bf33..23f05be 100644 --- a/README.md +++ b/README.md @@ -29,8 +29,8 @@ minSdkVersion 21 * [x] Scaffold * [x] Button * [ ] Extension - * [ ] num ext - * [ ] string ext + * [x] num ext + * [x] string ext * [ ] widget ext * [ ] image ext * [ ] list ext diff --git a/example/lib/data/extension/example_num_ext.dart b/example/lib/extension/example_num_ext.dart similarity index 84% rename from example/lib/data/extension/example_num_ext.dart rename to example/lib/extension/example_num_ext.dart index 09ed0e7..a61b7c8 100644 --- a/example/lib/data/extension/example_num_ext.dart +++ b/example/lib/extension/example_num_ext.dart @@ -1,6 +1,9 @@ import 'package:ansu_ui/ansu_ui.dart'; +import 'package:example/codeviewer/code_segments.dart'; +import 'package:example/common/code_view.dart'; import 'package:flutter/material.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; +import 'package:get/get.dart'; class ExampleNumExt extends StatefulWidget { ExampleNumExt({Key key}) : super(key: key); @@ -14,8 +17,23 @@ class _ExampleNumExtState extends State { Widget build(BuildContext context) { return ASScaffold( title: 'Num Ext', + actions: [ + IconButton( + icon: Icon( + Icons.code, + color: Colors.black54, + ), + onPressed: () => Get.to( + CodeView( + text: (context) => CodeSegments.numExt(context), + ), + ), + ), + ], body: ListView( children: [ + // BEGIN numExt + //Comma ListTile(title: Text('Comma')), ListTile( leading: Chip(label: Text('.comma')), @@ -48,6 +66,7 @@ class _ExampleNumExtState extends State { subtitle: Text(123456.7899999.comma(fixed: -1)), trailing: Chip(label: Text('without Fixed')), ), + //SizedBox ListTile(title: Text('SizedBox')), ListTile( leading: Chip(label: Text('.wb')), @@ -69,6 +88,7 @@ class _ExampleNumExtState extends State { color: Colors.red, ), ), + //Radius ListTile(title: Text('Radius')), ListTile( leading: Chip(label: Text('.radius')), @@ -83,6 +103,7 @@ class _ExampleNumExtState extends State { ), ), ), + //EdgeInsets ListTile(title: Text('EdgeInsets')), ListTile( leading: Chip(label: Text('.edge')), @@ -96,6 +117,7 @@ class _ExampleNumExtState extends State { child: Container(color: Colors.green), ), ), + // END ], ), ); diff --git a/example/lib/data/extension/example_string_ext.dart b/example/lib/extension/example_string_ext.dart similarity index 63% rename from example/lib/data/extension/example_string_ext.dart rename to example/lib/extension/example_string_ext.dart index 9fff6ea..8197ccc 100644 --- a/example/lib/data/extension/example_string_ext.dart +++ b/example/lib/extension/example_string_ext.dart @@ -1,5 +1,8 @@ import 'package:ansu_ui/ansu_ui.dart'; +import 'package:example/codeviewer/code_segments.dart'; +import 'package:example/common/code_view.dart'; import 'package:flutter/material.dart'; +import 'package:get/get.dart'; class ExampleStringExt extends StatefulWidget { ExampleStringExt({Key key}) : super(key: key); @@ -13,8 +16,22 @@ class _ExampleStringExtState extends State { Widget build(BuildContext context) { return ASScaffold( title: 'String Ext', + actions: [ + IconButton( + icon: Icon( + Icons.code, + color: Colors.black54, + ), + onPressed: () => Get.to( + CodeView( + text: (context) => CodeSegments.stringExt(context), + ), + ), + ), + ], body: ListView( children: [ + // BEGIN stringExt ListTile( leading: Chip(label: Text('.phone')), title: Text('18888888888'), @@ -25,6 +42,7 @@ class _ExampleStringExtState extends State { title: Text('18888888888'), subtitle: Text('18888888888'.securePhone), ), + // END ], ), ); diff --git a/example/lib/main_extention.dart b/example/lib/main_extention.dart index 6a7a788..7fc320e 100644 --- a/example/lib/main_extention.dart +++ b/example/lib/main_extention.dart @@ -1,5 +1,5 @@ -import 'package:example/data/extension/example_num_ext.dart'; -import 'package:example/data/extension/example_string_ext.dart'; +import 'package:example/extension/example_num_ext.dart'; +import 'package:example/extension/example_string_ext.dart'; import 'package:flutter/material.dart'; import 'package:get/get.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart';