diff --git a/.idea/compiler.xml b/.idea/compiler.xml index 1aa5a278..30801309 100644 --- a/.idea/compiler.xml +++ b/.idea/compiler.xml @@ -55,6 +55,8 @@ + + diff --git a/.idea/gradle.xml b/.idea/gradle.xml index f49f8f92..9004a9fd 100644 --- a/.idea/gradle.xml +++ b/.idea/gradle.xml @@ -10,16 +10,18 @@ diff --git a/FlutterHelper/common_utils/.gitignore b/FlutterHelper/common_utils/.gitignore new file mode 100644 index 00000000..e5e70b96 --- /dev/null +++ b/FlutterHelper/common_utils/.gitignore @@ -0,0 +1,18 @@ +# See https://www.dartlang.org/guides/libraries/private-files + +# Files and directories created by pub +.dart_tool/ +.packages +.pub/ +build/ +# If you're building an application, you may want to check-in your pubspec.lock +pubspec.lock + +# Directory created by dartdoc +# If you don't generate documentation locally you can remove this line. +doc/api/ + +*/.idea/ +.idea/ +/.idea/workspace.xml +/.idea/libraries \ No newline at end of file diff --git a/FlutterHelper/common_utils/CHANGELOG.md b/FlutterHelper/common_utils/CHANGELOG.md new file mode 100644 index 00000000..6265b8aa --- /dev/null +++ b/FlutterHelper/common_utils/CHANGELOG.md @@ -0,0 +1,74 @@ +## 2.0.2 + +* TODO: fix TimerUtil. + +## 2.0.1 + +* TODO: fix analysis. + +## 2.0.0 + +* TODO: Migrate to null-safety. + +## 1.2.4 + +* TODO: fix regex mobileExact. + +## 1.2.3 + +* TODO: fix analysis. + +## 1.2.2 + +* TODO: RegexUtil add regexPassport, fix TimelineInfo bugs and some updates. + +## 1.2.1 + +* TODO: fix DataFormats -> DateFormats, fix TimelineInfo bugs. + +## 1.2.0 + +* TODO: add JsonUtil, EncryptUtil, Some updates. + +## 1.1.3 + +* TODO: TextUtil, EnDecodeUtil, Some updates. +## 1.1.1 + +* TODO: Some updates. + +## 1.0.9 + +* TODO: NumUtil updates(add subtract multiply divide without loosing precision). MoneyUtil precise conversion. + +## 1.0.8 + +* TODO: Some updates. + +## 1.0.4 + +* TODO: Newly TimelineUtil.DateUtil update.No platform restriction found in primary library. + +## 1.0.3 + +* TODO: Newly added TimerUtil, MoneyUtil, LogUtil,Some updates. + +## 1.0.2 + +* TODO: fix bug. + +## 1.0.1 + +* TODO: Newly added NumUtil,Some updates. + +## 1.0.0 + +* TODO: Newly added DateUtil. + +## 0.0.2 + +* TODO: Contains ScreenUtil, WidgetUtil, ObjectUtil, RegexUtil. + +## 0.0.1 + +* TODO: CommonUtils initial release. \ No newline at end of file diff --git a/FlutterHelper/common_utils/CHANGE_LOG.md b/FlutterHelper/common_utils/CHANGE_LOG.md new file mode 100644 index 00000000..922c38c8 --- /dev/null +++ b/FlutterHelper/common_utils/CHANGE_LOG.md @@ -0,0 +1,175 @@ +## 更新说明 +#### v1.2.1 (2020.05.29) +1、fix DataFormats -> DateFormats。 +2、fix TimelineInfo bugs。 + +#### v1.2.0 (2020.05.23) +1、新增JsonUtil。 +2、新增EncryptUtil 简单加解密。 +3、LogUtil 更新。 +```yaml +String objStr = "{\"name\":\"成都市\"}"; +City hisCity = JsonUtil.getObj(objStr, (v) => City.fromJson(v)); +String listStr = "[{\"name\":\"成都市\"}, {\"name\":\"北京市\"}]"; +List cityList = JsonUtil.getObjList(listStr, (v) => City.fromJson(v)); + +const String key = '11, 22, 33, 44, 55, 66'; +String userName = 'Sky24n'; +String encode = EncryptUtil.xorBase64Encode(userName, key); // WH1YHgMs +String decode = EncryptUtil.xorBase64Decode(encode, key); // Sky24n + +//超长log查看 +common_utils e — — — — — — — — — — — — — — — — st — — — — — — — — — — — — — — — — +common_utils e | 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45, +common_utils e | 7,988,989,990,991,992,993,994,995,996,997,998,999, +common_utils e — — — — — — — — — — — — — — — — ed — — — — — — — — — — — — — — — — +``` +#### v1.1.3 (2019.07.10) 1、新增TextUtil 银行卡号每隔4位加空格,每隔3三位加逗号,隐藏手机号等等. +2、新增EnDecodeUtil md5加密,Base64加/解密. +3、DateUtil 新增日期格式化,支持自定义格式输出。 +4、LogUtil 支持输出超长log。 +5、RegexUtil 支持199号段。 +```dart +/// DateUtil +DateUtil.formatDateMs(DateTime.now().millisecondsSinceEpoch, format: DataFormats.full); // 2019-07-09 16:51:14 +DateUtil.formatDateStr("2019-07-09 16:51:14", format: "yyyy/M/d HH:mm:ss"); // 2019/7/9 16:51:14 +DateUtil.formatDate(DateTime.now(), format: "yyyy/MM/dd HH:mm:ss"); // 2019/07/09 16:51:14 + +/// TextUtil +String phoneNo = TextUtil.formatSpace4("15845678910"); // 1584 5678 910 +String num = TextUtil.formatComma3("12345678"); // 12,345,678 +String phoneNo = TextUtil.hideNumber("15845678910"); // 158****8910 + +``` +```dart +/// DateUtil +DateUtil.formatDateMs(DateTime.now().millisecondsSinceEpoch, format: DataFormats.full); // 2019-07-09 16:51:14 +DateUtil.formatDateStr("2019-07-09 16:51:14", format: "yyyy/M/d HH:mm:ss"); // 2019/7/9 16:51:14 +DateUtil.formatDate(DateTime.now(), format: "yyyy/MM/dd HH:mm:ss"); // 2019/07/09 16:51:14 + +/// TextUtil +String phoneNo = TextUtil.formatSpace4("15845678910"); // 1584 5678 910 +String num = TextUtil.formatComma3("1234"); // 123,4 +String phoneNo = TextUtil.hidePhone("15845678910")// 158****8910 + +``` +(2018.10.31) +NumUtil更新, 精确加、减、乘、除, 防止精度丢失. +MoneyUtil更新, 精确转换, 防止精度丢失. + +common_utils库不再有平台限制. +WidgetUtil,ScreenUtil迁移至[flustars][flustars_github]库。 + + +## Flutter工具类库[flustars][flustars_github]更新说明 +#### v0.1.8(2018.12.29) +ScreenUtil 屏幕适配更新。 +方案一、不依赖context +``` +步骤 1 +//如果设计稿尺寸默认配置一致,无需该设置。 配置设计稿尺寸 默认 360.0 / 640.0 / 3.0 +setDesignWHD(_designW,_designH,_designD); + +步骤 2 +// 在MainPageState build 调用MediaQuery.of(context) +class MainPageState extends State { + @override + Widget build(BuildContext context) { + + // 在 MainPageState build 调用 MediaQuery.of(context) + MediaQuery.of(context); + + double width = ScreenUtil.getInstance().screenWidth; + double height = ScreenUtil.getInstance().screenHeight; + return new Scaffold( + appBar: new AppBar(), + ); + } +} + +步骤 3 +ScreenUtil.getInstance().screenWidth +ScreenUtil.getInstance().screenHeight +ScreenUtil.getInstance().screenDensity +ScreenUtil.getInstance().statusBarHeight +ScreenUtil.getInstance().bottomBarHeight +//屏幕适配相关 +ScreenUtil.getInstance().getWidth(size); //返回根据屏幕宽适配后尺寸(单位 dp or pt) +ScreenUtil.getInstance().getHeight(size); //返回根据屏幕高适配后尺寸 (单位 dp or pt) +ScreenUtil.getInstance().getWidthPx(sizePx); //sizePx 单位px +ScreenUtil.getInstance().getHeightPx(sizePx); //sizePx 单位px +ScreenUtil.getInstance().getSp(fontSize); //返回根据屏幕宽适配后字体尺寸 + +``` +方案二、依赖context +``` +//如果设计稿尺寸默认配置一致,无需该设置。 配置设计稿尺寸 默认 360.0 / 640.0 / 3.0 +setDesignWHD(_designW,_designH,_designD); + +ScreenUtil.getScreenW(context); //屏幕 宽 +ScreenUtil.getScreenH(context); //屏幕 高 +ScreenUtil.getScreenDensity(context); //屏幕 像素密度 +ScreenUtil.getStatusBarH(context); //状态栏高度 +ScreenUtil.getBottomBarH(context); //bottombar 高度 +//屏幕适配相关 +ScreenUtil.getScaleW(context, size); //返回根据屏幕宽适配后尺寸(单位 dp or pt) +ScreenUtil.getScaleH(context, size); //返回根据屏幕高适配后尺寸 (单位 dp or pt) +ScreenUtil.getScaleSp(context, size) ;//返回根据屏幕宽适配后字体尺寸 +``` +#### v0.1.6(2018.12.20) +新增网络请求工具DioUtil, 单例模式,可输出请求日志。详细请求+解析请参考[flutter_wanandroid][flutter_wanandroid_github]项目。 +``` +// 打开debug模式. +DioUtil.openDebug(); + +// 配置网络参数. +Options options = DioUtil.getDefOptions(); +options.baseUrl = "http://www.wanandroid.com/"; +HttpConfig config = new HttpConfig(options: options); +DioUtil().setConfig(config); + +// 两种单例请求方式. +DioUtil().request(Method.get, "banner/json"); +DioUtil.getInstance().request(Method.get, "banner/json"); + +//示例 +LoginReq req = new LoginReq('username', 'password'); +DioUtil().request(Method.post, "user/login",data: req.toJson()); + +//示例 +FormData formData = new FormData.from({ + "username": "username", + "password": "password", + }); +DioUtil().requestR(Method.post, "user/login",data: rformData); + +// 网络请求日志 +I/flutter ( 5922): ----------------Http Log---------------- +I/flutter ( 5922): [statusCode]: 200 +I/flutter ( 5922): [request ]: method: GET baseUrl: http://www.wanandroid.com/ path: lg/collect/list/0/json +I/flutter ( 5922): [reqdata ]: null +I/flutter ( 5922): [response ]: {data: {curPage: 1, datas: [], offset: 0, over: true, pageCount: 0, size: 20, total: 0}, errorCode: 0, errorMsg: } +``` + +#### v0.1.5(2018.12.14) +ScreenUtil 新增屏幕适配,不依赖context。 +``` +//如果设计稿尺寸默认配置一致,无需该设置。 配置设计稿尺寸 默认 360.0 / 640.0 / 3.0 +setDesignWHD(_designW,_designH,_designD); + +//返回根据屏幕宽适配后尺寸(单位 dp or pt) +ScreenUtil.getInstance().getWidth(100.0); + +//返回根据屏幕高适配后尺寸(单位 dp or pt) +ScreenUtil.getInstance().getHeight(100.0); + +//返回根据屏幕宽适配后字体尺寸 +ScreenUtil.getInstance().getSp(12.0); +``` + + + + +[flutter_wanandroid_github]: https://github.com/Sky24n/flutter_wanandroid +[common_utils_github]: https://github.com/Sky24n/common_utils +[flustars_github]: https://github.com/Sky24n/flustars \ No newline at end of file diff --git a/FlutterHelper/common_utils/LICENSE b/FlutterHelper/common_utils/LICENSE new file mode 100644 index 00000000..99a3972b --- /dev/null +++ b/FlutterHelper/common_utils/LICENSE @@ -0,0 +1,25 @@ +BSD 2-Clause License + +Copyright (c) 2018, Sky24n +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +* Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + +* Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/FlutterHelper/common_utils/README-EN.md b/FlutterHelper/common_utils/README-EN.md new file mode 100644 index 00000000..5fec7af1 --- /dev/null +++ b/FlutterHelper/common_utils/README-EN.md @@ -0,0 +1,308 @@ +Language: English | [中文简体](https://github.com/Sky24n/common_utils) + +[![Pub](https://img.shields.io/pub/v/common_utils.svg?style=flat-square&color=009688)](https://pub.dartlang.org/packages/common_utils)      [![Pub](https://img.shields.io/pub/v/common_utils.svg?style=flat-square&color=2196F3)](https://pub.flutter-io.cn/packages/common_utils) + +## common_utils is a Dart common utils library. + +1、Dart project dependencies. +```yaml +dependencies: + common_utils: ^2.0.2 +``` +2、Dart project dependencies, [flustars][flustars_github] is a Flutter common utils library. More SpUtil, ScreenUtil, DirectoryUtil. +```yaml +dependencies: + flustars: ^2.0.1 +``` + +Dart utils Library [common_utils][common_utils_github] +1. TimelineUtil : timeline util. +2. TimerUtil : countdown,timer. +3. MoneyUtil : fen to yuan, format output. +4. LogUtil : simply encapsulate print logs. +5. DateUtil : date conversion formatted output. +6. RegexUtil : regular verification of mobile phone numbers, ID cards, mailboxes and so on. +7. NumUtil : keep [x] decimal places, add subtract multiply divide without loosing precision. +8. ObjectUtil : object is empty, two List is equal. +9. EncryptUtil : xor, md5 ,Base64.. +10. TextUtil : hide phoneNo. +11. JsonUtil : json to object. + +Flutter utils Library [flustars][flustars_github] +1. SpUtil : SharedPreferences Util. +2. ScreenUtil : get screen width height density, appBarHeight, statusBarHeight, orientation. +3. WidgetUtil : get Widget width height,coordinates. +4. ImageUtil : get image size. +5. DirectoryUtil : Directory Util. +6. DioUtil : Dio Util(move to[DioUtil](https://github.com/Sky24n/FlutterRepos/blob/master/base_library/lib/src/data/net/dio_util.dart))。 + +### APIs +* SpUtil +SharedPreferences util. +```dart +/// await sp initialized。 +await SpUtil.getInstance(); + +/// support default value. +String name = SpUtil.putString("key_username", "Sky24n"); +bool isShow = SpUtil.getBool("key_show", defValue: true); + +/// save object example. +City city = new City(); +city.name = "成都市"; +SpUtil.putObject("loc_city", city); + +City hisCity = SpUtil.getObj("loc_city", (v) => City.fromJson(v)); +print("City: " + (hisCity == null ? "null" : hisCit.toString())); + + +/// save object list example. +List list = new List(); +list.add(new City(name: "成都市")); +list.add(new City(name: "北京市")); +SpUtil.putObjectList("loc_city_list", list); + +List _cityList = SpUtil.getObjList("loc_city_list", (v) => City.fromJson(v)); +print("City list: " + (_cityList == null ? "null" : _cityList.toString())); +``` + +* DateUtil -> [Example](https://github.com/Sky24n/flutter_wanandroid/blob/master/lib/demos/date_page.dart) +``` +/// common format。example:"yyyy/MM/dd HH:mm:ss","yyyy/M/d HH:mm:ss"。 +/// year -> yyyy/yy month -> MM/M day -> dd/d +/// hour -> HH/H minute -> mm/m second -> ss/s +class DataFormats { + static String full = "yyyy-MM-dd HH:mm:ss"; + static String y_mo_d_h_m = "yyyy-MM-dd HH:mm"; + static String y_mo_d = "yyyy-MM-dd"; + static String y_mo = "yyyy-MM"; + static String mo_d = "MM-dd"; + static String mo_d_h_m = "MM-dd HH:mm"; + static String h_m_s = "HH:mm:ss"; + static String h_m = "HH:mm"; + + static String zh_full = "yyyy年MM月dd日 HH时mm分ss秒"; + static String zh_y_mo_d_h_m = "yyyy年MM月dd日 HH时mm分"; + static String zh_y_mo_d = "yyyy年MM月dd日"; + static String zh_y_mo = "yyyy年MM月"; + static String zh_mo_d = "MM月dd日"; + static String zh_mo_d_h_m = "MM月dd日 HH时mm分"; + static String zh_h_m_s = "HH时mm分ss秒"; + static String zh_h_m = "HH时mm分"; +} + +getDateTimeByMs : +getDateMsByTimeStr : +getNowDateMs : get Now Date milliseconds. +getNowDateStr : get Now DateStr.(yyyy-MM-dd HH:mm:ss) +formatDate : format Date by DateTime. +formatDateStr : format Date by DateStr. +formatDateMs : format Date by milliseconds. +getWeekday : get weekDay. +getDayOfYear : get day of year. +isToday : is today. +isYesterday : is yesterday. +isWeek : is week. +yearIsEqual : whether it is leap year. +isLeapYear : year is equal. + +// example +DateUtil.formatDateMs(dateMs, format: DateFormats.full); //2019-07-09 16:16:16 +DateUtil.formatDateStr('2019-07-09 16:16:16', format: "yyyy/M/d HH:mm:ss"); //2019/7/9 16:16:16 +DateUtil.formatDate(DateTime.now(), format: DateFormats.zh_full); //2019年07月09日 16时16分16秒 +``` + +* EncryptUtil +``` +encodeMd5 : md5. +encodeBase64 : Base64 encode. +decodeBase64() : Base64 decode. +xorCode() : xor. +xorBase64Encode() : xor Base64 encode. +xorBase64Decode() : xor Base64 decode. + +const String key = '11, 22, 33, 44, 55, 66'; +String userName = 'Sky24n'; +String encode = EncryptUtil.xorBase64Encode(userName, key); // WH1YHgMs +String decode = EncryptUtil.xorBase64Decode(encode, key); // Sky24n +``` + +* JsonUtil +``` +encodeObj : Obj to json string. +getObj : json string to object. +getObject : json string / map to object. +getObjList : json string list to object list. +getObjectList : json string / map list to object list. + +String objStr = "{\"name\":\"成都市\"}"; +City hisCity = JsonUtil.getObj(objStr, (v) => City.fromJson(v)); +String listStr = "[{\"name\":\"成都市\"}, {\"name\":\"北京市\"}]"; +List cityList = JsonUtil.getObjList(listStr, (v) => City.fromJson(v)); +``` + +* LogUtil +``` +init(tag, isDebug, maxLen) : tag, isDebug, maxLen. +e(object, tag) : Log e. +v(object, tag) : Log v,debug output. + +//超长log查看 +common_utils e — — — — — — — — — — — — — — — — st — — — — — — — — — — — — — — — — +common_utils e | 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45, +common_utils e | 7,988,989,990,991,992,993,994,995,996,997,998,999, +common_utils e — — — — — — — — — — — — — — — — ed — — — — — — — — — — — — — — — — +``` + +* MoneyUtil -> [Example](https://github.com/Sky24n/flutter_wanandroid/blob/master/lib/demos/money_page.dart) +``` +changeF2Y : fen to yuan, format output. +changeFStr2YWithUnit : fen str to yuan, format & unit output. +changeF2YWithUnit : fen to yuan, format & unit output. +changeYWithUnit : yuan, format & unit output.(yuan is int,double,str). +changeY2F : fen to yuan. +``` + +* NumUtil -> [Example](https://github.com/Sky24n/flutter_wanandroid/blob/master/lib/demos/num_util_page.dart) +``` +getIntByValueStr : get int By value string. +getDoubleByValueStr : get double By value string. +getNumByValueStr : Keep [x] decimal places by value string. +getNumByValueDouble : Keep [x] decimal places by double. +isZero : is Zero. +add : add (without loosing precision). +subtract : subtract (without loosing precision). +multiply : multiply (without loosing precision). +divide : divide (without loosing precision). +remainder : 余. +lessThan : < . +thanOrEqual : <= . +greaterThan : > . +greaterOrEqual : >= . +``` + +* ObjectUtil -> [Example](https://github.com/Sky24n/flutter_wanandroid/blob/master/lib/demos/object_util_page.dart) +``` +isEmptyString : String is empty. +isEmptyList : List is empty. +isEmptyMap : Map Map empty. +isEmpty : Object is empty.(String List Map). +isNotEmpty : Object is not empty.(String List Map). +twoListIsEqual : Two List Is Equal. +``` + +* RegexUtil -> [Example](https://github.com/Sky24n/flutter_wanandroid/blob/master/lib/demos/regex_page.dart) +``` +isMobileSimple : +isMobileExact : +isTel : +isIDCard : +isIDCard15 : +isIDCard18 : +isIDCard18Exact : +isEmail : +isURL : +isZh : +isDate : +isIP : +isUserName : +isQQ : +``` + +* TextUtil +``` +isEmpty : isEmpty. +formatSpace4 : format Space 4. +formatComma3 : format Comma 3. +formatDoubleComma3 : format Double Comma3. +hideNumber : hide number. +replace : replace. +split : split. +reverse : reverse. + +/// example +String phoneNo = TextUtil.formatSpace4("15845678910"); // 1584 5678 910 +String num = TextUtil.formatComma3("1234"); // 123,4 +String phoneNo = TextUtil.hideNumber("15845678910")// 158****8910 +``` + +* TimelineUtil -> [Example](https://github.com/Sky24n/flutter_wanandroid/blob/master/lib/demos/timeline_page.dart) +``` +///(xx)Configurable output. +enum DayFormat { + ///(less than 30s->just now)、x minutes、x hours、(Yesterday)、x days. + Simple, + ///(less than 30s->just now)、x minutes、x hours、[This year:(Yesterday/a day ago)、(two days age)、MM-dd ]、[past years: yyyy-MM-dd] + Common, + ///(less than 30s->just now)、x minutes、x hours、[This year:(Yesterday HH:mm/a day ago)、(two days age)、MM-dd HH:mm]、[past years: yyyy-MM-dd HH:mm] + Full, +} +///Timeline information configuration. +abstract class TimelineInfo { + String suffixAgo(); //suffix ago(后缀 后). + String suffixAfter(); //suffix after(后缀 前). + int maxJustNowSecond() => 30; // max just now second. + String lessThanOneMinute() => ''; //just now(刚刚). + String customYesterday() => ''; //Yesterday(昨天).优先级高于keepOneDay + bool keepOneDay(); //保持1天,example: true -> 1天前, false -> MM-dd. + bool keepTwoDays(); //保持2天,example: true -> 2天前, false -> MM-dd. + String oneMinute(int minutes); //a minute(1分钟). + String minutes(int minutes); //x minutes(x分钟). + String anHour(int hours); //an hour(1小时). + String hours(int hours); //x hours(x小时). + String oneDay(int days); //a day(1天). + String days(int days); //x days(x天). +} +setLocaleInfo : add custom configuration. +formatByDateTime : timeline format output by DateTime . +format : timeline format output. +formatA : timeline format output. like QQ. + +``` + +* TimerUtil -> [Example](https://github.com/Sky24n/flutter_wanandroid/blob/master/lib/demos/timer_page.dart) +``` +setInterval : set Timer interval. +setTotalTime : set countdown totalTime. +startTimer() : start Timer. +startCountDown : start countdown Timer. +updateTotalTime : update countdown totalTime. +cancel : cancels the timer. +setOnTimerTickCallback : set timer callback. +isActive : timer is Active. +``` + +### [Flutter Demos](https://github.com/Sky24n/flutter_wanandroid/tree/master/lib/demos) + +>- |--demos +> - |-- city_select_page.dart +> - |-- date_page.dart +> - |-- image_size_page.dart +> - |-- money_page.dart +> - |-- pinyin_page.dart +> - |-- regex_page.dart +> - |-- round_portrait_page.dart +> - |-- timeline_page.dart +> - |-- timer_page.dart +> - |-- widget_page.dart + +### Demo Apk : [flutter_wanandroid](https://github.com/Sky24n/Doc) + +### Thanks +Blankj [AndroidUtilCode](https://github.com/Blankj/AndroidUtilCode)。 +Andres Araujo [timeago](https://github.com/andresaraujo/timeago.dart)。 +a14n [decimal](https://github.com/a14n/dart-decimal)。 + +### Apps +[flutter_wanandroid](https://github.com/Sky24n/flutter_wanandroid) +[Moss App](https://github.com/Sky24n/Moss) + +### [Change Log](CHANGELOG.md) +v1.2.1 (2020.05.29) +1、fix DataFormats -> DateFormats。 +2、fix TimelineInfo bugs。 + + + +[flustars_github]: https://github.com/Sky24n/flustars +[common_utils_github]: https://github.com/Sky24n/common_utils \ No newline at end of file diff --git a/FlutterHelper/common_utils/README.md b/FlutterHelper/common_utils/README.md new file mode 100644 index 00000000..c960dbc7 --- /dev/null +++ b/FlutterHelper/common_utils/README.md @@ -0,0 +1,319 @@ +Language: [English](README-EN.md) | 中文简体 + +[![Pub](https://img.shields.io/pub/v/common_utils.svg?style=flat-square&color=009688)](https://pub.dartlang.org/packages/common_utils)      [![Pub](https://img.shields.io/pub/v/common_utils.svg?style=flat-square&color=2196F3)](https://pub.flutter-io.cn/packages/common_utils) + +Dart常用工具类库。包含日期,正则,倒计时,时间轴等工具类。如果你有好的工具类欢迎PR. + +1、如果您是纯Dart项目,可以直接引用本库。 +```yaml +dependencies: + common_utils: ^2.0.2 +``` +2、如果您是Flutter项目,请使用Flutter常用工具类库 [flustars][flustars_github],该库依赖于本项目。[flustars][flustars_github]库为大家提供更多的工具类,例如SpUtil,ScreenUtil, DirectoryUtil等等。 +```yaml +dependencies: + flustars: ^2.0.1 +``` + +Dart常用工具类库 [common_utils][common_utils_github] +1. TimelineUtil : 时间轴. +2. TimerUtil : 倒计时,定时任务. +3. MoneyUtil : 精确转换,元转分,分转元,支持格式输出. +4. LogUtil : 简单封装打印日志. +5. DateUtil : 日期转换格式化输出. +6. RegexUtil : 正则验证手机号,身份证,邮箱等等. +7. NumUtil : 保留x位小数, 精确加、减、乘、除, 防止精度丢失. +8. ObjectUtil : 判断对象是否为空(String List Map),判断两个List是否相等. +9. EncryptUtil : 异或对称加/解密,md5加密,Base64加/解密. +10. TextUtil : 银行卡号每隔4位加空格,每隔3三位加逗号,隐藏手机号等等. +11. JsonUtil : 简单封装json字符串转对象. + +Flutter常用工具类库 [flustars][flustars_github] +1. SpUtil : 单例"同步"SharedPreferences工具类。支持get传入默认值,支持存储对象,支持存储对象数组。 +2. ScreenUtil : 屏幕适配,获取屏幕宽、高、密度,AppBar高,状态栏高度,屏幕方向. +3. WidgetUtil : 监听Widget渲染状态,获取Widget宽高,在屏幕上的坐标,获取网络/本地图片尺寸. +4. ImageUtil : 获取网络/本地图片尺寸. +5. DirectoryUtil : 文件目录工具类. +6. DioUtil : 单例Dio网络工具类(已迁移至此处[DioUtil](https://github.com/Sky24n/FlutterRepos/blob/master/base_library/lib/src/data/net/dio_util.dart))。 + + +### APIs +* SpUtil +强大易用的SharedPreferences工具类,详细使用请参考原仓库[flustars][flustars_github]。 +```dart +/// 等待Sp初始化完成。 +await SpUtil.getInstance(); + +/// 同步使用Sp。支付默认值。 +String name = SpUtil.putString("key_username", "Sky24n"); +bool isShow = SpUtil.getBool("key_show", defValue: true); + +/// 存储实体对象示例。 +City city = new City(); +city.name = "成都市"; +SpUtil.putObject("loc_city", city); + +City hisCity = SpUtil.getObj("loc_city", (v) => City.fromJson(v)); +print("City: " + (hisCity == null ? "null" : hisCit.toString())); + +/// 存储实体对象list示例。 +List list = new List(); +list.add(new City(name: "成都市")); +list.add(new City(name: "北京市")); +SpUtil.putObjectList("loc_city_list", list); + +List _cityList = SpUtil.getObjList("loc_city_list", (v) => City.fromJson(v)); +print("City list: " + (_cityList == null ? "null" : _cityList.toString())); +``` + +* DateUtil -> [Example](https://github.com/Sky24n/flutter_wanandroid/blob/master/lib/demos/date_page.dart) +``` +/// 一些常用格式参照。可以自定义格式,例如:"yyyy/MM/dd HH:mm:ss","yyyy/M/d HH:mm:ss"。 +/// 格式要求 +/// year -> yyyy/yy month -> MM/M day -> dd/d +/// hour -> HH/H minute -> mm/m second -> ss/s +class DataFormats { + static String full = "yyyy-MM-dd HH:mm:ss"; + static String y_mo_d_h_m = "yyyy-MM-dd HH:mm"; + static String y_mo_d = "yyyy-MM-dd"; + static String y_mo = "yyyy-MM"; + static String mo_d = "MM-dd"; + static String mo_d_h_m = "MM-dd HH:mm"; + static String h_m_s = "HH:mm:ss"; + static String h_m = "HH:mm"; + + static String zh_full = "yyyy年MM月dd日 HH时mm分ss秒"; + static String zh_y_mo_d_h_m = "yyyy年MM月dd日 HH时mm分"; + static String zh_y_mo_d = "yyyy年MM月dd日"; + static String zh_y_mo = "yyyy年MM月"; + static String zh_mo_d = "MM月dd日"; + static String zh_mo_d_h_m = "MM月dd日 HH时mm分"; + static String zh_h_m_s = "HH时mm分ss秒"; + static String zh_h_m = "HH时mm分"; +} + +getDateTimeByMs : . +getDateMsByTimeStr : . +getNowDateMs : 获取现在 毫秒. +getNowDateStr : 获取现在 日期字符串.(yyyy-MM-dd HH:mm:ss) +formatDate : 格式化日期 DateTime. +formatDateStr : 格式化日期 字符串. +formatDateMs : 格式化日期 毫秒. +getWeekday : 获取星期几. +getDayOfYear : 在今年的第几天. +isToday : 是否是今天. +isYesterday : 是否是昨天. +isWeek : 是否是本周. +yearIsEqual : 是否同年. +isLeapYear : 是否是闰年. + +// example +DateUtil.formatDateMs(dateMs, format: DateFormats.full); //2019-07-09 16:16:16 +DateUtil.formatDateStr('2019-07-09 16:16:16', format: "yyyy/M/d HH:mm:ss"); //2019/7/9 16:16:16 +DateUtil.formatDate(DateTime.now(), format: DateFormats.zh_full); //2019年07月09日 16时16分16秒 +``` + +* EncryptUtil +``` +encodeMd5 : md5 加密. +encodeBase64 : Base64加密. +decodeBase64() : Base64解密. +xorCode() : 异或对称加密. +xorBase64Encode() : 异或对称 Base64 加密. +xorBase64Decode() : 异或对称 Base64 解密. + +const String key = '11, 22, 33, 44, 55, 66'; +String userName = 'Sky24n'; +String encode = EncryptUtil.xorBase64Encode(userName, key); // WH1YHgMs +String decode = EncryptUtil.xorBase64Decode(encode, key); // Sky24n +``` + +* JsonUtil +``` +encodeObj : object to json string. +getObj : json string to object. +getObject : json string / map to object. +getObjList : json string list to object list. +getObjectList : json string / map list to object list. + +String objStr = "{\"name\":\"成都市\"}"; +City hisCity = JsonUtil.getObj(objStr, (v) => City.fromJson(v)); +String listStr = "[{\"name\":\"成都市\"}, {\"name\":\"北京市\"}]"; +List cityList = JsonUtil.getObjList(listStr, (v) => City.fromJson(v)); +``` + +* LogUtil +``` +init(tag, isDebug, maxLen) : tag 标签, isDebug: 模式, maxLen 每行最大长度. +e(object, tag) : 日志e +v(object, tag) : 日志v,只在debug模式输出. + +//超长log查看 +common_utils e — — — — — — — — — — — — — — — — st — — — — — — — — — — — — — — — — +common_utils e | 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45, +common_utils e | 7,988,989,990,991,992,993,994,995,996,997,998,999, +common_utils e — — — — — — — — — — — — — — — — ed — — — — — — — — — — — — — — — — +``` + +* MoneyUtil 精确转换,防止精度丢失 -> [Example](https://github.com/Sky24n/flutter_wanandroid/blob/master/lib/demos/money_page.dart) +``` +changeF2Y : 分 转 元, format格式输出. +changeFStr2YWithUnit : 分字符串 转 元, format 与 unit 格式 输出. +changeF2YWithUnit : 分 转 元, format 与 unit 格式 输出. +changeYWithUnit : 元, format 与 unit 格式 输出. +changeY2F : 元 转 分. +``` + +* NumUtil -> [Example](https://github.com/Sky24n/flutter_wanandroid/blob/master/lib/demos/num_util_page.dart) +``` +getIntByValueStr : 数字字符串转int. +getDoubleByValueStr : 数字字符串转double. +getNumByValueStr : 保留x位小数 by 数字字符串. +getNumByValueDouble : 保留x位小数 by double. +isZero : 是否为0. +add : 加(精确相加,防止精度丢失). +subtract : 减(精确相减,防止精度丢失). +multiply : 乘(精确相乘,防止精度丢失). +divide : 除(精确相除,防止精度丢失). +remainder : 余. +lessThan : < . +thanOrEqual : <= . +greaterThan : > . +greaterOrEqual : >= . +``` + +* ObjectUtil -> [Example](https://github.com/Sky24n/flutter_wanandroid/blob/master/lib/demos/object_util_page.dart) +``` +isEmptyString : 判断String是否为空. +isEmptyList : 判断List是否为空. +isEmptyMap : 判断Map是否为空. +isEmpty : 判断对象是否为空.(String List Map). +isNotEmpty : 判断对象是否非空.(String List Map). +twoListIsEqual : 判断两个List是否相等. +``` + +* RegexUtil -> [Example](https://github.com/Sky24n/flutter_wanandroid/blob/master/lib/demos/regex_page.dart) +``` +isMobileSimple : 简单验证手机号 +isMobileExact : 精确验证手机号 +isTel : 验证电话号码 +isIDCard : 验证身份证号码 +isIDCard15 : 验证身份证号码 15 位 +isIDCard18 : 简单验证身份证号码 18 位 +isIDCard18Exact : 精确验证身份证号码 18 位 +isEmail : 验证邮箱 +isURL : 验证 URL +isZh : 验证汉字 +isDate : 验证 yyyy-MM-dd 格式的日期校验,已考虑平闰年 +isIP : 验证 IP 地址 +isUserName : 验证用户名 +isQQ : 验证 QQ +``` + +* TextUtil +``` +isEmpty : isEmpty. +formatSpace4 : 每隔4位加空格,格式化银行卡. +formatComma3 : 每隔3三位加逗号. +formatDoubleComma3 : 每隔3三位加逗号. +hideNumber : 隐藏号码. +replace : replace. +split : split. +reverse : reverse. + +/// example +String phoneNo = TextUtil.formatSpace4("15845678910"); // 1584 5678 910 +String num = TextUtil.formatComma3("1234"); // 123,4 +String phoneNo = TextUtil.hideNumber("15845678910")// 158****8910 +``` + +* TimelineUtil -> [Example](https://github.com/Sky24n/flutter_wanandroid/blob/master/lib/demos/timeline_page.dart) +``` +///(xx)为可配置输出 +enum DayFormat { + ///(小于30s->刚刚)、x分钟、x小时、(昨天)、x天. + Simple, + ///(小于30s->刚刚)、x分钟、x小时、[今年: (昨天/1天前)、(2天前)、MM-dd],[往年: yyyy-MM-dd]. + Common, + ///小于30s->刚刚)、x分钟、x小时、[今年: (昨天 HH:mm/1天前)、(2天前)、MM-dd HH:mm],[往年: yyyy-MM-dd HH:mm]. + Full, +} +///Timeline信息配置. +abstract class TimelineInfo { + String suffixAgo(); //suffix ago(后缀 后). + String suffixAfter(); //suffix after(后缀 前). + int maxJustNowSecond() => 30; // max just now second. + String lessThanOneMinute() => ''; //just now(刚刚). + String customYesterday() => ''; //Yesterday(昨天).优先级高于keepOneDay + bool keepOneDay(); //保持1天,example: true -> 1天前, false -> MM-dd. + bool keepTwoDays(); //保持2天,example: true -> 2天前, false -> MM-dd. + String oneMinute(int minutes); //a minute(1分钟). + String minutes(int minutes); //x minutes(x分钟). + String anHour(int hours); //an hour(1小时). + String hours(int hours); //x hours(x小时). + String oneDay(int days); //a day(1天). + String days(int days); //x days(x天). +} +setLocaleInfo : 自定义设置配置信息. +formatByDateTime : 格式输出时间轴信息 by DateTime . +format : 格式输出时间轴信息. +formatA : 格式输出时间轴信息. like QQ. +``` + +* TimerUtil -> [Example](https://github.com/Sky24n/flutter_wanandroid/blob/master/lib/demos/timer_page.dart) +``` +setInterval : 设置Timer间隔. +setTotalTime : 设置倒计时总时间. +startTimer() : 启动定时Timer. +startCountDown : 启动倒计时Timer. +updateTotalTime : 重设倒计时总时间. +cancel : 取消计时器. +setOnTimerTickCallback : 计时器回调. +isActive : Timer是否启动. +``` + +### [Flutter Demos](https://github.com/Sky24n/flutter_wanandroid/tree/master/lib/demos) + +>- |--demos +> - |-- city_select_page.dart 城市列表(索引&悬停)示例 +> - |-- date_page.dart 日期格式化示例 +> - |-- image_size_page.dart 获取网络/本地图片尺寸示例 +> - |-- money_page.dart 金额(元转分/分转元)示例 +> - |-- pinyin_page.dart 汉字转拼音示例 +> - |-- regex_page.dart 正则工具类示例 +> - |-- round_portrait_page.dart 圆形圆角头像示例 +> - |-- timeline_page.dart 时间轴示例 +> - |-- timer_page.dart 倒计时/定时器示例 +> - |-- widget_page.dart 获取Widget尺寸/屏幕坐标示例 + +### Thanks +本库部分源码参考,正则,时间轴。 +Blankj [AndroidUtilCode](https://github.com/Blankj/AndroidUtilCode) 强大易用的安卓工具类库。 +Andres Araujo [timeago](https://github.com/andresaraujo/timeago.dart) Dart时间轴库。 +a14n [decimal](https://github.com/a14n/dart-decimal) 精确运算,避免精度丢失。 + +### 关于作者 +GitHub : [Sky24n](https://github.com/Sky24n) +掘金     : [Sky24n](https://juejin.im/user/5b9e8a92e51d453df0440422/posts) +简书     : [Sky24n](https://www.jianshu.com/u/cbf2ad25d33a) + +### Changelog +Please see the [Changelog](CHANGELOG.md) page to know what's recently changed. + +### Apps +[flutter_wanandroid](https://github.com/Sky24n/flutter_wanandroid) +[Moss](https://github.com/Sky24n/Moss). +A GitHub client app developed with Flutter, which supports Android iOS Web. +Web :[Flutter Web](https://sky24n.github.io/Sky24n/moss). + +|![](https://z3.ax1x.com/2021/04/26/gp1hm6.jpg)|![](https://z3.ax1x.com/2021/04/26/gp1Tte.jpg)|![](https://z3.ax1x.com/2021/04/26/gp17fH.jpg)| +|:---:|:---:|:---:| + + +[flutter_wanandroid_qr]: https://raw.githubusercontent.com/Sky24n/LDocuments/master/AppImgs/flutter_wanandroid/qrcode.png + +[common_utils_github]: https://github.com/Sky24n/common_utils + +[flustars_github]: https://github.com/Sky24n/flustars + + diff --git a/FlutterHelper/common_utils/analysis_options.yaml b/FlutterHelper/common_utils/analysis_options.yaml new file mode 100644 index 00000000..fe29820c --- /dev/null +++ b/FlutterHelper/common_utils/analysis_options.yaml @@ -0,0 +1,21 @@ +# https://www.dartlang.org/guides/language/analysis-options +# Source of linter options: +# http://dart-lang.github.io/linter/lints/options/options.html +analyzer: + strong-mode: + implicit-casts: false + implicit-dynamic: false + errors: + todo: ignore + exclude: + - flutter/** + - lib/*.dart + +linter: + rules: + - camel_case_types + - hash_and_equals + - iterable_contains_unrelated_type + - list_remove_unrelated_type + - unrelated_type_equality_checks + - valid_regexps diff --git a/FlutterHelper/common_utils/example/lib/main.dart b/FlutterHelper/common_utils/example/lib/main.dart new file mode 100644 index 00000000..29ee0674 --- /dev/null +++ b/FlutterHelper/common_utils/example/lib/main.dart @@ -0,0 +1,177 @@ +import 'dart:convert'; + +import 'package:common_utils/common_utils.dart'; + +void main() { + LogUtil.e("---------------- DateUtil st ----------------"); + String dateStr = "2019-07-09 16:16:16"; + DateTime? dateTime = DateUtil.getDateTime(dateStr); + DateTime now = DateTime.now(); + int? dateMs = DateUtil.getDateMsByTimeStr(dateStr); + String nowStr1 = DateUtil.formatDateMs(dateMs!, format: DateFormats.full); + String nowStr2 = DateUtil.formatDateStr(dateStr, format: "yyyy/M/d HH:mm:ss"); + String nowStr3 = DateUtil.formatDate(dateTime, format: DateFormats.zh_full); + String nowStr4 = DateUtil.formatDate(dateTime, format: 'yyyy年M月d日 HH时mm分ss秒'); + LogUtil.e('nowStr1: $nowStr1'); //2020-05-15 16:58:47 + LogUtil.e('nowStr2: $nowStr2'); //2019/7/9 16:16:16 + LogUtil.e('nowStr3: $nowStr3'); //2019年07月09日 16时16分16秒 + LogUtil.e('nowStr4: $nowStr4'); //2019年7月9日 16时16分16秒 + DateTime week = DateTime(2020, 5, 6); + LogUtil.e('2020/5/6 : ${DateUtil.getWeekday(week, short: true)}'); + LogUtil.e('toady: ${DateUtil.getWeekdayByMs(now.millisecondsSinceEpoch)}'); + LogUtil.e("Today DayOfYear: " + DateUtil.getDayOfYear(now).toString()); + LogUtil.e("---------------- DateUtil en ----------------\n"); + + LogUtil.e("---------------- EncryptUtil st ----------------"); + const String key = '11, 22, 33, 44, 55, 66'; + String userName = 'Sky24n'; + String encode = EncryptUtil.xorBase64Encode(userName, key); // WH1YHgMs + String decode = EncryptUtil.xorBase64Decode(encode, key); // Sky24n + LogUtil.e('EncryptUtil -> encode: $encode, decode: $decode'); + LogUtil.e("---------------- EncryptUtil en ----------------\n"); + + LogUtil.e("---------------- JsonUtil st ----------------"); + String intListStr = "[1, 2, 3, 4, 5, 6]"; + List? intList = JsonUtil.getList(intListStr); + LogUtil.e("JsonUtil getList -> intList: $intList"); + String strListStr = "[\"tom\",\"tony\",\"jacky\"]"; + List? strList = JsonUtil.getList(strListStr); + LogUtil.e("JsonUtil getList -> strList: $strList"); + + String objStr = "{\"name\":\"成都市\"}"; + City? hisCity = + JsonUtil.getObj(objStr, (v) => City.fromJson(v as Map)); + String listStr = "[{\"name\":\"成都市\"}, {\"name\":\"北京市\"}]"; + List? cityList = JsonUtil.getObjList( + listStr, (v) => City.fromJson(v as Map)); + LogUtil.e( + 'JsonUtil -> hisCity: ${hisCity.toString()} ; cityList: ${cityList.toString()}'); + LogUtil.e("---------------- JsonUtil en ----------------\n"); + + LogUtil.e("---------------- LogUtil st ----------------"); + //LogUtil.init(isDebug: true, tag: "test", maxLen: 128); + LogUtil.init(isDebug: true); + StringBuffer sb = StringBuffer(); + for (int i = 1; i <= 160; i++) { + sb.write('$i,'); + } + LogUtil.e(sb.toString()); + + LogUtil.d(sb.toString()); + LogUtil.e("---------------- LogUtil en ----------------\n"); + + LogUtil.e("---------------- MoneyUtil st ----------------"); + String yuan = '1.66'; + LogUtil.e(MoneyUtil.changeFStr2YWithUnit("1160", + format: MoneyFormat.NORMAL, unit: MoneyUnit.YUAN_ZH) + + " " + + MoneyUtil.changeYWithUnit(yuan, MoneyUnit.YUAN_ZH)); + LogUtil.e("---------------- MoneyUtil en ----------------\n"); + + LogUtil.e("---------------- NumUtil st ----------------"); + //保留小数点后2位数 + String tempStr = "1.5561111"; + num? value = NumUtil.getNumByValueStr(tempStr, fractionDigits: 2); + LogUtil.e("getDoubleByStr: " + '$value'); //result=1.56 + double a = 59.89; + int b = 10000; + + double c = 70.59; + double d = 10.0; + + LogUtil.e("add a/b : " + + (a / b).toString() + + " add: " + + NumUtil.divide(a, b).toString()); // a+b : 0.30000000000000004 add: 0.3 + LogUtil.e("mul c*d : " + + (c * d).toString() + + " mul: " + + NumUtil.multiply(c, d).toString() + + " greaterThan: " + + NumUtil.greaterThan(a, b) + .toString()); //c*d : 705.9000000000001 mul: 705.9 greaterThan: false + LogUtil.e("---------------- NumUtil en ----------------\n"); + + LogUtil.e("---------------- ObjectUtil st ----------------"); + List listA = ["A", "B", "C"]; + List listB = ["A", "B", "C"]; + LogUtil.e("Two List Is Equal: " + + ObjectUtil.twoListIsEqual(listA, listB).toString()); + LogUtil.e("---------------- ObjectUtil en ----------------\n"); + + LogUtil.e("---------------- TextUtil st ----------------"); + String phoneNo = TextUtil.formatSpace4("15845678910"); + LogUtil.e(phoneNo); //1584 5678 910 + LogUtil.e("replace: " + TextUtil.replace(phoneNo, ' ', '')); + LogUtil.e("formatComma3: " + TextUtil.formatComma3(12345678)); //12,345,678 + LogUtil.e("reverse: " + TextUtil.reverse("12345678")); //87654321 + LogUtil.e("hideNumber: " + TextUtil.hideNumber("15845678910")); //158****8910 + LogUtil.e("---------------- TextUtil en ----------------\n"); + + LogUtil.e("---------------- TimelineUtil st ----------------"); + DateTime dateTime1 = DateTime(2020, 5, 20, 22, 30, 00); + DateTime locDateTime = DateTime(2020, 5, 20, 23, 30, 00); + LogUtil.e("Timeline: " + + TimelineUtil.formatByDateTime( + dateTime1, + locDateTime: locDateTime, + //locale: 'zh', + ).toString()); + LogUtil.e("Timeline: " + + TimelineUtil.formatByDateTime( + dateTime1, + //locDateTime: locDateTime, + ).toString()); + LogUtil.e("Timeline formatA: " + + TimelineUtil.formatA( + dateTime1.millisecondsSinceEpoch, + languageCode: 'zh', + short: true, + ).toString()); + LogUtil.e("---------------- TimelineUtil en ----------------\n"); + + LogUtil.e("---------------- TimerUtil st ----------------"); + TimerUtil? timerUtil; + //定时任务test + timerUtil = TimerUtil(mInterval: 1000, mTotalTime: 5 * 1000); + //timerUtil.setInterval(1000); + timerUtil.setOnTimerTickCallback((int value) { + LogUtil.e("TimerTick: " + value.toString()); + }); + timerUtil.startTimer(); + if (timerUtil != null) timerUtil.cancel(); //dispose() + + TimerUtil timerCountDown; + //倒计时test + timerCountDown = TimerUtil(mInterval: 1000, mTotalTime: 3 * 1000); +// timerCountDown.setInterval(1000); +// timerCountDown.setTotalTime(3 * 1000); + timerCountDown.setOnTimerTickCallback((int value) { + double tick = (value / 1000); + LogUtil.e("CountDown: " + tick.toInt().toString()); + }); + //timerCountDown.startCountDown(); + //if (timerCountDown != null) timerCountDown.cancel(); //dispose() + LogUtil.e("---------------- TimerUtil en ----------------\n"); + + LogUtil.e('Regex: ${RegexUtil.isPassport('EG6504900')}'); +} + +class City { + String name; + + City(this.name); + + City.fromJson(Map json) : name = json['name'] as String; + + Map toJson() { + Map map = Map(); + map['name'] = name; + return map; + } + + @override + String toString() { + return json.encode(this); + } +} diff --git a/FlutterHelper/common_utils/lib/common_utils.dart b/FlutterHelper/common_utils/lib/common_utils.dart new file mode 100644 index 00000000..6410ba50 --- /dev/null +++ b/FlutterHelper/common_utils/lib/common_utils.dart @@ -0,0 +1,13 @@ +library common_utils; + +export 'src/date_util.dart'; +export 'src/encrypt_util.dart'; +export 'src/json_util.dart'; +export 'src/log_util.dart'; +export 'src/money_util.dart'; +export 'src/num_util.dart'; +export 'src/object_util.dart'; +export 'src/regex_util.dart'; +export 'src/text_util.dart'; +export 'src/timeline_util.dart'; +export 'src/timer_util.dart'; diff --git a/FlutterHelper/common_utils/lib/src/date_util.dart b/FlutterHelper/common_utils/lib/src/date_util.dart new file mode 100644 index 00000000..c8ddb33a --- /dev/null +++ b/FlutterHelper/common_utils/lib/src/date_util.dart @@ -0,0 +1,289 @@ +/** + * @Author: Sky24n + * @GitHub: https://github.com/Sky24n + * @Description: Date Util. + * @Date: 2018/9/8 + */ + +/// 一些常用格式参照。可以自定义格式,例如:'yyyy/MM/dd HH:mm:ss','yyyy/M/d HH:mm:ss'。 +/// 格式要求 +/// year -> yyyy/yy month -> MM/M day -> dd/d +/// hour -> HH/H minute -> mm/m second -> ss/s +class DateFormats { + static String full = 'yyyy-MM-dd HH:mm:ss'; + static String y_mo_d_h_m = 'yyyy-MM-dd HH:mm'; + static String y_mo_d = 'yyyy-MM-dd'; + static String y_mo = 'yyyy-MM'; + static String mo_d = 'MM-dd'; + static String mo_d_h_m = 'MM-dd HH:mm'; + static String h_m_s = 'HH:mm:ss'; + static String h_m = 'HH:mm'; + + static String zh_full = 'yyyy年MM月dd日 HH时mm分ss秒'; + static String zh_y_mo_d_h_m = 'yyyy年MM月dd日 HH时mm分'; + static String zh_y_mo_d = 'yyyy年MM月dd日'; + static String zh_y_mo = 'yyyy年MM月'; + static String zh_mo_d = 'MM月dd日'; + static String zh_mo_d_h_m = 'MM月dd日 HH时mm分'; + static String zh_h_m_s = 'HH时mm分ss秒'; + static String zh_h_m = 'HH时mm分'; +} + +/// month->days. +Map MONTH_DAY = { + 1: 31, + 2: 28, + 3: 31, + 4: 30, + 5: 31, + 6: 30, + 7: 31, + 8: 31, + 9: 30, + 10: 31, + 11: 30, + 12: 31, +}; + +/// Date Util. +class DateUtil { + /// get DateTime By DateStr. + static DateTime? getDateTime(String dateStr, {bool? isUtc}) { + DateTime? dateTime = DateTime.tryParse(dateStr); + if (isUtc != null) { + if (isUtc) { + dateTime = dateTime?.toUtc(); + } else { + dateTime = dateTime?.toLocal(); + } + } + return dateTime; + } + + /// get DateTime By Milliseconds. + static DateTime getDateTimeByMs(int ms, {bool isUtc = false}) { + return DateTime.fromMillisecondsSinceEpoch(ms, isUtc: isUtc); + } + + /// get DateMilliseconds By DateStr. + static int? getDateMsByTimeStr(String dateStr, {bool? isUtc}) { + DateTime? dateTime = getDateTime(dateStr, isUtc: isUtc); + return dateTime?.millisecondsSinceEpoch; + } + + /// get Now Date Milliseconds. + static int getNowDateMs() { + return DateTime.now().millisecondsSinceEpoch; + } + + /// get Now Date Str.(yyyy-MM-dd HH:mm:ss) + static String getNowDateStr() { + return formatDate(DateTime.now()); + } + + /// format date by milliseconds. + /// milliseconds 日期毫秒 + static String formatDateMs(int ms, {bool isUtc = false, String? format}) { + return formatDate(getDateTimeByMs(ms, isUtc: isUtc), format: format); + } + + /// format date by date str. + /// dateStr 日期字符串 + static String formatDateStr(String dateStr, {bool? isUtc, String? format}) { + return formatDate(getDateTime(dateStr, isUtc: isUtc), format: format); + } + + /// format date by DateTime. + /// format 转换格式(已提供常用格式 DateFormats,可以自定义格式:'yyyy/MM/dd HH:mm:ss') + /// 格式要求 + /// year -> yyyy/yy month -> MM/M day -> dd/d + /// hour -> HH/H minute -> mm/m second -> ss/s + static String formatDate(DateTime? dateTime, {String? format}) { + if (dateTime == null) return ''; + format = format ?? DateFormats.full; + if (format.contains('yy')) { + String year = dateTime.year.toString(); + if (format.contains('yyyy')) { + format = format.replaceAll('yyyy', year); + } else { + format = format.replaceAll( + 'yy', year.substring(year.length - 2, year.length)); + } + } + + format = _comFormat(dateTime.month, format, 'M', 'MM'); + format = _comFormat(dateTime.day, format, 'd', 'dd'); + format = _comFormat(dateTime.hour, format, 'H', 'HH'); + format = _comFormat(dateTime.minute, format, 'm', 'mm'); + format = _comFormat(dateTime.second, format, 's', 'ss'); + format = _comFormat(dateTime.millisecond, format, 'S', 'SSS'); + + return format; + } + + /// com format. + static String _comFormat( + int value, String format, String single, String full) { + if (format.contains(single)) { + if (format.contains(full)) { + format = + format.replaceAll(full, value < 10 ? '0$value' : value.toString()); + } else { + format = format.replaceAll(single, value.toString()); + } + } + return format; + } + + /// get WeekDay. + /// dateTime + /// isUtc + /// languageCode zh or en + /// short + static String getWeekday(DateTime? dateTime, + {String languageCode = 'en', bool short = false}) { + if (dateTime == null) return ""; + String weekday = ""; + switch (dateTime.weekday) { + case 1: + weekday = languageCode == 'zh' ? '星期一' : 'Monday'; + break; + case 2: + weekday = languageCode == 'zh' ? '星期二' : 'Tuesday'; + break; + case 3: + weekday = languageCode == 'zh' ? '星期三' : 'Wednesday'; + break; + case 4: + weekday = languageCode == 'zh' ? '星期四' : 'Thursday'; + break; + case 5: + weekday = languageCode == 'zh' ? '星期五' : 'Friday'; + break; + case 6: + weekday = languageCode == 'zh' ? '星期六' : 'Saturday'; + break; + case 7: + weekday = languageCode == 'zh' ? '星期日' : 'Sunday'; + break; + default: + break; + } + return languageCode == 'zh' + ? (short ? weekday.replaceAll('星期', '周') : weekday) + : weekday.substring(0, short ? 3 : weekday.length); + } + + /// get WeekDay By Milliseconds. + static String getWeekdayByMs(int milliseconds, + {bool isUtc = false, String languageCode = 'en', bool short = false}) { + DateTime dateTime = getDateTimeByMs(milliseconds, isUtc: isUtc); + return getWeekday(dateTime, languageCode: languageCode, short: short); + } + + /// get day of year. + /// 在今年的第几天. + static int getDayOfYear(DateTime dateTime) { + int year = dateTime.year; + int month = dateTime.month; + int days = dateTime.day; + for (int i = 1; i < month; i++) { + days = days + MONTH_DAY[i]!; + } + if (isLeapYearByYear(year) && month > 2) { + days = days + 1; + } + return days; + } + + /// get day of year. + /// 在今年的第几天. + static int getDayOfYearByMs(int ms, {bool isUtc = false}) { + return getDayOfYear(DateTime.fromMillisecondsSinceEpoch(ms, isUtc: isUtc)); + } + + /// is today. + /// 是否是当天. + static bool isToday(int? milliseconds, {bool isUtc = false, int? locMs}) { + if (milliseconds == null || milliseconds == 0) return false; + DateTime old = + DateTime.fromMillisecondsSinceEpoch(milliseconds, isUtc: isUtc); + DateTime now; + if (locMs != null) { + now = DateUtil.getDateTimeByMs(locMs); + } else { + now = isUtc ? DateTime.now().toUtc() : DateTime.now().toLocal(); + } + return old.year == now.year && old.month == now.month && old.day == now.day; + } + + /// is yesterday by dateTime. + /// 是否是昨天. + static bool isYesterday(DateTime dateTime, DateTime locDateTime) { + if (yearIsEqual(dateTime, locDateTime)) { + int spDay = getDayOfYear(locDateTime) - getDayOfYear(dateTime); + return spDay == 1; + } else { + return ((locDateTime.year - dateTime.year == 1) && + dateTime.month == 12 && + locDateTime.month == 1 && + dateTime.day == 31 && + locDateTime.day == 1); + } + } + + /// is yesterday by millis. + /// 是否是昨天. + static bool isYesterdayByMs(int ms, int locMs) { + return isYesterday(DateTime.fromMillisecondsSinceEpoch(ms), + DateTime.fromMillisecondsSinceEpoch(locMs)); + } + + /// is Week. + /// 是否是本周. + static bool isWeek(int? ms, {bool isUtc = false, int? locMs}) { + if (ms == null || ms <= 0) { + return false; + } + DateTime _old = DateTime.fromMillisecondsSinceEpoch(ms, isUtc: isUtc); + DateTime _now; + if (locMs != null) { + _now = DateUtil.getDateTimeByMs(locMs, isUtc: isUtc); + } else { + _now = isUtc ? DateTime.now().toUtc() : DateTime.now().toLocal(); + } + + DateTime old = + _now.millisecondsSinceEpoch > _old.millisecondsSinceEpoch ? _old : _now; + DateTime now = + _now.millisecondsSinceEpoch > _old.millisecondsSinceEpoch ? _now : _old; + return (now.weekday >= old.weekday) && + (now.millisecondsSinceEpoch - old.millisecondsSinceEpoch <= + 7 * 24 * 60 * 60 * 1000); + } + + /// year is equal. + /// 是否同年. + static bool yearIsEqual(DateTime dateTime, DateTime locDateTime) { + return dateTime.year == locDateTime.year; + } + + /// year is equal. + /// 是否同年. + static bool yearIsEqualByMs(int ms, int locMs) { + return yearIsEqual(DateTime.fromMillisecondsSinceEpoch(ms), + DateTime.fromMillisecondsSinceEpoch(locMs)); + } + + /// Return whether it is leap year. + /// 是否是闰年 + static bool isLeapYear(DateTime dateTime) { + return isLeapYearByYear(dateTime.year); + } + + /// Return whether it is leap year. + /// 是否是闰年 + static bool isLeapYearByYear(int year) { + return year % 4 == 0 && year % 100 != 0 || year % 400 == 0; + } +} diff --git a/FlutterHelper/common_utils/lib/src/encrypt_util.dart b/FlutterHelper/common_utils/lib/src/encrypt_util.dart new file mode 100644 index 00000000..759f0432 --- /dev/null +++ b/FlutterHelper/common_utils/lib/src/encrypt_util.dart @@ -0,0 +1,61 @@ +import 'dart:convert'; + +import 'package:crypto/crypto.dart'; +import 'package:convert/convert.dart'; + +/** + * @Author: Sky24n + * @GitHub: https://github.com/Sky24n + * @Description: Encrypt Util. + * @Date: 2019/07/02 + */ + +/// Encrypt Util. +class EncryptUtil { + /// md5 加密 + static String encodeMd5(String data) { + var content = Utf8Encoder().convert(data); + var digest = md5.convert(content); + return hex.encode(digest.bytes); + } + + /// 异或对称加密 + static String xorCode(String res, String key) { + List keyList = key.split(','); + List codeUnits = res.codeUnits; + List codes = []; + for (int i = 0, length = codeUnits.length; i < length; i++) { + int code = codeUnits[i] ^ int.parse(keyList[i % keyList.length]); + codes.add(code); + } + return String.fromCharCodes(codes); + } + + /// 异或对称 Base64 加密 + static String xorBase64Encode(String res, String key) { + String encode = xorCode(res, key); + encode = encodeBase64(encode); + return encode; + } + + /// 异或对称 Base64 解密 + static String xorBase64Decode(String res, String key) { + String encode = decodeBase64(res); + encode = xorCode(encode, key); + return encode; + } + + /// Base64加密 + static String encodeBase64(String data) { + var content = utf8.encode(data); + var digest = base64Encode(content); + return digest; + } + + /// Base64解密 + static String decodeBase64(String data) { + List bytes = base64Decode(data); + String result = utf8.decode(bytes); + return result; + } +} diff --git a/FlutterHelper/common_utils/lib/src/json_util.dart b/FlutterHelper/common_utils/lib/src/json_util.dart new file mode 100644 index 00000000..b10b5a81 --- /dev/null +++ b/FlutterHelper/common_utils/lib/src/json_util.dart @@ -0,0 +1,99 @@ +import 'dart:convert'; + +/** + * @Author: Sky24n + * @GitHub: https://github.com/Sky24n + * @Description: Date Util. + * @Date: 2020/01/06 + */ + +/// Json Util. +class JsonUtil { + /// Converts object [value] to a JSON string. + static String? encodeObj(dynamic value) { + return value == null ? null : json.encode(value); + } + + /// Converts JSON string [source] to object. + static T? getObj(String? source, T f(Map v)) { + if (source == null || source.isEmpty) return null; + try { + Map map = json.decode(source); + return f(map); + } catch (e) { + print('JsonUtil convert error, Exception:${e.toString()}'); + } + return null; + } + + /// Converts JSON string or JSON map [source] to object. + static T? getObject(dynamic source, T f(Map v)) { + if (source == null || source.toString().isEmpty) return null; + try { + Map map; + if (source is String) { + map = json.decode(source); + } else { + map = source; + } + return f(map); + } catch (e) { + print('JsonUtil convert error, Exception:${e.toString()}'); + } + return null; + } + + /// Converts JSON string list [source] to object list. + static List? getObjList(String? source, T f(Map v)) { + if (source == null || source.isEmpty) return null; + try { + List list = json.decode(source); + return list.map((value) { + if (value is String) { + value = json.decode(value); + } + return f(value); + }).toList(); + } catch (e) { + print('JsonUtil convert error, Exception:${e.toString()}'); + } + return null; + } + + /// Converts JSON string or JSON map list [source] to object list. + static List? getObjectList(dynamic source, T f(Map v)) { + if (source == null || source.toString().isEmpty) return null; + try { + List list; + if (source is String) { + list = json.decode(source); + } else { + list = source; + } + return list.map((value) { + if (value is String) { + value = json.decode(value); + } + return f(value); + }).toList(); + } catch (e) { + print('JsonUtil convert error, Exception:${e.toString()}'); + } + return null; + } + + /// get List + /// [1, 2, 3, 4, 5, 6]; + /// "[\"tom\",\"tony\",\"jacky\"]"; + static List? getList(dynamic source) { + List? list; + if (source is String) { + list = json.decode(source); + } else { + list = source; + } + return list?.map((v) { + return v as T; + }).toList(); + } +} diff --git a/FlutterHelper/common_utils/lib/src/log_util.dart b/FlutterHelper/common_utils/lib/src/log_util.dart new file mode 100644 index 00000000..5c47ff9b --- /dev/null +++ b/FlutterHelper/common_utils/lib/src/log_util.dart @@ -0,0 +1,64 @@ +import 'dart:developer'; + +/** + * @Author: Sky24n + * @GitHub: https://github.com/Sky24n + * @Description: Log Util. + * @Date: 2018/9/29 + */ + +/// Log Util. +class LogUtil { + static const String _defTag = 'common_utils'; + static bool _debugMode = false; //是否是debug模式,true: log v 不输出. + static int _maxLen = 128; + static String _tagValue = _defTag; + + static void init({ + String tag = _defTag, + bool isDebug = false, + int maxLen = 128, + }) { + _tagValue = tag; + _debugMode = isDebug; + _maxLen = maxLen; + } + + static void d(Object? object, {String? tag}) { + if (_debugMode) { + log('$tag d | ${object?.toString()}'); + } + } + + static void e(Object? object, {String? tag}) { + _printLog(tag, ' e ', object); + } + + static void v(Object? object, {String? tag}) { + if (_debugMode) { + _printLog(tag, ' v ', object); + } + } + + static void _printLog(String? tag, String stag, Object? object) { + String da = object?.toString() ?? 'null'; + tag = tag ?? _tagValue; + if (da.length <= _maxLen) { + print('$tag$stag $da'); + return; + } + print( + '$tag$stag — — — — — — — — — — — — — — — — st — — — — — — — — — — — — — — — —'); + while (da.isNotEmpty) { + if (da.length > _maxLen) { + print('$tag$stag| ${da.substring(0, _maxLen)}'); + da = da.substring(_maxLen, da.length); + } else { + print('$tag$stag| $da'); + da = ''; + } + } + print( + '$tag$stag — — — — — — — — — — — — — — — — ed — — — — — — — — — — — — — — — —'); + } +} diff --git a/FlutterHelper/common_utils/lib/src/money_util.dart b/FlutterHelper/common_utils/lib/src/money_util.dart new file mode 100644 index 00000000..2f6b398a --- /dev/null +++ b/FlutterHelper/common_utils/lib/src/money_util.dart @@ -0,0 +1,108 @@ +import 'package:common_utils/src/num_util.dart'; + +enum MoneyUnit { + NORMAL, // 6.00 + YUAN, // ¥6.00 + YUAN_ZH, // 6.00元 + DOLLAR, // $6.00 +} +enum MoneyFormat { + NORMAL, //保留两位小数(6.00元) + END_INTEGER, //去掉末尾'0'(6.00元 -> 6元, 6.60元 -> 6.6元) + YUAN_INTEGER, //整元(6.00元 -> 6元) +} +/** + * @Author: Sky24n + * @GitHub: https://github.com/Sky24n + * @Description: Money Util. + * @Date: 2018/9/29 + */ + +/// Money Util. +class MoneyUtil { + static const String YUAN = '¥'; + static const String YUAN_ZH = '元'; + static const String DOLLAR = '\$'; + + /// fen to yuan, format output. + /// 分 转 元, format格式输出. + static String changeF2Y(int amount, + {MoneyFormat format = MoneyFormat.NORMAL}) { + String moneyTxt; + double yuan = NumUtil.divide(amount, 100); + switch (format) { + case MoneyFormat.NORMAL: + moneyTxt = yuan.toStringAsFixed(2); + break; + case MoneyFormat.END_INTEGER: + if (amount % 100 == 0) { + moneyTxt = yuan.toInt().toString(); + } else if (amount % 10 == 0) { + moneyTxt = yuan.toStringAsFixed(1); + } else { + moneyTxt = yuan.toStringAsFixed(2); + } + break; + case MoneyFormat.YUAN_INTEGER: + moneyTxt = (amount % 100 == 0) + ? yuan.toInt().toString() + : yuan.toStringAsFixed(2); + break; + } + return moneyTxt; + } + + /// fen str to yuan, format & unit output. + /// 分字符串 转 元, format 与 unit 格式 输出. + static String changeFStr2YWithUnit(String amountStr, + {MoneyFormat format = MoneyFormat.NORMAL, + MoneyUnit unit = MoneyUnit.NORMAL}) { + int amount = int.parse(amountStr); + return changeF2YWithUnit(amount, format: format, unit: unit); + } + + /// fen to yuan, format & unit output. + /// 分 转 元, format 与 unit 格式 输出. + static String changeF2YWithUnit(int amount, + {MoneyFormat format = MoneyFormat.NORMAL, + MoneyUnit unit = MoneyUnit.NORMAL}) { + return withUnit(changeF2Y(amount, format: format), unit); + } + + /// yuan, format & unit output.(yuan is int,double,str). + /// 元, format 与 unit 格式 输出. + static String changeYWithUnit(Object yuan, MoneyUnit unit, + {MoneyFormat? format}) { + String yuanTxt = yuan.toString(); + if (format != null) { + int amount = changeY2F(yuan); + yuanTxt = changeF2Y(amount.toInt(), format: format); + } + return withUnit(yuanTxt, unit); + } + + /// yuan to fen. + /// 元 转 分, + static int changeY2F(Object yuan) { + return NumUtil.multiplyDecStr(yuan.toString(), '100').toInt(); + } + + /// with unit. + /// 拼接单位. + static String withUnit(String moneyTxt, MoneyUnit unit) { + switch (unit) { + case MoneyUnit.YUAN: + moneyTxt = YUAN + moneyTxt; + break; + case MoneyUnit.YUAN_ZH: + moneyTxt = moneyTxt + YUAN_ZH; + break; + case MoneyUnit.DOLLAR: + moneyTxt = DOLLAR + moneyTxt; + break; + default: + break; + } + return moneyTxt; + } +} diff --git a/FlutterHelper/common_utils/lib/src/num_util.dart b/FlutterHelper/common_utils/lib/src/num_util.dart new file mode 100644 index 00000000..84ed4efd --- /dev/null +++ b/FlutterHelper/common_utils/lib/src/num_util.dart @@ -0,0 +1,161 @@ +import 'package:decimal/decimal.dart'; + +/** + * @Author: Sky24n + * @GitHub: https://github.com/Sky24n + * @Description: Num Util. + * @Date: 2018/9/18 + */ + +/// Num Util. +class NumUtil { + /// The parameter [fractionDigits] must be an integer satisfying: `0 <= fractionDigits <= 20`. + static num? getNumByValueStr(String valueStr, {int? fractionDigits}) { + double? value = double.tryParse(valueStr); + return fractionDigits == null + ? value + : getNumByValueDouble(value, fractionDigits); + } + + /// The parameter [fractionDigits] must be an integer satisfying: `0 <= fractionDigits <= 20`. + static num? getNumByValueDouble(double? value, int fractionDigits) { + if (value == null) return null; + String valueStr = value.toStringAsFixed(fractionDigits); + return fractionDigits == 0 + ? int.tryParse(valueStr) + : double.tryParse(valueStr); + } + + /// get int by value str. + static int? getIntByValueStr(String valueStr, {int? defValue = 0}) { + return int.tryParse(valueStr) ?? defValue; + } + + /// get double by value str. + static double? getDoubleByValueStr(String valueStr, {double? defValue = 0}) { + return double.tryParse(valueStr) ?? defValue; + } + + ///isZero + static bool isZero(num? value) { + return value == null || value == 0; + } + + /// 加 (精确相加,防止精度丢失). + /// add (without loosing precision). + static double add(num a, num b) { + return addDec(a, b).toDouble(); + } + + /// 减 (精确相减,防止精度丢失). + /// subtract (without loosing precision). + static double subtract(num a, num b) { + return subtractDec(a, b).toDouble(); + } + + /// 乘 (精确相乘,防止精度丢失). + /// multiply (without loosing precision). + static double multiply(num a, num b) { + return multiplyDec(a, b).toDouble(); + } + + /// 除 (精确相除,防止精度丢失). + /// divide (without loosing precision). + static double divide(num a, num b) { + return divideDec(a, b).toDouble(); + } + + /// 加 (精确相加,防止精度丢失). + /// add (without loosing precision). + static Decimal addDec(num a, num b) { + return addDecStr(a.toString(), b.toString()); + } + + /// 减 (精确相减,防止精度丢失). + /// subtract (without loosing precision). + static Decimal subtractDec(num a, num b) { + return subtractDecStr(a.toString(), b.toString()); + } + + /// 乘 (精确相乘,防止精度丢失). + /// multiply (without loosing precision). + static Decimal multiplyDec(num a, num b) { + return multiplyDecStr(a.toString(), b.toString()); + } + + /// 除 (精确相除,防止精度丢失). + /// divide (without loosing precision). + static Decimal divideDec(num a, num b) { + return divideDecStr(a.toString(), b.toString()); + } + + /// 余数 + static Decimal remainder(num a, num b) { + return remainderDecStr(a.toString(), b.toString()); + } + + /// Relational less than operator. + static bool lessThan(num a, num b) { + return lessThanDecStr(a.toString(), b.toString()); + } + + /// Relational less than or equal operator. + static bool thanOrEqual(num a, num b) { + return thanOrEqualDecStr(a.toString(), b.toString()); + } + + /// Relational greater than operator. + static bool greaterThan(num a, num b) { + return greaterThanDecStr(a.toString(), b.toString()); + } + + /// Relational greater than or equal operator. + static bool greaterOrEqual(num a, num b) { + return greaterOrEqualDecStr(a.toString(), b.toString()); + } + + /// 加 + static Decimal addDecStr(String a, String b) { + return Decimal.parse(a) + Decimal.parse(b); + } + + /// 减 + static Decimal subtractDecStr(String a, String b) { + return Decimal.parse(a) - Decimal.parse(b); + } + + /// 乘 + static Decimal multiplyDecStr(String a, String b) { + return Decimal.parse(a) * Decimal.parse(b); + } + + /// 除 + static Decimal divideDecStr(String a, String b) { + return Decimal.parse(a) / Decimal.parse(b); + } + + /// 余数 + static Decimal remainderDecStr(String a, String b) { + return Decimal.parse(a) % Decimal.parse(b); + } + + /// Relational less than operator. + static bool lessThanDecStr(String a, String b) { + return Decimal.parse(a) < Decimal.parse(b); + } + + /// Relational less than or equal operator. + static bool thanOrEqualDecStr(String a, String b) { + return Decimal.parse(a) <= Decimal.parse(b); + } + + /// Relational greater than operator. + static bool greaterThanDecStr(String a, String b) { + return Decimal.parse(a) > Decimal.parse(b); + } + + /// Relational greater than or equal operator. + static bool greaterOrEqualDecStr(String a, String b) { + return Decimal.parse(a) >= Decimal.parse(b); + } +} diff --git a/FlutterHelper/common_utils/lib/src/object_util.dart b/FlutterHelper/common_utils/lib/src/object_util.dart new file mode 100644 index 00000000..ea6bc719 --- /dev/null +++ b/FlutterHelper/common_utils/lib/src/object_util.dart @@ -0,0 +1,70 @@ +/** + * @Author: Sky24n + * @GitHub: https://github.com/Sky24n + * @Description: Object Util. + * @Date: 2018/9/8 + */ + +/// Object Util. +class ObjectUtil { + /// Returns true if the string is null or 0-length. + static bool isEmptyString(String? str) { + return str == null || str.isEmpty; + } + + /// Returns true if the list is null or 0-length. + static bool isEmptyList(Iterable? list) { + return list == null || list.isEmpty; + } + + /// Returns true if there is no key/value pair in the map. + static bool isEmptyMap(Map? map) { + return map == null || map.isEmpty; + } + + /// Returns true String or List or Map is empty. + static bool isEmpty(Object? object) { + if (object == null) return true; + if (object is String && object.isEmpty) { + return true; + } else if (object is Iterable && object.isEmpty) { + return true; + } else if (object is Map && object.isEmpty) { + return true; + } + return false; + } + + /// Returns true String or List or Map is not empty. + static bool isNotEmpty(Object? object) { + return !isEmpty(object); + } + + /// Returns true Two List Is Equal. + static bool twoListIsEqual(List? listA, List? listB) { + if (listA == listB) return true; + if (listA == null || listB == null) return false; + int length = listA.length; + if (length != listB.length) return false; + for (int i = 0; i < length; i++) { + if (!listA.contains(listB[i])) { + return false; + } + } + return true; + } + + /// get length. + static int getLength(Object? value) { + if (value == null) return 0; + if (value is String) { + return value.length; + } else if (value is Iterable) { + return value.length; + } else if (value is Map) { + return value.length; + } else { + return 0; + } + } +} diff --git a/FlutterHelper/common_utils/lib/src/regex_util.dart b/FlutterHelper/common_utils/lib/src/regex_util.dart new file mode 100644 index 00000000..0b04817a --- /dev/null +++ b/FlutterHelper/common_utils/lib/src/regex_util.dart @@ -0,0 +1,238 @@ +/** + * @Author: Sky24n + * @GitHub: https://github.com/Sky24n + * @Description: Regex Util. + * @Date: 2018/9/8 + */ + +/// id card province dict. +List ID_CARD_PROVINCE_DICT = [ + '11=北京', + '12=天津', + '13=河北', + '14=山西', + '15=内蒙古', + '21=辽宁', + '22=吉林', + '23=黑龙江', + '31=上海', + '32=江苏', + '33=浙江', + '34=安徽', + '35=福建', + '36=江西', + '37=山东', + '41=河南', + '42=湖北', + '43=湖南', + '44=广东', + '45=广西', + '46=海南', + '50=重庆', + '51=四川', + '52=贵州', + '53=云南', + '54=西藏', + '61=陕西', + '62=甘肃', + '63=青海', + '64=宁夏', + '65=新疆', + '71=台湾老', + '81=香港', + '82=澳门', + '83=台湾新', + '91=国外', +]; + +/// Regex Util. +class RegexUtil { + /// Regex of simple mobile. + static final String regexMobileSimple = '^[1]\\d{10}\$'; + + /// Regex of exact mobile. + ///

china mobile: 134(0-8), 135, 136, 137, 138, 139, 147, 150, 151, 152, 157, 158, 159, 165, 172, 178, 182, 183, 184, 187, 188, 195, 198

+ ///

china unicom: 130, 131, 132, 145, 155, 156, 166, 167, 171, 175, 176, 185, 186

+ ///

china telecom: 133, 153, 162, 173, 177, 180, 181, 189, 199, 191

+ ///

global star: 1349

+ ///

virtual operator: 170

+ static final String regexMobileExact = + '^((13[0-9])|(14[57])|(15[0-35-9])|(16[2567])|(17[01235-8])|(18[0-9])|(19[1589]))\\d{8}\$'; + + /// Regex of telephone number. + static final String regexTel = '^0\\d{2,3}[- ]?\\d{7,8}'; + + /// Regex of id card number which length is 15. + static final String regexIdCard15 = + '^[1-9]\\d{7}((0\\d)|(1[0-2]))(([0|1|2]\\d)|3[0-1])\\d{3}\$'; + + /// Regex of id card number which length is 18. + static final String regexIdCard18 = + '^[1-9]\\d{5}[1-9]\\d{3}((0\\d)|(1[0-2]))(([0|1|2]\\d)|3[0-1])\\d{3}([0-9Xx])\$'; + + /// Regex of email. + static final String regexEmail = + '^\\w+([-+.]\\w+)*@\\w+([-.]\\w+)*\\.\\w+([-.]\\w+)*\$'; + + /// Regex of url. + static final String regexUrl = '[a-zA-Z]+://[^\\s]*'; + + /// Regex of Chinese character. + static final String regexZh = '[\\u4e00-\\u9fa5]'; + + /// Regex of date which pattern is 'yyyy-MM-dd'. + static final String regexDate = + '^(?:(?!0000)[0-9]{4}-(?:(?:0[1-9]|1[0-2])-(?:0[1-9]|1[0-9]|2[0-8])|(?:0[13-9]|1[0-2])-(?:29|30)|(?:0[13578]|1[02])-31)|(?:[0-9]{2}(?:0[48]|[2468][048]|[13579][26])|(?:0[48]|[2468][048]|[13579][26])00)-02-29)\$'; + + /// Regex of ip address. + static final String regexIp = + '((2[0-4]\\d|25[0-5]|[01]?\\d\\d?)\\.){3}(2[0-4]\\d|25[0-5]|[01]?\\d\\d?)'; + + /// must contain letters and numbers, 6 ~ 18. + /// 必须包含字母和数字, 6~18. + static const String regexUsername = + '^(?![0-9]+\$)(?![a-zA-Z]+\$)[0-9A-Za-z]{6,18}\$'; + + /// must contain letters and numbers, can contain special characters 6 ~ 18. + /// 必须包含字母和数字,可包含特殊字符 6~18. + static const String regexUsername2 = + '^(?![0-9]+\$)(?![a-zA-Z]+\$)[0-9A-Za-z\\W]{6,18}\$'; + + /// must contain letters and numbers and special characters, 6 ~ 18. + /// 必须包含字母和数字和殊字符, 6~18. + static const String regexUsername3 = + '^(?![0-9]+\$)(?![a-zA-Z]+\$)(?![0-9a-zA-Z]+\$)(?![0-9\\W]+\$)(?![a-zA-Z\\W]+\$)[0-9A-Za-z\\W]{6,18}\$'; + + /// Regex of QQ number. + static final String regexQQ = '[1-9][0-9]{4,}'; + + /// Regex of postal code in China. + static final String regexChinaPostalCode = "[1-9]\\d{5}(?!\\d)"; + + /// Regex of Passport. + static final String regexPassport = + r'(^[EeKkGgDdSsPpHh]\d{8}$)|(^(([Ee][a-fA-F])|([DdSsPp][Ee])|([Kk][Jj])|([Mm][Aa])|(1[45]))\d{7}$)'; + + static final Map cityMap = Map(); + + ///Return whether input matches regex of simple mobile. + static bool isMobileSimple(String input) { + return matches(regexMobileSimple, input); + } + + ///Return whether input matches regex of exact mobile. + static bool isMobileExact(String input) { + return matches(regexMobileExact, input); + } + + /// Return whether input matches regex of telephone number. + static bool isTel(String input) { + return matches(regexTel, input); + } + + /// Return whether input matches regex of id card number. + static bool isIDCard(String input) { + if (input.length == 15) { + return isIDCard15(input); + } + if (input.length == 18) { + return isIDCard18Exact(input); + } + return false; + } + + /// Return whether input matches regex of id card number which length is 15. + static bool isIDCard15(String input) { + return matches(regexIdCard15, input); + } + + /// Return whether input matches regex of id card number which length is 18. + static bool isIDCard18(String input) { + return matches(regexIdCard18, input); + } + + ///Return whether input matches regex of exact id card number which length is 18. + static bool isIDCard18Exact(String input) { + if (isIDCard18(input)) { + List factor = [7, 9, 10, 5, 8, 4, 2, 1, 6, 3, 7, 9, 10, 5, 8, 4, 2]; + List suffix = [ + '1', + '0', + 'X', + '9', + '8', + '7', + '6', + '5', + '4', + '3', + '2' + ]; + if (cityMap.isEmpty) { + List list = ID_CARD_PROVINCE_DICT; + List> mapEntryList = []; + for (int i = 0, length = list.length; i < length; i++) { + List tokens = list[i].trim().split('='); + MapEntry mapEntry = MapEntry(tokens[0], tokens[1]); + mapEntryList.add(mapEntry); + } + cityMap.addEntries(mapEntryList); + } + if (cityMap[input.substring(0, 2)] != null) { + int weightSum = 0; + for (int i = 0; i < 17; ++i) { + weightSum += (input.codeUnitAt(i) - '0'.codeUnitAt(0)) * factor[i]; + } + int idCardMod = weightSum % 11; + String idCardLast = String.fromCharCode(input.codeUnitAt(17)); + return idCardLast == suffix[idCardMod]; + } + } + return false; + } + + /// Return whether input matches regex of email. + static bool isEmail(String input) { + return matches(regexEmail, input); + } + + /// Return whether input matches regex of url. + static bool isURL(String input) { + return matches(regexUrl, input); + } + + /// Return whether input matches regex of Chinese character. + static bool isZh(String input) { + return '〇' == input || matches(regexZh, input); + } + + /// Return whether input matches regex of date which pattern is 'yyyy-MM-dd'. + static bool isDate(String input) { + return matches(regexDate, input); + } + + /// Return whether input matches regex of ip address. + static bool isIP(String input) { + return matches(regexIp, input); + } + + /// Return whether input matches regex of username. + static bool isUserName(String input, {String regex = regexUsername}) { + return matches(regex, input); + } + + /// Return whether input matches regex of QQ. + static bool isQQ(String input) { + return matches(regexQQ, input); + } + + ///Return whether input matches regex of Passport. + static bool isPassport(String input) { + return matches(regexPassport, input); + } + + static bool matches(String regex, String input) { + if (input.isEmpty) return false; + return RegExp(regex).hasMatch(input); + } +} diff --git a/FlutterHelper/common_utils/lib/src/text_util.dart b/FlutterHelper/common_utils/lib/src/text_util.dart new file mode 100644 index 00000000..3931767f --- /dev/null +++ b/FlutterHelper/common_utils/lib/src/text_util.dart @@ -0,0 +1,83 @@ +/** + * @Author: Sky24n + * @GitHub: https://github.com/Sky24n + * @Description: Text Util. + * @Date: 2019/7/9 + */ + +/// Text Util. +class TextUtil { + /// isEmpty + static bool isEmpty(String? text) { + return text == null || text.isEmpty; + } + + /// 每隔 x位 加 pattern + static String formatDigitPattern(String text, + {int digit = 4, String pattern = ' '}) { + text = text.replaceAllMapped(RegExp('(.{$digit})'), (Match match) { + return '${match.group(0)}$pattern'; + }); + if (text.endsWith(pattern)) { + text = text.substring(0, text.length - 1); + } + return text; + } + + /// 每隔 x位 加 pattern, 从末尾开始 + static String formatDigitPatternEnd(String text, + {int digit = 4, String pattern = ' '}) { + String temp = reverse(text); + temp = formatDigitPattern(temp, digit: digit, pattern: pattern); + temp = reverse(temp); + return temp; + } + + /// 每隔4位加空格 + static String formatSpace4(String text) { + return formatDigitPattern(text); + } + + /// 每隔3三位加逗号 + /// num 数字或数字字符串。int型。 + static String formatComma3(Object num) { + return formatDigitPatternEnd(num.toString(), digit: 3, pattern: ','); + } + + /// 每隔3三位加逗号 + /// num 数字或数字字符串。double型。 + static String formatDoubleComma3(Object num, + {int digit = 3, String pattern = ','}) { + List list = num.toString().split('.'); + String left = + formatDigitPatternEnd(list[0], digit: digit, pattern: pattern); + String right = list[1]; + return '$left.$right'; + } + + /// hideNumber + static String hideNumber(String phoneNo, + {int start = 3, int end = 7, String replacement = '****'}) { + return phoneNo.replaceRange(start, end, replacement); + } + + /// replace + static String replace(String text, Pattern from, String replace) { + return text.replaceAll(from, replace); + } + + /// split + static List split(String text, Pattern pattern) { + return text.split(pattern); + } + + /// reverse + static String reverse(String text) { + if (isEmpty(text)) return ''; + StringBuffer sb = StringBuffer(); + for (int i = text.length - 1; i >= 0; i--) { + sb.writeCharCode(text.codeUnitAt(i)); + } + return sb.toString(); + } +} diff --git a/FlutterHelper/common_utils/lib/src/timeline_util.dart b/FlutterHelper/common_utils/lib/src/timeline_util.dart new file mode 100644 index 00000000..85c07c7f --- /dev/null +++ b/FlutterHelper/common_utils/lib/src/timeline_util.dart @@ -0,0 +1,374 @@ +import 'package:common_utils/src/date_util.dart'; + +/** + * @Author: Sky24n + * @GitHub: https://github.com/Sky24n + * @Description: Timeline Util. + * @Date: 2018/10/3 + */ + +/// (xx)Configurable output. +/// (xx)为可配置输出. +enum DayFormat { + /// (less than 10s->just now)、x minutes、x hours、(Yesterday)、x days. + /// (小于10s->刚刚)、x分钟、x小时、(昨天)、x天. + Simple, + + /// (less than 10s->just now)、x minutes、x hours、[This year:(Yesterday/a day ago)、(two days age)、MM-dd ]、[past years: yyyy-MM-dd] + /// (小于10s->刚刚)、x分钟、x小时、[今年: (昨天/1天前)、(2天前)、MM-dd],[往年: yyyy-MM-dd]. + Common, + + /// 日期 + HH:mm + /// (less than 10s->just now)、x minutes、x hours、[This year:(Yesterday HH:mm/a day ago)、(two days age)、MM-dd HH:mm]、[past years: yyyy-MM-dd HH:mm] + /// 小于10s->刚刚)、x分钟、x小时、[今年: (昨天 HH:mm/1天前)、(2天前)、MM-dd HH:mm],[往年: yyyy-MM-dd HH:mm]. + Full, +} + +/// Timeline information configuration. +/// Timeline信息配置. +abstract class TimelineInfo { + String suffixAgo(); //suffix ago(后缀 后). + + String suffixAfter(); //suffix after(后缀 前). + + int maxJustNowSecond() => 30; // max just now second. + + String lessThanOneMinute() => ''; //just now(刚刚). + + String customYesterday() => ''; //Yesterday(昨天).优先级高于keepOneDay + + bool keepOneDay(); //保持1天,example: true -> 1天前, false -> MM-dd. + + bool keepTwoDays(); //保持2天,example: true -> 2天前, false -> MM-dd. + + String oneMinute(int minutes); //a minute(1分钟). + + String minutes(int minutes); //x minutes(x分钟). + + String anHour(int hours); //an hour(1小时). + + String hours(int hours); //x hours(x小时). + + String oneDay(int days); //a day(1天). + + String weeks(int week) => ''; //x week(星期x). + + String days(int days); //x days(x天). + +} + +class ZhInfo implements TimelineInfo { + String suffixAgo() => '前'; + + String suffixAfter() => '后'; + + int maxJustNowSecond() => 30; + + String lessThanOneMinute() => '刚刚'; + + String customYesterday() => '昨天'; + + bool keepOneDay() => true; + + bool keepTwoDays() => true; + + String oneMinute(int minutes) => '$minutes分钟'; + + String minutes(int minutes) => '$minutes分钟'; + + String anHour(int hours) => '$hours小时'; + + String hours(int hours) => '$hours小时'; + + String oneDay(int days) => '$days天'; + + String weeks(int week) => ''; //x week(星期x). + + String days(int days) => '$days天'; +} + +class EnInfo implements TimelineInfo { + String suffixAgo() => ' ago'; + + String suffixAfter() => ' after'; + + int maxJustNowSecond() => 30; + + String lessThanOneMinute() => 'just now'; + + String customYesterday() => 'Yesterday'; + + bool keepOneDay() => true; + + bool keepTwoDays() => true; + + String oneMinute(int minutes) => 'a minute'; + + String minutes(int minutes) => '$minutes minutes'; + + String anHour(int hours) => 'an hour'; + + String hours(int hours) => '$hours hours'; + + String oneDay(int days) => 'a day'; + + String weeks(int week) => ''; //x week(星期x). + + String days(int days) => '$days days'; +} + +class ZhNormalInfo implements TimelineInfo { + String suffixAgo() => '前'; + + String suffixAfter() => '后'; + + int maxJustNowSecond() => 30; + + String lessThanOneMinute() => '刚刚'; + + String customYesterday() => '昨天'; + + bool keepOneDay() => true; + + bool keepTwoDays() => false; + + String oneMinute(int minutes) => '$minutes分钟'; + + String minutes(int minutes) => '$minutes分钟'; + + String anHour(int hours) => '$hours小时'; + + String hours(int hours) => '$hours小时'; + + String oneDay(int days) => '$days天'; + + String weeks(int week) => ''; //x week(星期x). + + String days(int days) => '$days天'; +} + +class EnNormalInfo implements TimelineInfo { + String suffixAgo() => ' ago'; + + String suffixAfter() => ' after'; + + int maxJustNowSecond() => 30; + + String lessThanOneMinute() => 'just now'; + + String customYesterday() => 'Yesterday'; + + bool keepOneDay() => true; + + bool keepTwoDays() => false; + + String oneMinute(int minutes) => 'a minute'; + + String minutes(int minutes) => '$minutes minutes'; + + String anHour(int hours) => 'an hour'; + + String hours(int hours) => '$hours hours'; + + String oneDay(int days) => 'a day'; + + String weeks(int week) => ''; //x week(星期x). + + String days(int days) => '$days days'; +} + +Map _timelineInfoMap = { + 'zh': ZhInfo(), + 'en': EnInfo(), + 'zh_normal': ZhNormalInfo(), //keepTwoDays() => false + 'en_normal': EnNormalInfo(), //keepTwoDays() => false +}; + +/// add custom configuration. +void setLocaleInfo(String locale, TimelineInfo timelineInfo) { + ArgumentError.checkNotNull(locale, '[locale] must not be null'); + ArgumentError.checkNotNull(timelineInfo, '[timelineInfo] must not be null'); + _timelineInfoMap[locale] = timelineInfo; +} + +/// TimelineUtil +class TimelineUtil { + /// format time by DateTime. + /// dateTime + /// locDateTime: current time or schedule time. + /// locale: output key. + static String formatByDateTime( + DateTime dateTime, { + DateTime? locDateTime, + String? locale, + DayFormat? dayFormat, + }) { + return format( + dateTime.millisecondsSinceEpoch, + locTimeMs: locDateTime?.millisecondsSinceEpoch, + locale: locale, + dayFormat: dayFormat, + ); + } + + /// format time by millis. + /// dateTime : millis. + /// locDateTime: current time or schedule time. millis. + /// locale: output key. + static String format( + int ms, { + int? locTimeMs, + String? locale, + DayFormat? dayFormat, + }) { + int _locTimeMs = locTimeMs ?? DateTime.now().millisecondsSinceEpoch; + String _locale = locale ?? 'en'; + TimelineInfo _info = _timelineInfoMap[_locale] ?? EnInfo(); + DayFormat _dayFormat = dayFormat ?? DayFormat.Common; + + int elapsed = _locTimeMs - ms; + String suffix; + if (elapsed < 0) { + suffix = _info.suffixAfter(); + // suffix after is empty. user just now. + if (suffix.isNotEmpty) { + elapsed = elapsed.abs(); + _dayFormat = DayFormat.Simple; + } else { + return _info.lessThanOneMinute(); + } + } else { + suffix = _info.suffixAgo(); + } + + String timeline; + if (_info.customYesterday().isNotEmpty && + DateUtil.isYesterdayByMs(ms, _locTimeMs)) { + return _getYesterday(ms, _info, _dayFormat); + } + + if (!DateUtil.yearIsEqualByMs(ms, _locTimeMs)) { + timeline = _getYear(ms, _dayFormat); + if (timeline.isNotEmpty) return timeline; + } + + final num seconds = elapsed / 1000; + final num minutes = seconds / 60; + final num hours = minutes / 60; + final num days = hours / 24; + + if (seconds < 90) { + timeline = _info.oneMinute(1); + if (suffix != _info.suffixAfter() && + _info.lessThanOneMinute().isNotEmpty && + seconds < _info.maxJustNowSecond()) { + timeline = _info.lessThanOneMinute(); + suffix = ''; + } + } else if (minutes < 60) { + timeline = _info.minutes(minutes.round()); + } else if (minutes < 90) { + timeline = _info.anHour(1); + } else if (hours < 24) { + timeline = _info.hours(hours.round()); + } else { + if ((days.round() == 1 && _info.keepOneDay() == true) || + (days.round() == 2 && _info.keepTwoDays() == true)) { + _dayFormat = DayFormat.Simple; + } + timeline = _formatDays(ms, days.round(), _info, _dayFormat); + suffix = (_dayFormat == DayFormat.Simple ? suffix : ''); + } + return timeline + suffix; + } + + /// Timeline like QQ. + /// + /// today (HH:mm) + /// yesterday (昨天;Yesterday) + /// this week (星期一,周一;Monday,Mon) + /// others (yyyy-MM-dd) + static String formatA( + int ms, { + int? locMs, + String formatToday = 'HH:mm', + String format = 'yyyy-MM-dd', + String languageCode = 'en', + bool short = false, + }) { + int _locTimeMs = locMs ?? DateTime.now().millisecondsSinceEpoch; + int elapsed = _locTimeMs - ms; + if (elapsed < 0) { + return DateUtil.formatDateMs(ms, format: formatToday); + } + + if (DateUtil.isToday(ms, locMs: _locTimeMs)) { + return DateUtil.formatDateMs(ms, format: formatToday); + } + + if (DateUtil.isYesterdayByMs(ms, _locTimeMs)) { + return languageCode == 'zh' ? '昨天' : 'Yesterday'; + } + + if (DateUtil.isWeek(ms, locMs: _locTimeMs)) { + return DateUtil.getWeekdayByMs(ms, + languageCode: languageCode, short: short); + } + + return DateUtil.formatDateMs(ms, format: format); + } + + /// get Yesterday. + /// 获取昨天. + static String _getYesterday( + int ms, + TimelineInfo info, + DayFormat dayFormat, + ) { + return info.customYesterday() + + (dayFormat == DayFormat.Full + ? (' ' + DateUtil.formatDateMs(ms, format: 'HH:mm')) + : ''); + } + + /// get is not year info. + /// 获取非今年信息. + static String _getYear( + int ms, + DayFormat dayFormat, + ) { + if (dayFormat != DayFormat.Simple) { + return DateUtil.formatDateMs(ms, + format: (dayFormat == DayFormat.Common + ? 'yyyy-MM-dd' + : 'yyyy-MM-dd HH:mm')); + } + return ''; + } + + /// format Days. + static String _formatDays( + int ms, + num days, + TimelineInfo info, + DayFormat dayFormat, + ) { + String timeline; + switch (dayFormat) { + case DayFormat.Simple: + timeline = (days == 1 + ? info.customYesterday().isEmpty + ? info.oneDay(days.round()) + : info.days(2) + : info.days(days.round())); + break; + case DayFormat.Common: + timeline = DateUtil.formatDateMs(ms, format: 'MM-dd'); + break; + case DayFormat.Full: + timeline = DateUtil.formatDateMs(ms, format: 'MM-dd HH:mm'); + break; + } + return timeline; + } +} diff --git a/FlutterHelper/common_utils/lib/src/timer_util.dart b/FlutterHelper/common_utils/lib/src/timer_util.dart new file mode 100644 index 00000000..a5b17b24 --- /dev/null +++ b/FlutterHelper/common_utils/lib/src/timer_util.dart @@ -0,0 +1,119 @@ +import 'dart:async'; + +///timer callback.(millisUntilFinished 毫秒). +typedef void OnTimerTickCallback(int millisUntilFinished); + +/** + * @Author: Sky24n + * @GitHub: https://github.com/Sky24n + * @Description: Timer Util. + * @Date: 2018/9/28 + */ + +/// TimerUtil. +class TimerUtil { + TimerUtil( + {this.mInterval = Duration.millisecondsPerSecond, this.mTotalTime = 0}); + + /// Timer. + Timer? _mTimer; + + /// Is Timer active. + /// Timer是否启动. + bool _isActive = false; + + /// Timer interval (unit millisecond,def: 1000 millisecond). + /// Timer间隔 单位毫秒,默认1000毫秒(1秒). + int mInterval; + + /// countdown totalTime. + /// 倒计时总时间 + int mTotalTime; //单位毫秒 + + OnTimerTickCallback? _onTimerTickCallback; + + /// set Timer interval. (unit millisecond). + /// 设置Timer间隔. + void setInterval(int interval) { + if (interval <= 0) interval = Duration.millisecondsPerSecond; + mInterval = interval; + } + + /// set countdown totalTime. (unit millisecond). + /// 设置倒计时总时间. + void setTotalTime(int totalTime) { + if (totalTime <= 0) return; + mTotalTime = totalTime; + } + + /// start Timer. + /// 启动定时Timer. + void startTimer() { + if (_isActive || mInterval <= 0) return; + _isActive = true; + Duration duration = Duration(milliseconds: mInterval); + _doCallback(0); + _mTimer = Timer.periodic(duration, (Timer timer) { + _doCallback(timer.tick); + }); + } + + /// start countdown Timer. + /// 启动倒计时Timer. + void startCountDown() { + if (_isActive || mInterval <= 0 || mTotalTime <= 0) return; + _isActive = true; + Duration duration = Duration(milliseconds: mInterval); + _doCallback(mTotalTime); + _mTimer = Timer.periodic(duration, (Timer timer) { + int time = mTotalTime - mInterval; + mTotalTime = time; + if (time >= mInterval) { + _doCallback(time); + } else if (time == 0) { + _doCallback(time); + cancel(); + } else { + timer.cancel(); + Future.delayed(Duration(milliseconds: time), () { + mTotalTime = 0; + _doCallback(0); + cancel(); + }); + } + }); + } + + void _doCallback(int time) { + if (_onTimerTickCallback != null) { + _onTimerTickCallback!(time); + } + } + + /// update countdown totalTime. + /// 重设倒计时总时间. + void updateTotalTime(int totalTime) { + cancel(); + mTotalTime = totalTime; + startCountDown(); + } + + /// timer is Active. + /// Timer是否启动. + bool isActive() { + return _isActive; + } + + /// Cancels the timer. + /// 取消计时器. + void cancel() { + _mTimer?.cancel(); + _mTimer = null; + _isActive = false; + } + + /// set timer callback. + void setOnTimerTickCallback(OnTimerTickCallback callback) { + _onTimerTickCallback = callback; + } +} diff --git a/FlutterHelper/common_utils/pkgget b/FlutterHelper/common_utils/pkgget new file mode 100644 index 00000000..15cf7712 --- /dev/null +++ b/FlutterHelper/common_utils/pkgget @@ -0,0 +1,3 @@ +export PUB_HOSTED_URL=https://pub.flutter-io.cn +export FLUTTER_STORAGE_BASE_URL=https://storage.flutter-io.cn +flutter packages get \ No newline at end of file diff --git a/FlutterHelper/common_utils/pubspec.yaml b/FlutterHelper/common_utils/pubspec.yaml new file mode 100644 index 00000000..290869aa --- /dev/null +++ b/FlutterHelper/common_utils/pubspec.yaml @@ -0,0 +1,15 @@ +name: common_utils +description: Dart common utils library.Contain DateUtil, EncryptUtil, JsonUtil, LogUtil, MoneyUtil, NumUtil, ObjectUtil, RegexUtil, TextUtil, TimelineUtil, TimerUtil. +version: 2.0.2 +homepage: https://github.com/Sky24n/common_utils + +environment: + sdk: ">=2.12.0-259.9.beta <3.0.0" + +dependencies: + # https://github.com/a14n/dart-decimal + decimal: ">=1.0.0 <3.0.0" + # https://github.com/dart-lang/crypto + crypto: ">=3.0.0 <5.0.0" + # https://github.com/dart-lang/convert + convert: ">=3.0.0 <5.0.0" \ No newline at end of file diff --git a/FlutterHelper/common_utils/uploadMaster b/FlutterHelper/common_utils/uploadMaster new file mode 100644 index 00000000..6f74d207 --- /dev/null +++ b/FlutterHelper/common_utils/uploadMaster @@ -0,0 +1 @@ +git push origin master diff --git a/FlutterHelper/ninghao_flutter-master/.gitignore b/FlutterHelper/ninghao_flutter-master/.gitignore new file mode 100644 index 00000000..dee655cc --- /dev/null +++ b/FlutterHelper/ninghao_flutter-master/.gitignore @@ -0,0 +1,9 @@ +.DS_Store +.dart_tool/ + +.packages +.pub/ + +build/ + +.flutter-plugins diff --git a/FlutterHelper/ninghao_flutter-master/.idea/codeStyles/Project.xml b/FlutterHelper/ninghao_flutter-master/.idea/codeStyles/Project.xml new file mode 100644 index 00000000..30aa626c --- /dev/null +++ b/FlutterHelper/ninghao_flutter-master/.idea/codeStyles/Project.xml @@ -0,0 +1,29 @@ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/FlutterHelper/ninghao_flutter-master/.idea/inspectionProfiles/Project_Default.xml b/FlutterHelper/ninghao_flutter-master/.idea/inspectionProfiles/Project_Default.xml new file mode 100644 index 00000000..35c3ada1 --- /dev/null +++ b/FlutterHelper/ninghao_flutter-master/.idea/inspectionProfiles/Project_Default.xml @@ -0,0 +1,8 @@ + + + + \ No newline at end of file diff --git a/FlutterHelper/ninghao_flutter-master/.idea/libraries/Dart_Packages.xml b/FlutterHelper/ninghao_flutter-master/.idea/libraries/Dart_Packages.xml new file mode 100644 index 00000000..40ed6700 --- /dev/null +++ b/FlutterHelper/ninghao_flutter-master/.idea/libraries/Dart_Packages.xml @@ -0,0 +1,300 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/FlutterHelper/ninghao_flutter-master/.idea/libraries/Dart_SDK.xml b/FlutterHelper/ninghao_flutter-master/.idea/libraries/Dart_SDK.xml new file mode 100644 index 00000000..3d881b94 --- /dev/null +++ b/FlutterHelper/ninghao_flutter-master/.idea/libraries/Dart_SDK.xml @@ -0,0 +1,29 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/FlutterHelper/ninghao_flutter-master/.idea/libraries/Flutter_Plugins.xml b/FlutterHelper/ninghao_flutter-master/.idea/libraries/Flutter_Plugins.xml new file mode 100644 index 00000000..b0f69711 --- /dev/null +++ b/FlutterHelper/ninghao_flutter-master/.idea/libraries/Flutter_Plugins.xml @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/FlutterHelper/ninghao_flutter-master/.idea/libraries/Flutter_for_Android.xml b/FlutterHelper/ninghao_flutter-master/.idea/libraries/Flutter_for_Android.xml new file mode 100644 index 00000000..54548d9d --- /dev/null +++ b/FlutterHelper/ninghao_flutter-master/.idea/libraries/Flutter_for_Android.xml @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/FlutterHelper/ninghao_flutter-master/.idea/misc.xml b/FlutterHelper/ninghao_flutter-master/.idea/misc.xml new file mode 100644 index 00000000..f6d2d510 --- /dev/null +++ b/FlutterHelper/ninghao_flutter-master/.idea/misc.xml @@ -0,0 +1,36 @@ + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/FlutterHelper/ninghao_flutter-master/.idea/modules.xml b/FlutterHelper/ninghao_flutter-master/.idea/modules.xml new file mode 100644 index 00000000..192b704d --- /dev/null +++ b/FlutterHelper/ninghao_flutter-master/.idea/modules.xml @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/FlutterHelper/ninghao_flutter-master/.idea/runConfigurations.xml b/FlutterHelper/ninghao_flutter-master/.idea/runConfigurations.xml new file mode 100644 index 00000000..797acea5 --- /dev/null +++ b/FlutterHelper/ninghao_flutter-master/.idea/runConfigurations.xml @@ -0,0 +1,10 @@ + + + + + + \ No newline at end of file diff --git a/FlutterHelper/ninghao_flutter-master/.idea/runConfigurations/main_dart.xml b/FlutterHelper/ninghao_flutter-master/.idea/runConfigurations/main_dart.xml new file mode 100644 index 00000000..aab7b5cd --- /dev/null +++ b/FlutterHelper/ninghao_flutter-master/.idea/runConfigurations/main_dart.xml @@ -0,0 +1,6 @@ + + + + \ No newline at end of file diff --git a/FlutterHelper/ninghao_flutter-master/.idea/vcs.xml b/FlutterHelper/ninghao_flutter-master/.idea/vcs.xml new file mode 100644 index 00000000..b2bdec2d --- /dev/null +++ b/FlutterHelper/ninghao_flutter-master/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/FlutterHelper/ninghao_flutter-master/.idea/workspace.xml b/FlutterHelper/ninghao_flutter-master/.idea/workspace.xml new file mode 100644 index 00000000..60be9c8d --- /dev/null +++ b/FlutterHelper/ninghao_flutter-master/.idea/workspace.xml @@ -0,0 +1,121 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 1533729618709 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/FlutterHelper/ninghao_flutter-master/.metadata b/FlutterHelper/ninghao_flutter-master/.metadata new file mode 100644 index 00000000..c4204e56 --- /dev/null +++ b/FlutterHelper/ninghao_flutter-master/.metadata @@ -0,0 +1,8 @@ +# This file tracks properties of this Flutter project. +# Used by Flutter tool to assess capabilities and perform upgrades etc. +# +# This file should be version controlled and should not be manually edited. + +version: + revision: 66091f969653fd3535b265ddcd87436901858a1d + channel: dev diff --git a/FlutterHelper/ninghao_flutter-master/.vscode/launch.json b/FlutterHelper/ninghao_flutter-master/.vscode/launch.json new file mode 100644 index 00000000..18135079 --- /dev/null +++ b/FlutterHelper/ninghao_flutter-master/.vscode/launch.json @@ -0,0 +1,13 @@ +{ + // Use IntelliSense to learn about possible attributes. + // Hover to view descriptions of existing attributes. + // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 + "version": "0.2.0", + "configurations": [ + { + "name": "Flutter", + "request": "launch", + "type": "dart" + } + ] +} \ No newline at end of file diff --git a/FlutterHelper/ninghao_flutter-master/README.md b/FlutterHelper/ninghao_flutter-master/README.md new file mode 100644 index 00000000..3390f74c --- /dev/null +++ b/FlutterHelper/ninghao_flutter-master/README.md @@ -0,0 +1,9 @@ +IT教程吧 - www.itjc8.com +# ninghao_flutter + +A new Flutter project. + +## Getting Started + +For help getting started with Flutter, view our online +[documentation](https://flutter.io/). diff --git a/FlutterHelper/ninghao_flutter-master/android/.gitignore b/FlutterHelper/ninghao_flutter-master/android/.gitignore new file mode 100644 index 00000000..65b7315a --- /dev/null +++ b/FlutterHelper/ninghao_flutter-master/android/.gitignore @@ -0,0 +1,10 @@ +*.iml +*.class +.gradle +/local.properties +/.idea/workspace.xml +/.idea/libraries +.DS_Store +/build +/captures +GeneratedPluginRegistrant.java diff --git a/FlutterHelper/ninghao_flutter-master/android/app/build.gradle b/FlutterHelper/ninghao_flutter-master/android/app/build.gradle new file mode 100644 index 00000000..3924119a --- /dev/null +++ b/FlutterHelper/ninghao_flutter-master/android/app/build.gradle @@ -0,0 +1,61 @@ +def localProperties = new Properties() +def localPropertiesFile = rootProject.file('local.properties') +if (localPropertiesFile.exists()) { + localPropertiesFile.withReader('UTF-8') { reader -> + localProperties.load(reader) + } +} + +def flutterRoot = localProperties.getProperty('flutter.sdk') +if (flutterRoot == null) { + throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.") +} + +def flutterVersionCode = localProperties.getProperty('flutter.versionCode') +if (flutterVersionCode == null) { + throw new GradleException("versionCode not found. Define flutter.versionCode in the local.properties file.") +} + +def flutterVersionName = localProperties.getProperty('flutter.versionName') +if (flutterVersionName == null) { + throw new GradleException("versionName not found. Define flutter.versionName in the local.properties file.") +} + +apply plugin: 'com.android.application' +apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" + +android { + compileSdkVersion 27 + + lintOptions { + disable 'InvalidPackage' + } + + defaultConfig { + // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). + applicationId "com.example.ninghaoflutter" + minSdkVersion 16 + targetSdkVersion 27 + versionCode flutterVersionCode.toInteger() + versionName flutterVersionName + testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" + } + + buildTypes { + release { + // TODO: Add your own signing config for the release build. + // Signing with the debug keys for now, so `flutter run --release` works. + signingConfig signingConfigs.debug + } + } +} + +flutter { + source '../..' +} + +dependencies { + testImplementation 'junit:junit:4.12' + androidTestImplementation 'com.android.support.test:runner:1.0.2' + androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2' +} diff --git a/FlutterHelper/ninghao_flutter-master/android/app/src/main/AndroidManifest.xml b/FlutterHelper/ninghao_flutter-master/android/app/src/main/AndroidManifest.xml new file mode 100644 index 00000000..5f9d92cf --- /dev/null +++ b/FlutterHelper/ninghao_flutter-master/android/app/src/main/AndroidManifest.xml @@ -0,0 +1,39 @@ + + + + + + + + + + + + + + + + + diff --git a/FlutterHelper/ninghao_flutter-master/android/app/src/main/java/com/example/ninghaoflutter/MainActivity.java b/FlutterHelper/ninghao_flutter-master/android/app/src/main/java/com/example/ninghaoflutter/MainActivity.java new file mode 100644 index 00000000..7bc1876a --- /dev/null +++ b/FlutterHelper/ninghao_flutter-master/android/app/src/main/java/com/example/ninghaoflutter/MainActivity.java @@ -0,0 +1,13 @@ +package com.example.ninghaoflutter; + +import android.os.Bundle; +import io.flutter.app.FlutterActivity; +import io.flutter.plugins.GeneratedPluginRegistrant; + +public class MainActivity extends FlutterActivity { + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + GeneratedPluginRegistrant.registerWith(this); + } +} diff --git a/FlutterHelper/ninghao_flutter-master/android/app/src/main/res/drawable/launch_background.xml b/FlutterHelper/ninghao_flutter-master/android/app/src/main/res/drawable/launch_background.xml new file mode 100644 index 00000000..304732f8 --- /dev/null +++ b/FlutterHelper/ninghao_flutter-master/android/app/src/main/res/drawable/launch_background.xml @@ -0,0 +1,12 @@ + + + + + + + + diff --git a/FlutterHelper/ninghao_flutter-master/android/app/src/main/res/mipmap-hdpi/ic_launcher.png b/FlutterHelper/ninghao_flutter-master/android/app/src/main/res/mipmap-hdpi/ic_launcher.png new file mode 100644 index 00000000..db77bb4b Binary files /dev/null and b/FlutterHelper/ninghao_flutter-master/android/app/src/main/res/mipmap-hdpi/ic_launcher.png differ diff --git a/FlutterHelper/ninghao_flutter-master/android/app/src/main/res/mipmap-mdpi/ic_launcher.png b/FlutterHelper/ninghao_flutter-master/android/app/src/main/res/mipmap-mdpi/ic_launcher.png new file mode 100644 index 00000000..17987b79 Binary files /dev/null and b/FlutterHelper/ninghao_flutter-master/android/app/src/main/res/mipmap-mdpi/ic_launcher.png differ diff --git a/FlutterHelper/ninghao_flutter-master/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png b/FlutterHelper/ninghao_flutter-master/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png new file mode 100644 index 00000000..09d43914 Binary files /dev/null and b/FlutterHelper/ninghao_flutter-master/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png differ diff --git a/FlutterHelper/ninghao_flutter-master/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png b/FlutterHelper/ninghao_flutter-master/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png new file mode 100644 index 00000000..d5f1c8d3 Binary files /dev/null and b/FlutterHelper/ninghao_flutter-master/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png differ diff --git a/FlutterHelper/ninghao_flutter-master/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png b/FlutterHelper/ninghao_flutter-master/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png new file mode 100644 index 00000000..4d6372ee Binary files /dev/null and b/FlutterHelper/ninghao_flutter-master/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png differ diff --git a/FlutterHelper/ninghao_flutter-master/android/app/src/main/res/values/styles.xml b/FlutterHelper/ninghao_flutter-master/android/app/src/main/res/values/styles.xml new file mode 100644 index 00000000..00fa4417 --- /dev/null +++ b/FlutterHelper/ninghao_flutter-master/android/app/src/main/res/values/styles.xml @@ -0,0 +1,8 @@ + + + + diff --git a/FlutterHelper/ninghao_flutter-master/android/build.gradle b/FlutterHelper/ninghao_flutter-master/android/build.gradle new file mode 100644 index 00000000..d4225c79 --- /dev/null +++ b/FlutterHelper/ninghao_flutter-master/android/build.gradle @@ -0,0 +1,29 @@ +buildscript { + repositories { + google() + jcenter() + } + + dependencies { + classpath 'com.android.tools.build:gradle:3.1.2' + } +} + +allprojects { + repositories { + google() + jcenter() + } +} + +rootProject.buildDir = '../build' +subprojects { + project.buildDir = "${rootProject.buildDir}/${project.name}" +} +subprojects { + project.evaluationDependsOn(':app') +} + +task clean(type: Delete) { + delete rootProject.buildDir +} diff --git a/FlutterHelper/ninghao_flutter-master/android/gradle.properties b/FlutterHelper/ninghao_flutter-master/android/gradle.properties new file mode 100644 index 00000000..8bd86f68 --- /dev/null +++ b/FlutterHelper/ninghao_flutter-master/android/gradle.properties @@ -0,0 +1 @@ +org.gradle.jvmargs=-Xmx1536M diff --git a/FlutterHelper/ninghao_flutter-master/android/gradle/wrapper/gradle-wrapper.jar b/FlutterHelper/ninghao_flutter-master/android/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 00000000..13372aef Binary files /dev/null and b/FlutterHelper/ninghao_flutter-master/android/gradle/wrapper/gradle-wrapper.jar differ diff --git a/FlutterHelper/ninghao_flutter-master/android/gradle/wrapper/gradle-wrapper.properties b/FlutterHelper/ninghao_flutter-master/android/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 00000000..9372d0f3 --- /dev/null +++ b/FlutterHelper/ninghao_flutter-master/android/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,6 @@ +#Fri Jun 23 08:50:38 CEST 2017 +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-4.4-all.zip diff --git a/FlutterHelper/ninghao_flutter-master/android/gradlew b/FlutterHelper/ninghao_flutter-master/android/gradlew new file mode 100644 index 00000000..9d82f789 --- /dev/null +++ b/FlutterHelper/ninghao_flutter-master/android/gradlew @@ -0,0 +1,160 @@ +#!/usr/bin/env bash + +############################################################################## +## +## Gradle start up script for UN*X +## +############################################################################## + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS="" + +APP_NAME="Gradle" +APP_BASE_NAME=`basename "$0"` + +# Use the maximum available, or set MAX_FD != -1 to use that value. +MAX_FD="maximum" + +warn ( ) { + echo "$*" +} + +die ( ) { + echo + echo "$*" + echo + exit 1 +} + +# OS specific support (must be 'true' or 'false'). +cygwin=false +msys=false +darwin=false +case "`uname`" in + CYGWIN* ) + cygwin=true + ;; + Darwin* ) + darwin=true + ;; + MINGW* ) + msys=true + ;; +esac + +# Attempt to set APP_HOME +# Resolve links: $0 may be a link +PRG="$0" +# Need this for relative symlinks. +while [ -h "$PRG" ] ; do + ls=`ls -ld "$PRG"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + PRG="$link" + else + PRG=`dirname "$PRG"`"/$link" + fi +done +SAVED="`pwd`" +cd "`dirname \"$PRG\"`/" >/dev/null +APP_HOME="`pwd -P`" +cd "$SAVED" >/dev/null + +CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar + +# Determine the Java command to use to start the JVM. +if [ -n "$JAVA_HOME" ] ; then + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD="$JAVA_HOME/jre/sh/java" + else + JAVACMD="$JAVA_HOME/bin/java" + fi + if [ ! -x "$JAVACMD" ] ; then + die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + fi +else + JAVACMD="java" + which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." +fi + +# Increase the maximum file descriptors if we can. +if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then + MAX_FD_LIMIT=`ulimit -H -n` + if [ $? -eq 0 ] ; then + if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then + MAX_FD="$MAX_FD_LIMIT" + fi + ulimit -n $MAX_FD + if [ $? -ne 0 ] ; then + warn "Could not set maximum file descriptor limit: $MAX_FD" + fi + else + warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" + fi +fi + +# For Darwin, add options to specify how the application appears in the dock +if $darwin; then + GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" +fi + +# For Cygwin, switch paths to Windows format before running java +if $cygwin ; then + APP_HOME=`cygpath --path --mixed "$APP_HOME"` + CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` + JAVACMD=`cygpath --unix "$JAVACMD"` + + # We build the pattern for arguments to be converted via cygpath + ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` + SEP="" + for dir in $ROOTDIRSRAW ; do + ROOTDIRS="$ROOTDIRS$SEP$dir" + SEP="|" + done + OURCYGPATTERN="(^($ROOTDIRS))" + # Add a user-defined pattern to the cygpath arguments + if [ "$GRADLE_CYGPATTERN" != "" ] ; then + OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" + fi + # Now convert the arguments - kludge to limit ourselves to /bin/sh + i=0 + for arg in "$@" ; do + CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` + CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option + + if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition + eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` + else + eval `echo args$i`="\"$arg\"" + fi + i=$((i+1)) + done + case $i in + (0) set -- ;; + (1) set -- "$args0" ;; + (2) set -- "$args0" "$args1" ;; + (3) set -- "$args0" "$args1" "$args2" ;; + (4) set -- "$args0" "$args1" "$args2" "$args3" ;; + (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; + (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; + (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; + (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; + (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; + esac +fi + +# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules +function splitJvmOpts() { + JVM_OPTS=("$@") +} +eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS +JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME" + +exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@" diff --git a/FlutterHelper/ninghao_flutter-master/android/gradlew.bat b/FlutterHelper/ninghao_flutter-master/android/gradlew.bat new file mode 100644 index 00000000..8a0b282a --- /dev/null +++ b/FlutterHelper/ninghao_flutter-master/android/gradlew.bat @@ -0,0 +1,90 @@ +@if "%DEBUG%" == "" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS= + +set DIRNAME=%~dp0 +if "%DIRNAME%" == "" set DIRNAME=. +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if "%ERRORLEVEL%" == "0" goto init + +echo. +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto init + +echo. +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:init +@rem Get command-line arguments, handling Windowz variants + +if not "%OS%" == "Windows_NT" goto win9xME_args +if "%@eval[2+2]" == "4" goto 4NT_args + +:win9xME_args +@rem Slurp the command line arguments. +set CMD_LINE_ARGS= +set _SKIP=2 + +:win9xME_args_slurp +if "x%~1" == "x" goto execute + +set CMD_LINE_ARGS=%* +goto execute + +:4NT_args +@rem Get arguments from the 4NT Shell from JP Software +set CMD_LINE_ARGS=%$ + +:execute +@rem Setup the command line + +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% + +:end +@rem End local scope for the variables with windows NT shell +if "%ERRORLEVEL%"=="0" goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 +exit /b 1 + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/FlutterHelper/ninghao_flutter-master/android/settings.gradle b/FlutterHelper/ninghao_flutter-master/android/settings.gradle new file mode 100644 index 00000000..5a2f14fb --- /dev/null +++ b/FlutterHelper/ninghao_flutter-master/android/settings.gradle @@ -0,0 +1,15 @@ +include ':app' + +def flutterProjectRoot = rootProject.projectDir.parentFile.toPath() + +def plugins = new Properties() +def pluginsFile = new File(flutterProjectRoot.toFile(), '.flutter-plugins') +if (pluginsFile.exists()) { + pluginsFile.withReader('UTF-8') { reader -> plugins.load(reader) } +} + +plugins.each { name, path -> + def pluginDirectory = flutterProjectRoot.resolve(path).resolve('android').toFile() + include ":$name" + project(":$name").projectDir = pluginDirectory +} diff --git a/FlutterHelper/ninghao_flutter-master/ios/.gitignore b/FlutterHelper/ninghao_flutter-master/ios/.gitignore new file mode 100644 index 00000000..79cc4da8 --- /dev/null +++ b/FlutterHelper/ninghao_flutter-master/ios/.gitignore @@ -0,0 +1,45 @@ +.idea/ +.vagrant/ +.sconsign.dblite +.svn/ + +.DS_Store +*.swp +profile + +DerivedData/ +build/ +GeneratedPluginRegistrant.h +GeneratedPluginRegistrant.m + +.generated/ + +*.pbxuser +*.mode1v3 +*.mode2v3 +*.perspectivev3 + +!default.pbxuser +!default.mode1v3 +!default.mode2v3 +!default.perspectivev3 + +xcuserdata + +*.moved-aside + +*.pyc +*sync/ +Icon? +.tags* + +/Flutter/app.flx +/Flutter/app.zip +/Flutter/flutter_assets/ +/Flutter/App.framework +/Flutter/Flutter.framework +/Flutter/Generated.xcconfig +/ServiceDefinitions.json + +Pods/ +.symlinks/ diff --git a/FlutterHelper/ninghao_flutter-master/ios/Flutter/AppFrameworkInfo.plist b/FlutterHelper/ninghao_flutter-master/ios/Flutter/AppFrameworkInfo.plist new file mode 100644 index 00000000..9367d483 --- /dev/null +++ b/FlutterHelper/ninghao_flutter-master/ios/Flutter/AppFrameworkInfo.plist @@ -0,0 +1,26 @@ + + + + + CFBundleDevelopmentRegion + en + CFBundleExecutable + App + CFBundleIdentifier + io.flutter.flutter.app + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + App + CFBundlePackageType + FMWK + CFBundleShortVersionString + 1.0 + CFBundleSignature + ???? + CFBundleVersion + 1.0 + MinimumOSVersion + 8.0 + + diff --git a/FlutterHelper/ninghao_flutter-master/ios/Flutter/Debug.xcconfig b/FlutterHelper/ninghao_flutter-master/ios/Flutter/Debug.xcconfig new file mode 100644 index 00000000..592ceee8 --- /dev/null +++ b/FlutterHelper/ninghao_flutter-master/ios/Flutter/Debug.xcconfig @@ -0,0 +1 @@ +#include "Generated.xcconfig" diff --git a/FlutterHelper/ninghao_flutter-master/ios/Flutter/Release.xcconfig b/FlutterHelper/ninghao_flutter-master/ios/Flutter/Release.xcconfig new file mode 100644 index 00000000..592ceee8 --- /dev/null +++ b/FlutterHelper/ninghao_flutter-master/ios/Flutter/Release.xcconfig @@ -0,0 +1 @@ +#include "Generated.xcconfig" diff --git a/FlutterHelper/ninghao_flutter-master/ios/Flutter/flutter_export_environment.sh b/FlutterHelper/ninghao_flutter-master/ios/Flutter/flutter_export_environment.sh new file mode 100755 index 00000000..f59f0674 --- /dev/null +++ b/FlutterHelper/ninghao_flutter-master/ios/Flutter/flutter_export_environment.sh @@ -0,0 +1,14 @@ +#!/bin/sh +# This is a generated file; do not edit or check into version control. +export "FLUTTER_ROOT=/Users/flannery/Library/Android/flutter" +export "FLUTTER_APPLICATION_PATH=/Users/flannery/Desktop/AndroidHelper/FlutterHelper/ninghao_flutter-master" +export "COCOAPODS_PARALLEL_CODE_SIGN=true" +export "FLUTTER_TARGET=lib/main.dart" +export "FLUTTER_BUILD_DIR=build" +export "SYMROOT=${SOURCE_ROOT}/../build/ios" +export "FLUTTER_BUILD_NAME=1.0.0" +export "FLUTTER_BUILD_NUMBER=1" +export "DART_OBFUSCATION=false" +export "TRACK_WIDGET_CREATION=false" +export "TREE_SHAKE_ICONS=false" +export "PACKAGE_CONFIG=.packages" diff --git a/FlutterHelper/ninghao_flutter-master/ios/Runner.xcodeproj/project.pbxproj b/FlutterHelper/ninghao_flutter-master/ios/Runner.xcodeproj/project.pbxproj new file mode 100644 index 00000000..5b245582 --- /dev/null +++ b/FlutterHelper/ninghao_flutter-master/ios/Runner.xcodeproj/project.pbxproj @@ -0,0 +1,438 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 46; + objects = { + +/* Begin PBXBuildFile section */ + 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */ = {isa = PBXBuildFile; fileRef = 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */; }; + 2D5378261FAA1A9400D5DBA9 /* flutter_assets in Resources */ = {isa = PBXBuildFile; fileRef = 2D5378251FAA1A9400D5DBA9 /* flutter_assets */; }; + 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; }; + 3B80C3941E831B6300D905FE /* App.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3B80C3931E831B6300D905FE /* App.framework */; }; + 3B80C3951E831B6300D905FE /* App.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 3B80C3931E831B6300D905FE /* App.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; + 9705A1C61CF904A100538489 /* Flutter.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9740EEBA1CF902C7004384FC /* Flutter.framework */; }; + 9705A1C71CF904A300538489 /* Flutter.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 9740EEBA1CF902C7004384FC /* Flutter.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; + 9740EEB41CF90195004384FC /* Debug.xcconfig in Resources */ = {isa = PBXBuildFile; fileRef = 9740EEB21CF90195004384FC /* Debug.xcconfig */; }; + 9740EEB51CF90195004384FC /* Generated.xcconfig in Resources */ = {isa = PBXBuildFile; fileRef = 9740EEB31CF90195004384FC /* Generated.xcconfig */; }; + 978B8F6F1D3862AE00F588F7 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 7AFFD8EE1D35381100E5BB4D /* AppDelegate.m */; }; + 97C146F31CF9000F007C117D /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 97C146F21CF9000F007C117D /* main.m */; }; + 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; }; + 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FD1CF9000F007C117D /* Assets.xcassets */; }; + 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */; }; +/* End PBXBuildFile section */ + +/* Begin PBXCopyFilesBuildPhase section */ + 9705A1C41CF9048500538489 /* Embed Frameworks */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 2147483647; + dstPath = ""; + dstSubfolderSpec = 10; + files = ( + 3B80C3951E831B6300D905FE /* App.framework in Embed Frameworks */, + 9705A1C71CF904A300538489 /* Flutter.framework in Embed Frameworks */, + ); + name = "Embed Frameworks"; + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXCopyFilesBuildPhase section */ + +/* Begin PBXFileReference section */ + 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GeneratedPluginRegistrant.h; sourceTree = ""; }; + 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = ""; }; + 2D5378251FAA1A9400D5DBA9 /* flutter_assets */ = {isa = PBXFileReference; lastKnownFileType = folder; name = flutter_assets; path = Flutter/flutter_assets; sourceTree = SOURCE_ROOT; }; + 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = ""; }; + 3B80C3931E831B6300D905FE /* App.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = App.framework; path = Flutter/App.framework; sourceTree = ""; }; + 7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = ""; }; + 7AFFD8ED1D35381100E5BB4D /* AppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; + 7AFFD8EE1D35381100E5BB4D /* AppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; + 9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Debug.xcconfig; path = Flutter/Debug.xcconfig; sourceTree = ""; }; + 9740EEB31CF90195004384FC /* Generated.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Generated.xcconfig; path = Flutter/Generated.xcconfig; sourceTree = ""; }; + 9740EEBA1CF902C7004384FC /* Flutter.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Flutter.framework; path = Flutter/Flutter.framework; sourceTree = ""; }; + 97C146EE1CF9000F007C117D /* Runner.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Runner.app; sourceTree = BUILT_PRODUCTS_DIR; }; + 97C146F21CF9000F007C117D /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; + 97C146FB1CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; + 97C146FD1CF9000F007C117D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; + 97C147001CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; + 97C147021CF9000F007C117D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + 97C146EB1CF9000F007C117D /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 9705A1C61CF904A100538489 /* Flutter.framework in Frameworks */, + 3B80C3941E831B6300D905FE /* App.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 9740EEB11CF90186004384FC /* Flutter */ = { + isa = PBXGroup; + children = ( + 2D5378251FAA1A9400D5DBA9 /* flutter_assets */, + 3B80C3931E831B6300D905FE /* App.framework */, + 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */, + 9740EEBA1CF902C7004384FC /* Flutter.framework */, + 9740EEB21CF90195004384FC /* Debug.xcconfig */, + 7AFA3C8E1D35360C0083082E /* Release.xcconfig */, + 9740EEB31CF90195004384FC /* Generated.xcconfig */, + ); + name = Flutter; + sourceTree = ""; + }; + 97C146E51CF9000F007C117D = { + isa = PBXGroup; + children = ( + 9740EEB11CF90186004384FC /* Flutter */, + 97C146F01CF9000F007C117D /* Runner */, + 97C146EF1CF9000F007C117D /* Products */, + CF3B75C9A7D2FA2A4C99F110 /* Frameworks */, + ); + sourceTree = ""; + }; + 97C146EF1CF9000F007C117D /* Products */ = { + isa = PBXGroup; + children = ( + 97C146EE1CF9000F007C117D /* Runner.app */, + ); + name = Products; + sourceTree = ""; + }; + 97C146F01CF9000F007C117D /* Runner */ = { + isa = PBXGroup; + children = ( + 7AFFD8ED1D35381100E5BB4D /* AppDelegate.h */, + 7AFFD8EE1D35381100E5BB4D /* AppDelegate.m */, + 97C146FA1CF9000F007C117D /* Main.storyboard */, + 97C146FD1CF9000F007C117D /* Assets.xcassets */, + 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */, + 97C147021CF9000F007C117D /* Info.plist */, + 97C146F11CF9000F007C117D /* Supporting Files */, + 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */, + 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */, + ); + path = Runner; + sourceTree = ""; + }; + 97C146F11CF9000F007C117D /* Supporting Files */ = { + isa = PBXGroup; + children = ( + 97C146F21CF9000F007C117D /* main.m */, + ); + name = "Supporting Files"; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + 97C146ED1CF9000F007C117D /* Runner */ = { + isa = PBXNativeTarget; + buildConfigurationList = 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */; + buildPhases = ( + 9740EEB61CF901F6004384FC /* Run Script */, + 97C146EA1CF9000F007C117D /* Sources */, + 97C146EB1CF9000F007C117D /* Frameworks */, + 97C146EC1CF9000F007C117D /* Resources */, + 9705A1C41CF9048500538489 /* Embed Frameworks */, + 3B06AD1E1E4923F5004D2608 /* Thin Binary */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = Runner; + productName = Runner; + productReference = 97C146EE1CF9000F007C117D /* Runner.app */; + productType = "com.apple.product-type.application"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + 97C146E61CF9000F007C117D /* Project object */ = { + isa = PBXProject; + attributes = { + LastUpgradeCheck = 0910; + ORGANIZATIONNAME = "The Chromium Authors"; + TargetAttributes = { + 97C146ED1CF9000F007C117D = { + CreatedOnToolsVersion = 7.3.1; + }; + }; + }; + buildConfigurationList = 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */; + compatibilityVersion = "Xcode 3.2"; + developmentRegion = English; + hasScannedForEncodings = 0; + knownRegions = ( + en, + Base, + ); + mainGroup = 97C146E51CF9000F007C117D; + productRefGroup = 97C146EF1CF9000F007C117D /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + 97C146ED1CF9000F007C117D /* Runner */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXResourcesBuildPhase section */ + 97C146EC1CF9000F007C117D /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */, + 9740EEB51CF90195004384FC /* Generated.xcconfig in Resources */, + 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */, + 9740EEB41CF90195004384FC /* Debug.xcconfig in Resources */, + 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */, + 2D5378261FAA1A9400D5DBA9 /* flutter_assets in Resources */, + 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXShellScriptBuildPhase section */ + 3B06AD1E1E4923F5004D2608 /* Thin Binary */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + ); + name = "Thin Binary"; + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" thin"; + }; + 9740EEB61CF901F6004384FC /* Run Script */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + ); + name = "Run Script"; + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build"; + }; +/* End PBXShellScriptBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + 97C146EA1CF9000F007C117D /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 978B8F6F1D3862AE00F588F7 /* AppDelegate.m in Sources */, + 97C146F31CF9000F007C117D /* main.m in Sources */, + 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin PBXVariantGroup section */ + 97C146FA1CF9000F007C117D /* Main.storyboard */ = { + isa = PBXVariantGroup; + children = ( + 97C146FB1CF9000F007C117D /* Base */, + ); + name = Main.storyboard; + sourceTree = ""; + }; + 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */ = { + isa = PBXVariantGroup; + children = ( + 97C147001CF9000F007C117D /* Base */, + ); + name = LaunchScreen.storyboard; + sourceTree = ""; + }; +/* End PBXVariantGroup section */ + +/* Begin XCBuildConfiguration section */ + 97C147031CF9000F007C117D /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = dwarf; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_TESTABILITY = YES; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_DYNAMIC_NO_PIC = NO; + GCC_NO_COMMON_BLOCKS = YES; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 8.0; + MTL_ENABLE_DEBUG_INFO = YES; + ONLY_ACTIVE_ARCH = YES; + SDKROOT = iphoneos; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Debug; + }; + 97C147041CF9000F007C117D /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_NO_COMMON_BLOCKS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 8.0; + MTL_ENABLE_DEBUG_INFO = NO; + SDKROOT = iphoneos; + TARGETED_DEVICE_FAMILY = "1,2"; + VALIDATE_PRODUCT = YES; + }; + name = Release; + }; + 97C147061CF9000F007C117D /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; + ENABLE_BITCODE = NO; + FRAMEWORK_SEARCH_PATHS = ( + "$(inherited)", + "$(PROJECT_DIR)/Flutter", + ); + INFOPLIST_FILE = Runner/Info.plist; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; + LIBRARY_SEARCH_PATHS = ( + "$(inherited)", + "$(PROJECT_DIR)/Flutter", + ); + PRODUCT_BUNDLE_IDENTIFIER = com.example.ninghaoFlutter; + PRODUCT_NAME = "$(TARGET_NAME)"; + VERSIONING_SYSTEM = "apple-generic"; + }; + name = Debug; + }; + 97C147071CF9000F007C117D /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; + ENABLE_BITCODE = NO; + FRAMEWORK_SEARCH_PATHS = ( + "$(inherited)", + "$(PROJECT_DIR)/Flutter", + ); + INFOPLIST_FILE = Runner/Info.plist; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; + LIBRARY_SEARCH_PATHS = ( + "$(inherited)", + "$(PROJECT_DIR)/Flutter", + ); + PRODUCT_BUNDLE_IDENTIFIER = com.example.ninghaoFlutter; + PRODUCT_NAME = "$(TARGET_NAME)"; + VERSIONING_SYSTEM = "apple-generic"; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 97C147031CF9000F007C117D /* Debug */, + 97C147041CF9000F007C117D /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 97C147061CF9000F007C117D /* Debug */, + 97C147071CF9000F007C117D /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = 97C146E61CF9000F007C117D /* Project object */; +} diff --git a/FlutterHelper/ninghao_flutter-master/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/FlutterHelper/ninghao_flutter-master/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata new file mode 100644 index 00000000..1d526a16 --- /dev/null +++ b/FlutterHelper/ninghao_flutter-master/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,7 @@ + + + + + diff --git a/FlutterHelper/ninghao_flutter-master/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/FlutterHelper/ninghao_flutter-master/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist new file mode 100644 index 00000000..18d98100 --- /dev/null +++ b/FlutterHelper/ninghao_flutter-master/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist @@ -0,0 +1,8 @@ + + + + + IDEDidComputeMac32BitWarning + + + diff --git a/FlutterHelper/ninghao_flutter-master/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme b/FlutterHelper/ninghao_flutter-master/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme new file mode 100644 index 00000000..1263ac84 --- /dev/null +++ b/FlutterHelper/ninghao_flutter-master/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme @@ -0,0 +1,93 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/FlutterHelper/ninghao_flutter-master/ios/Runner.xcworkspace/contents.xcworkspacedata b/FlutterHelper/ninghao_flutter-master/ios/Runner.xcworkspace/contents.xcworkspacedata new file mode 100644 index 00000000..1d526a16 --- /dev/null +++ b/FlutterHelper/ninghao_flutter-master/ios/Runner.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,7 @@ + + + + + diff --git a/FlutterHelper/ninghao_flutter-master/ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings b/FlutterHelper/ninghao_flutter-master/ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings new file mode 100644 index 00000000..949b6789 --- /dev/null +++ b/FlutterHelper/ninghao_flutter-master/ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings @@ -0,0 +1,8 @@ + + + + + BuildSystemType + Original + + diff --git a/FlutterHelper/ninghao_flutter-master/ios/Runner/AppDelegate.h b/FlutterHelper/ninghao_flutter-master/ios/Runner/AppDelegate.h new file mode 100644 index 00000000..36e21bbf --- /dev/null +++ b/FlutterHelper/ninghao_flutter-master/ios/Runner/AppDelegate.h @@ -0,0 +1,6 @@ +#import +#import + +@interface AppDelegate : FlutterAppDelegate + +@end diff --git a/FlutterHelper/ninghao_flutter-master/ios/Runner/AppDelegate.m b/FlutterHelper/ninghao_flutter-master/ios/Runner/AppDelegate.m new file mode 100644 index 00000000..59a72e90 --- /dev/null +++ b/FlutterHelper/ninghao_flutter-master/ios/Runner/AppDelegate.m @@ -0,0 +1,13 @@ +#include "AppDelegate.h" +#include "GeneratedPluginRegistrant.h" + +@implementation AppDelegate + +- (BOOL)application:(UIApplication *)application + didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { + [GeneratedPluginRegistrant registerWithRegistry:self]; + // Override point for customization after application launch. + return [super application:application didFinishLaunchingWithOptions:launchOptions]; +} + +@end diff --git a/FlutterHelper/ninghao_flutter-master/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json b/FlutterHelper/ninghao_flutter-master/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json new file mode 100644 index 00000000..d36b1fab --- /dev/null +++ b/FlutterHelper/ninghao_flutter-master/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json @@ -0,0 +1,122 @@ +{ + "images" : [ + { + "size" : "20x20", + "idiom" : "iphone", + "filename" : "Icon-App-20x20@2x.png", + "scale" : "2x" + }, + { + "size" : "20x20", + "idiom" : "iphone", + "filename" : "Icon-App-20x20@3x.png", + "scale" : "3x" + }, + { + "size" : "29x29", + "idiom" : "iphone", + "filename" : "Icon-App-29x29@1x.png", + "scale" : "1x" + }, + { + "size" : "29x29", + "idiom" : "iphone", + "filename" : "Icon-App-29x29@2x.png", + "scale" : "2x" + }, + { + "size" : "29x29", + "idiom" : "iphone", + "filename" : "Icon-App-29x29@3x.png", + "scale" : "3x" + }, + { + "size" : "40x40", + "idiom" : "iphone", + "filename" : "Icon-App-40x40@2x.png", + "scale" : "2x" + }, + { + "size" : "40x40", + "idiom" : "iphone", + "filename" : "Icon-App-40x40@3x.png", + "scale" : "3x" + }, + { + "size" : "60x60", + "idiom" : "iphone", + "filename" : "Icon-App-60x60@2x.png", + "scale" : "2x" + }, + { + "size" : "60x60", + "idiom" : "iphone", + "filename" : "Icon-App-60x60@3x.png", + "scale" : "3x" + }, + { + "size" : "20x20", + "idiom" : "ipad", + "filename" : "Icon-App-20x20@1x.png", + "scale" : "1x" + }, + { + "size" : "20x20", + "idiom" : "ipad", + "filename" : "Icon-App-20x20@2x.png", + "scale" : "2x" + }, + { + "size" : "29x29", + "idiom" : "ipad", + "filename" : "Icon-App-29x29@1x.png", + "scale" : "1x" + }, + { + "size" : "29x29", + "idiom" : "ipad", + "filename" : "Icon-App-29x29@2x.png", + "scale" : "2x" + }, + { + "size" : "40x40", + "idiom" : "ipad", + "filename" : "Icon-App-40x40@1x.png", + "scale" : "1x" + }, + { + "size" : "40x40", + "idiom" : "ipad", + "filename" : "Icon-App-40x40@2x.png", + "scale" : "2x" + }, + { + "size" : "76x76", + "idiom" : "ipad", + "filename" : "Icon-App-76x76@1x.png", + "scale" : "1x" + }, + { + "size" : "76x76", + "idiom" : "ipad", + "filename" : "Icon-App-76x76@2x.png", + "scale" : "2x" + }, + { + "size" : "83.5x83.5", + "idiom" : "ipad", + "filename" : "Icon-App-83.5x83.5@2x.png", + "scale" : "2x" + }, + { + "size" : "1024x1024", + "idiom" : "ios-marketing", + "filename" : "Icon-App-1024x1024@1x.png", + "scale" : "1x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} diff --git a/FlutterHelper/ninghao_flutter-master/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png b/FlutterHelper/ninghao_flutter-master/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png new file mode 100644 index 00000000..3d43d11e Binary files /dev/null and b/FlutterHelper/ninghao_flutter-master/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png differ diff --git a/FlutterHelper/ninghao_flutter-master/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png b/FlutterHelper/ninghao_flutter-master/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png new file mode 100644 index 00000000..28c6bf03 Binary files /dev/null and b/FlutterHelper/ninghao_flutter-master/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png differ diff --git a/FlutterHelper/ninghao_flutter-master/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png b/FlutterHelper/ninghao_flutter-master/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png new file mode 100644 index 00000000..2ccbfd96 Binary files /dev/null and b/FlutterHelper/ninghao_flutter-master/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png differ diff --git a/FlutterHelper/ninghao_flutter-master/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png b/FlutterHelper/ninghao_flutter-master/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png new file mode 100644 index 00000000..f091b6b0 Binary files /dev/null and b/FlutterHelper/ninghao_flutter-master/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png differ diff --git a/FlutterHelper/ninghao_flutter-master/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png b/FlutterHelper/ninghao_flutter-master/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png new file mode 100644 index 00000000..4cde1211 Binary files /dev/null and b/FlutterHelper/ninghao_flutter-master/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png differ diff --git a/FlutterHelper/ninghao_flutter-master/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png b/FlutterHelper/ninghao_flutter-master/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png new file mode 100644 index 00000000..d0ef06e7 Binary files /dev/null and b/FlutterHelper/ninghao_flutter-master/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png differ diff --git a/FlutterHelper/ninghao_flutter-master/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png b/FlutterHelper/ninghao_flutter-master/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png new file mode 100644 index 00000000..dcdc2306 Binary files /dev/null and b/FlutterHelper/ninghao_flutter-master/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png differ diff --git a/FlutterHelper/ninghao_flutter-master/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png b/FlutterHelper/ninghao_flutter-master/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png new file mode 100644 index 00000000..2ccbfd96 Binary files /dev/null and b/FlutterHelper/ninghao_flutter-master/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png differ diff --git a/FlutterHelper/ninghao_flutter-master/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png b/FlutterHelper/ninghao_flutter-master/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png new file mode 100644 index 00000000..c8f9ed8f Binary files /dev/null and b/FlutterHelper/ninghao_flutter-master/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png differ diff --git a/FlutterHelper/ninghao_flutter-master/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png b/FlutterHelper/ninghao_flutter-master/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png new file mode 100644 index 00000000..a6d6b860 Binary files /dev/null and b/FlutterHelper/ninghao_flutter-master/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png differ diff --git a/FlutterHelper/ninghao_flutter-master/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png b/FlutterHelper/ninghao_flutter-master/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png new file mode 100644 index 00000000..a6d6b860 Binary files /dev/null and b/FlutterHelper/ninghao_flutter-master/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png differ diff --git a/FlutterHelper/ninghao_flutter-master/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png b/FlutterHelper/ninghao_flutter-master/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png new file mode 100644 index 00000000..75b2d164 Binary files /dev/null and b/FlutterHelper/ninghao_flutter-master/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png differ diff --git a/FlutterHelper/ninghao_flutter-master/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png b/FlutterHelper/ninghao_flutter-master/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png new file mode 100644 index 00000000..c4df70d3 Binary files /dev/null and b/FlutterHelper/ninghao_flutter-master/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png differ diff --git a/FlutterHelper/ninghao_flutter-master/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png b/FlutterHelper/ninghao_flutter-master/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png new file mode 100644 index 00000000..6a84f41e Binary files /dev/null and b/FlutterHelper/ninghao_flutter-master/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png differ diff --git a/FlutterHelper/ninghao_flutter-master/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png b/FlutterHelper/ninghao_flutter-master/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png new file mode 100644 index 00000000..d0e1f585 Binary files /dev/null and b/FlutterHelper/ninghao_flutter-master/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png differ diff --git a/FlutterHelper/ninghao_flutter-master/ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json b/FlutterHelper/ninghao_flutter-master/ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json new file mode 100644 index 00000000..0bedcf2f --- /dev/null +++ b/FlutterHelper/ninghao_flutter-master/ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json @@ -0,0 +1,23 @@ +{ + "images" : [ + { + "idiom" : "universal", + "filename" : "LaunchImage.png", + "scale" : "1x" + }, + { + "idiom" : "universal", + "filename" : "LaunchImage@2x.png", + "scale" : "2x" + }, + { + "idiom" : "universal", + "filename" : "LaunchImage@3x.png", + "scale" : "3x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} diff --git a/FlutterHelper/ninghao_flutter-master/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png b/FlutterHelper/ninghao_flutter-master/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png new file mode 100644 index 00000000..9da19eac Binary files /dev/null and b/FlutterHelper/ninghao_flutter-master/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png differ diff --git a/FlutterHelper/ninghao_flutter-master/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png b/FlutterHelper/ninghao_flutter-master/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png new file mode 100644 index 00000000..9da19eac Binary files /dev/null and b/FlutterHelper/ninghao_flutter-master/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png differ diff --git a/FlutterHelper/ninghao_flutter-master/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png b/FlutterHelper/ninghao_flutter-master/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png new file mode 100644 index 00000000..9da19eac Binary files /dev/null and b/FlutterHelper/ninghao_flutter-master/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png differ diff --git a/FlutterHelper/ninghao_flutter-master/ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md b/FlutterHelper/ninghao_flutter-master/ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md new file mode 100644 index 00000000..89c2725b --- /dev/null +++ b/FlutterHelper/ninghao_flutter-master/ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md @@ -0,0 +1,5 @@ +# Launch Screen Assets + +You can customize the launch screen with your own desired assets by replacing the image files in this directory. + +You can also do it by opening your Flutter project's Xcode project with `open ios/Runner.xcworkspace`, selecting `Runner/Assets.xcassets` in the Project Navigator and dropping in the desired images. \ No newline at end of file diff --git a/FlutterHelper/ninghao_flutter-master/ios/Runner/Base.lproj/LaunchScreen.storyboard b/FlutterHelper/ninghao_flutter-master/ios/Runner/Base.lproj/LaunchScreen.storyboard new file mode 100644 index 00000000..f2e259c7 --- /dev/null +++ b/FlutterHelper/ninghao_flutter-master/ios/Runner/Base.lproj/LaunchScreen.storyboard @@ -0,0 +1,37 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/FlutterHelper/ninghao_flutter-master/ios/Runner/Base.lproj/Main.storyboard b/FlutterHelper/ninghao_flutter-master/ios/Runner/Base.lproj/Main.storyboard new file mode 100644 index 00000000..f3c28516 --- /dev/null +++ b/FlutterHelper/ninghao_flutter-master/ios/Runner/Base.lproj/Main.storyboard @@ -0,0 +1,26 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/FlutterHelper/ninghao_flutter-master/ios/Runner/Info.plist b/FlutterHelper/ninghao_flutter-master/ios/Runner/Info.plist new file mode 100644 index 00000000..e27043f5 --- /dev/null +++ b/FlutterHelper/ninghao_flutter-master/ios/Runner/Info.plist @@ -0,0 +1,50 @@ + + + + + CFBundleDevelopmentRegion + en + CFBundleExecutable + $(EXECUTABLE_NAME) + CFBundleIdentifier + $(PRODUCT_BUNDLE_IDENTIFIER) + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + ninghao_flutter + CFBundlePackageType + APPL + CFBundleShortVersionString + $(FLUTTER_BUILD_NAME) + CFBundleSignature + ???? + CFBundleVersion + $(FLUTTER_BUILD_NUMBER) + LSRequiresIPhoneOS + + UILaunchStoryboardName + LaunchScreen + UIMainStoryboardFile + Main + UISupportedInterfaceOrientations + + UIInterfaceOrientationPortrait + UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationLandscapeRight + + UISupportedInterfaceOrientations~ipad + + UIInterfaceOrientationPortrait + UIInterfaceOrientationPortraitUpsideDown + UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationLandscapeRight + + UIViewControllerBasedStatusBarAppearance + + CFBundleLocalizations + + en + zh_CN + + + diff --git a/FlutterHelper/ninghao_flutter-master/ios/Runner/main.m b/FlutterHelper/ninghao_flutter-master/ios/Runner/main.m new file mode 100644 index 00000000..dff6597e --- /dev/null +++ b/FlutterHelper/ninghao_flutter-master/ios/Runner/main.m @@ -0,0 +1,9 @@ +#import +#import +#import "AppDelegate.h" + +int main(int argc, char* argv[]) { + @autoreleasepool { + return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); + } +} diff --git a/FlutterHelper/ninghao_flutter-master/lib/demo/alert_dialog_demo.dart b/FlutterHelper/ninghao_flutter-master/lib/demo/alert_dialog_demo.dart new file mode 100644 index 00000000..9b89040c --- /dev/null +++ b/FlutterHelper/ninghao_flutter-master/lib/demo/alert_dialog_demo.dart @@ -0,0 +1,86 @@ +import 'package:flutter/material.dart'; +import 'dart:async'; + +enum Action { + Ok, + Cancel +} + +class AlertDialogDemo extends StatefulWidget { + @override + _AlertDialogDemoState createState() => _AlertDialogDemoState(); +} + +class _AlertDialogDemoState extends State { + String _choice = 'Nothing'; + + Future _openAlertDialog() async { + final action = await showDialog( + context: context, + barrierDismissible: false, + builder: (BuildContext context) { + return AlertDialog( + title: Text('AlertDialog'), + content: Text('Are you sure about this?'), + actions: [ + FlatButton( + child: Text('Cancel'), + onPressed: () { + Navigator.pop(context, Action.Cancel); + }, + ), + FlatButton( + child: Text('Ok'), + onPressed: () { + Navigator.pop(context, Action.Ok); + }, + ), + ], + ); + }, + ); + + switch (action) { + case Action.Ok: + setState(() { + _choice = 'Ok'; + }); + break; + case Action.Cancel: + setState(() { + _choice = 'Cancel'; + }); + break; + default: + } + } + + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: AppBar( + title: Text('AlertDialogDemo'), + elevation: 0.0, + ), + body: Container( + padding: EdgeInsets.all(16.0), + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Text('Your choice is: $_choice'), + SizedBox(height: 16.0,), + Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + RaisedButton( + child: Text('Open AlertDialog'), + onPressed: _openAlertDialog, + ), + ], + ), + ], + ), + ), + ); + } +} \ No newline at end of file diff --git a/FlutterHelper/ninghao_flutter-master/lib/demo/animation/animation_demo.dart b/FlutterHelper/ninghao_flutter-master/lib/demo/animation/animation_demo.dart new file mode 100644 index 00000000..41020f88 --- /dev/null +++ b/FlutterHelper/ninghao_flutter-master/lib/demo/animation/animation_demo.dart @@ -0,0 +1,105 @@ +import 'package:flutter/material.dart'; + +class AnimationDemo extends StatelessWidget { + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: AppBar( + title: Text('AnimationDemo'), + elevation: 0.0, + ), + body: AnimationDemoHome()); + } +} + +class AnimationDemoHome extends StatefulWidget { + @override + _AnimationDemoHomeState createState() => _AnimationDemoHomeState(); +} + +class _AnimationDemoHomeState extends State + with TickerProviderStateMixin { + AnimationController animationDemoController; + Animation animation; + Animation animationColor; + CurvedAnimation curve; + + @override + void initState() { + super.initState(); + + animationDemoController = AnimationController( + // value: 32.0, + // lowerBound: 32.0, + // upperBound: 100.0, + duration: Duration(milliseconds: 1000), + vsync: this, + ); + + curve = CurvedAnimation( + parent: animationDemoController, curve: Curves.bounceOut); + + animation = Tween(begin: 32.0, end: 100.0).animate(curve); + animationColor = + ColorTween(begin: Colors.red, end: Colors.red[900]).animate(curve); + + // animationDemoController.addListener(() { + // // print('${animationDemoController.value}'); + // setState(() {}); + // }); + + animationDemoController.addStatusListener((AnimationStatus status) { + print(status); + }); + + // animationDemoController.forward(); + } + + @override + void dispose() { + super.dispose(); + + animationDemoController.dispose(); + } + + @override + Widget build(BuildContext context) { + return Center( + child: AnimatedHeart( + animations: [ + animation, + animationColor, + ], + controller: animationDemoController, + ), + ); + } +} + +class AnimatedHeart extends AnimatedWidget { + final List animations; + final AnimationController controller; + + AnimatedHeart({ + this.animations, + this.controller, + }) : super(listenable: controller); + + @override + Widget build(BuildContext context) { + return IconButton( + icon: Icon(Icons.favorite), + iconSize: animations[0].value, + color: animations[1].value, + onPressed: () { + switch (controller.status) { + case AnimationStatus.completed: + controller.reverse(); + break; + default: + controller.forward(); + } + }, + ); + } +} diff --git a/FlutterHelper/ninghao_flutter-master/lib/demo/basic_demo.dart b/FlutterHelper/ninghao_flutter-master/lib/demo/basic_demo.dart new file mode 100644 index 00000000..3703ace6 --- /dev/null +++ b/FlutterHelper/ninghao_flutter-master/lib/demo/basic_demo.dart @@ -0,0 +1,121 @@ +import 'package:flutter/material.dart'; + +class BasicDemo extends StatelessWidget { + @override + Widget build(BuildContext context) { + return ContainerBoxDecorationDemo(); + } +} + +class ContainerBoxDecorationDemo extends StatelessWidget { + @override + Widget build(BuildContext context) { + return Container( + // color: Colors.grey[100], + decoration: BoxDecoration( + image: DecorationImage( + image: NetworkImage('https://resources.ninghao.org/images/say-hello-to-barry.jpg'), + alignment: Alignment.topCenter, + // repeat: ImageRepeat.repeatY, + fit: BoxFit.cover, + colorFilter: ColorFilter.mode( + Colors.indigoAccent[400].withOpacity(0.5), + BlendMode.hardLight, + ), + ), + ), + child: Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Container( + child: Icon(Icons.pool, size: 32.0, color: Colors.white), + // color: Color.fromRGBO(3, 54, 255, 1.0), + padding: EdgeInsets.all(16.0), + margin: EdgeInsets.all(8.0), + width: 90.0, + height: 90.0, + decoration: BoxDecoration( + color: Color.fromRGBO(3, 54, 255, 1.0), + border: Border.all( + color: Colors.indigoAccent[100], + width: 3.0, + style: BorderStyle.solid, + ), + // borderRadius: BorderRadius.circular(16.0), + boxShadow: [ + BoxShadow( + offset: Offset(0.0, 16.0), + color: Color.fromRGBO(16, 20, 188, 1.0), + blurRadius: 25.0, + spreadRadius: -9.0, + ), + ], + shape: BoxShape.circle, + // gradient: RadialGradient( + // colors: [ + // Color.fromRGBO(7, 102, 255, 1.0), + // Color.fromRGBO(3, 28, 128, 1.0), + // ], + // ), + gradient: LinearGradient( + colors: [ + Color.fromRGBO(7, 102, 255, 1.0), + Color.fromRGBO(3, 28, 128, 1.0), + ], + begin: Alignment.topCenter, + end: Alignment.bottomCenter, + ), + ), + ), + ], + ), + ); + } +} + +class RichTextDemo extends StatelessWidget { + @override + Widget build(BuildContext context) { + return RichText( + text: TextSpan( + text: 'ninghao', + style: TextStyle( + color: Colors.deepPurpleAccent, + fontSize: 34.0, + fontStyle: FontStyle.italic, + fontWeight: FontWeight.w100, + ), + children: [ + TextSpan( + text: '.net', + style: TextStyle( + fontSize: 17.0, + color: Colors.grey, + ), + ) + ], + ), + ); + } +} + +class TextDemo extends StatelessWidget { + final TextStyle _textStyle = TextStyle( + fontSize: 16.0, + ); + + final String _author = '李白'; + final String _title = '将进酒'; + + @override + Widget build(BuildContext context) { + // TODO: implement build + return Text( + '《 $_title 》—— $_author。君不见黄河之水天上来,奔流到海不复回。君不见高堂明镜悲白发,朝如青丝暮成雪。人生得意须尽欢,莫使金樽空对月。天生我材必有用,千金散尽还复来。烹羊宰牛且为乐,会须一饮三百杯。', + textAlign: TextAlign.left, + style: _textStyle, + maxLines: 3, + overflow: TextOverflow.ellipsis, + ); + } +} diff --git a/FlutterHelper/ninghao_flutter-master/lib/demo/bloc/bloc_demo.dart b/FlutterHelper/ninghao_flutter-master/lib/demo/bloc/bloc_demo.dart new file mode 100644 index 00000000..d1d68a00 --- /dev/null +++ b/FlutterHelper/ninghao_flutter-master/lib/demo/bloc/bloc_demo.dart @@ -0,0 +1,19 @@ +import 'package:flutter/material.dart'; +import 'package:ninghao_flutter/demo/bloc/counter_bloc_demo.dart'; + +class BlocDemo extends StatelessWidget { + @override + Widget build(BuildContext context) { + return CounterProvider( + bloc: CounterBloc(), + child: Scaffold( + appBar: AppBar( + title: Text('BlocDemo'), + elevation: 0.0, + ), + body: CounterHome(), + floatingActionButton: CounterActionButton(), + ), + ); + } +} diff --git a/FlutterHelper/ninghao_flutter-master/lib/demo/bloc/counter_bloc_demo.dart b/FlutterHelper/ninghao_flutter-master/lib/demo/bloc/counter_bloc_demo.dart new file mode 100644 index 00000000..4593282d --- /dev/null +++ b/FlutterHelper/ninghao_flutter-master/lib/demo/bloc/counter_bloc_demo.dart @@ -0,0 +1,88 @@ +import 'dart:async'; + +import 'package:flutter/material.dart'; + +class CounterHome extends StatelessWidget { + @override + Widget build(BuildContext context) { + CounterBloc _counterBloc = CounterProvider.of(context).bloc; + + return Center( + child: StreamBuilder( + initialData: 0, + stream: _counterBloc.count, + builder: (context, snapshot) { + return ActionChip( + label: Text('${snapshot.data}'), + onPressed: () { + // _counterBloc.log(); + _counterBloc.counter.add(1); + }, + ); + }, + ), + ); + } +} + +class CounterActionButton extends StatelessWidget { + @override + Widget build(BuildContext context) { + CounterBloc _counterBloc = CounterProvider.of(context).bloc; + + return FloatingActionButton( + child: Icon(Icons.add), + onPressed: () { + // _counterBloc.log(); + _counterBloc.counter.add(1); + }, + ); + } +} + +class CounterProvider extends InheritedWidget { + final Widget child; + final CounterBloc bloc; + + CounterProvider({ + this.child, + this.bloc, + }) : super(child: child); + + static CounterProvider of(BuildContext context) => + context.inheritFromWidgetOfExactType(CounterProvider); + + @override + bool updateShouldNotify(CounterProvider oldWidget) { + return true; + } +} + +class CounterBloc { + int _count = 0; + + final _counterActionController = StreamController(); + StreamSink get counter => _counterActionController.sink; + + final _counterController = StreamController(); + Stream get count => _counterController.stream; + + CounterBloc() { + _counterActionController.stream.listen(onData); + } + + void onData(int data) { + print('$data'); + _count = data + _count; + _counterController.add(_count); + } + + void disponse() { + _counterActionController.close(); + _counterController.close(); + } + + void log() { + print('BLoC'); + } +} \ No newline at end of file diff --git a/FlutterHelper/ninghao_flutter-master/lib/demo/bottom_navigation_bar_demo.dart b/FlutterHelper/ninghao_flutter-master/lib/demo/bottom_navigation_bar_demo.dart new file mode 100644 index 00000000..930e60b7 --- /dev/null +++ b/FlutterHelper/ninghao_flutter-master/lib/demo/bottom_navigation_bar_demo.dart @@ -0,0 +1,48 @@ +import 'package:flutter/material.dart'; + +class BottomNavigationBarDemo extends StatefulWidget { + @override + State createState() { + // TODO: implement createState + return _BottomNavigationBarDemoState(); + } +} + +class _BottomNavigationBarDemoState extends State { + int _currentIndex = 0; + + void _onTapHandler (int index) { + setState(() { + _currentIndex = index; + }); + } + + @override + Widget build(BuildContext context) { + // TODO: implement build + return BottomNavigationBar( + currentIndex: _currentIndex, + onTap: _onTapHandler, + type: BottomNavigationBarType.fixed, + fixedColor: Colors.black, + items: [ + BottomNavigationBarItem( + icon: Icon(Icons.explore), + title: Text('Explore'), + ), + BottomNavigationBarItem( + icon: Icon(Icons.history), + title: Text('History'), + ), + BottomNavigationBarItem( + icon: Icon(Icons.list), + title: Text('List'), + ), + BottomNavigationBarItem( + icon: Icon(Icons.person), + title: Text('My'), + ), + ], + ); + } +} \ No newline at end of file diff --git a/FlutterHelper/ninghao_flutter-master/lib/demo/bottom_sheet_demo.dart b/FlutterHelper/ninghao_flutter-master/lib/demo/bottom_sheet_demo.dart new file mode 100644 index 00000000..77b1ff07 --- /dev/null +++ b/FlutterHelper/ninghao_flutter-master/lib/demo/bottom_sheet_demo.dart @@ -0,0 +1,102 @@ +import 'package:flutter/material.dart'; +import 'dart:async'; + +class BottomSheetDemo extends StatefulWidget { + @override + _BottomSheetDemoState createState() => _BottomSheetDemoState(); +} + +class _BottomSheetDemoState extends State { + final _bottomSheetScaffoldKey = GlobalKey(); + + _openBottomSheet() { + _bottomSheetScaffoldKey + .currentState + .showBottomSheet((BuildContext context) { + return BottomAppBar( + child: Container( + height: 90.0, + width: double.infinity, + padding: EdgeInsets.all(16.0), + child: Row( + children: [ + Icon(Icons.pause_circle_outline), + SizedBox(width: 16.0,), + Text('01:30 / 03:30'), + Expanded( + child: Text('Fix you - Coldplay', textAlign: TextAlign.right,), + ), + ], + ), + ), + ); + }); + } + + Future _openModalBottomSheet() async { + final option = await showModalBottomSheet( + context: context, + builder: (BuildContext context) { + return Container( + height: 200.0, + child: Column( + children: [ + ListTile( + title: Text('Option A'), + onTap: () { + Navigator.pop(context, 'A'); + }, + ), + ListTile( + title: Text('Option B'), + onTap: () { + Navigator.pop(context, 'B'); + }, + ), + ListTile( + title: Text('Option C'), + onTap: () { + Navigator.pop(context, 'C'); + }, + ), + ], + ), + ); + } + ); + + print(option); + } + + @override + Widget build(BuildContext context) { + return Scaffold( + key: _bottomSheetScaffoldKey, + appBar: AppBar( + title: Text('BottomSheetDemo'), + elevation: 0.0, + ), + body: Container( + padding: EdgeInsets.all(16.0), + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + FlatButton( + child: Text('Open BottomSheet'), + onPressed: _openBottomSheet, + ), + FlatButton( + child: Text('Modal BottomSheet'), + onPressed: _openModalBottomSheet, + ), + ] + ), + ], + ), + ), + ); + } +} \ No newline at end of file diff --git a/FlutterHelper/ninghao_flutter-master/lib/demo/button_demo.dart b/FlutterHelper/ninghao_flutter-master/lib/demo/button_demo.dart new file mode 100644 index 00000000..19e89638 --- /dev/null +++ b/FlutterHelper/ninghao_flutter-master/lib/demo/button_demo.dart @@ -0,0 +1,208 @@ +import 'package:flutter/material.dart'; + +class ButtonDemo extends StatelessWidget { + @override + Widget build(BuildContext context) { + final Widget flatButtonDemo = Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + FlatButton( + child: Text('Button'), + onPressed: () {}, + splashColor: Colors.grey, + textColor: Theme.of(context).accentColor, + ), + FlatButton.icon( + icon: Icon(Icons.add), + label: Text('Button'), + onPressed: () {}, + splashColor: Colors.grey, + textColor: Theme.of(context).accentColor, + ), + ], + ); + + final Widget raisedButtonDemo = Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Theme( + data: Theme.of(context).copyWith( + buttonColor: Theme.of(context).accentColor, + buttonTheme: ButtonThemeData( + textTheme: ButtonTextTheme.primary, + // shape: BeveledRectangleBorder( + // borderRadius: BorderRadius.circular(5.0), + // ), + shape: StadiumBorder(), + ), + ), + child: RaisedButton( + child: Text('Button'), + onPressed: () {}, + splashColor: Colors.grey, + elevation: 0.0, + // color: Theme.of(context).accentColor, + // textColor: Colors.white, + // textTheme: ButtonTextTheme.primary, + ), + ), + SizedBox(width: 16.0,), + RaisedButton.icon( + icon: Icon(Icons.add), + label: Text('Button'), + onPressed: () {}, + splashColor: Colors.grey, + elevation: 12.0, + textColor: Theme.of(context).accentColor, + ), + ], + ); + + final Widget outlineButtonDemo = Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Theme( + data: Theme.of(context).copyWith( + buttonColor: Theme.of(context).accentColor, + buttonTheme: ButtonThemeData( + textTheme: ButtonTextTheme.primary, + // shape: BeveledRectangleBorder( + // borderRadius: BorderRadius.circular(5.0), + // ), + shape: StadiumBorder(), + ), + ), + child: OutlineButton( + child: Text('Button'), + onPressed: () {}, + splashColor: Colors.grey[100], + borderSide: BorderSide( + color: Colors.black, + ), + // color: Theme.of(context).accentColor, + textColor: Colors.black, + highlightedBorderColor: Colors.grey, + // textTheme: ButtonTextTheme.primary, + ), + ), + SizedBox(width: 16.0,), + OutlineButton.icon( + icon: Icon(Icons.add), + label: Text('Button'), + onPressed: () {}, + splashColor: Colors.grey, + textColor: Theme.of(context).accentColor, + ), + ], + ); + + final Widget fixedWidthButton = Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Container( + width: 130.0, + child: OutlineButton( + child: Text('Button'), + onPressed: () {}, + splashColor: Colors.grey[100], + borderSide: BorderSide( + color: Colors.black, + ), + textColor: Colors.black, + highlightedBorderColor: Colors.grey, + ), + ), + ], + ); + + final Widget expandedButton = Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Expanded( + child: OutlineButton( + child: Text('Button'), + onPressed: () {}, + splashColor: Colors.grey[100], + borderSide: BorderSide( + color: Colors.black, + ), + textColor: Colors.black, + highlightedBorderColor: Colors.grey, + ), + ), + SizedBox(width: 16.0,), + Expanded( + flex: 2, + child: OutlineButton( + child: Text('Button'), + onPressed: () {}, + splashColor: Colors.grey[100], + borderSide: BorderSide( + color: Colors.black, + ), + textColor: Colors.black, + highlightedBorderColor: Colors.grey, + ), + ), + ], + ); + + final Widget buttonBarDemo = Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Theme( + data: Theme.of(context).copyWith( + buttonTheme: ButtonThemeData( + padding: EdgeInsets.symmetric(horizontal: 32.0), + ), + ), + child: ButtonBar( + children: [ + OutlineButton( + child: Text('Button'), + onPressed: () {}, + splashColor: Colors.grey[100], + borderSide: BorderSide( + color: Colors.black, + ), + textColor: Colors.black, + highlightedBorderColor: Colors.grey, + ), + OutlineButton( + child: Text('Button'), + onPressed: () {}, + splashColor: Colors.grey[100], + borderSide: BorderSide( + color: Colors.black, + ), + textColor: Colors.black, + highlightedBorderColor: Colors.grey, + ), + ], + ), + ), + ], + ); + + return Scaffold( + appBar: AppBar( + title: Text('ButtonDemo'), + elevation: 0.0, + ), + body: Container( + padding: EdgeInsets.all(16.0), + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + flatButtonDemo, + raisedButtonDemo, + outlineButtonDemo, + fixedWidthButton, + expandedButton, + buttonBarDemo, + ], + ), + ) + ); + } +} \ No newline at end of file diff --git a/FlutterHelper/ninghao_flutter-master/lib/demo/card_demo.dart b/FlutterHelper/ninghao_flutter-master/lib/demo/card_demo.dart new file mode 100644 index 00000000..85da6258 --- /dev/null +++ b/FlutterHelper/ninghao_flutter-master/lib/demo/card_demo.dart @@ -0,0 +1,70 @@ +import 'package:flutter/material.dart'; +import '../model/post.dart'; + +class CardDemo extends StatefulWidget { + @override + _CardDemoState createState() => _CardDemoState(); +} + +class _CardDemoState extends State { + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: AppBar( + title: Text('CardDemo'), + elevation: 0.0, + ), + body: Container( + padding: EdgeInsets.all(16.0), + child: ListView( + children: posts.map((post) { + return Card( + child: Column( + children: [ + AspectRatio( + aspectRatio: 16/9, + child: ClipRRect( + borderRadius: BorderRadius.only( + topLeft: Radius.circular(4.0), + topRight: Radius.circular(4.0), + ), + child: Image.network( + post.imageUrl, + fit: BoxFit.cover, + ), + ), + ), + ListTile( + leading: CircleAvatar( + backgroundImage: NetworkImage(post.imageUrl), + ), + title: Text(post.title), + subtitle: Text(post.author), + ), + Container( + padding: EdgeInsets.all(16.0), + child: Text(post.description, maxLines: 2, overflow: TextOverflow.ellipsis,), + ), + ButtonTheme.bar( + child: ButtonBar( + children: [ + FlatButton( + child: Text('Like'.toUpperCase()), + onPressed: () {}, + ), + FlatButton( + child: Text('Read'.toUpperCase()), + onPressed: () {}, + ), + ], + ), + ), + ], + ), + ); + }).toList(), + ), + ) + ); + } +} \ No newline at end of file diff --git a/FlutterHelper/ninghao_flutter-master/lib/demo/checkbox_demo.dart b/FlutterHelper/ninghao_flutter-master/lib/demo/checkbox_demo.dart new file mode 100644 index 00000000..0652b390 --- /dev/null +++ b/FlutterHelper/ninghao_flutter-master/lib/demo/checkbox_demo.dart @@ -0,0 +1,54 @@ +import 'package:flutter/material.dart'; + +class CheckboxDemo extends StatefulWidget { + @override + _CheckboxDemoState createState() => _CheckboxDemoState(); +} + +class _CheckboxDemoState extends State { + bool _checkboxItemA = true; + + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: AppBar( + title: Text('CheckboxDemo'), + elevation: 0.0, + ), + body: Container( + padding: EdgeInsets.all(16.0), + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + CheckboxListTile( + value: _checkboxItemA, + onChanged: (value) { + setState(() { + _checkboxItemA = value; + }); + }, + title: Text('Checkbox Item A'), + subtitle: Text('Description'), + secondary: Icon(Icons.bookmark), + selected: _checkboxItemA, + ), + Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + // Checkbox( + // value: _checkboxItemA, + // onChanged: (value) { + // setState(() { + // _checkboxItemA = value; + // }); + // }, + // activeColor: Colors.black, + // ), + ], + ), + ], + ), + ) + ); + } +} \ No newline at end of file diff --git a/FlutterHelper/ninghao_flutter-master/lib/demo/chip_demo.dart b/FlutterHelper/ninghao_flutter-master/lib/demo/chip_demo.dart new file mode 100644 index 00000000..6a3a40e8 --- /dev/null +++ b/FlutterHelper/ninghao_flutter-master/lib/demo/chip_demo.dart @@ -0,0 +1,178 @@ +import 'package:flutter/material.dart'; + +class ChipDemo extends StatefulWidget { + @override + _ChipDemoState createState() => _ChipDemoState(); +} + +class _ChipDemoState extends State { + List _tags = [ + 'Apple', + 'Banana', + 'Lemon', + ]; + + String _action = 'Nothing'; + List _selected = []; + String _choice = 'Lemon'; + + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: AppBar( + title: Text('ChipDemo'), + elevation: 0.0, + ), + body: Container( + padding: EdgeInsets.all(16.0), + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Wrap( + spacing: 8.0, + runSpacing: 8.0, + children: [ + Chip( + label: Text('Life'), + ), + Chip( + label: Text('Sunset'), + backgroundColor: Colors.orange, + ), + Chip( + label: Text('Wanghao'), + avatar: CircleAvatar( + backgroundColor: Colors.grey, + child: Text('皓'), + ), + ), + Chip( + label: Text('Wanghao'), + avatar: CircleAvatar( + backgroundImage: NetworkImage( + 'https://resources.ninghao.net/images/wanghao.jpg' + ), + ), + ), + Chip( + label: Text('City'), + onDeleted: () {}, + deleteIcon: Icon(Icons.delete), + deleteIconColor: Colors.redAccent, + deleteButtonTooltipMessage: 'Remove this tag', + ), + Divider( + color: Colors.grey, + height: 32.0, + // indent: 32.0, + ), + Wrap( + spacing: 8.0, + children: _tags.map((tag) { + return Chip( + label: Text(tag), + onDeleted: () { + setState(() { + _tags.remove(tag); + }); + }, + ); + }).toList(), + ), + Divider( + color: Colors.grey, + height: 32.0, + // indent: 32.0, + ), + Container( + width: double.infinity, + child: Text('ActionChip: $_action'), + ), + Wrap( + spacing: 8.0, + children: _tags.map((tag) { + return ActionChip( + label: Text(tag), + onPressed: () { + setState(() { + _action = tag; + }); + }, + ); + }).toList(), + ), + Divider( + color: Colors.grey, + height: 32.0, + // indent: 32.0, + ), + Container( + width: double.infinity, + child: Text('FilterChip: ${_selected.toString()}'), + ), + Wrap( + spacing: 8.0, + children: _tags.map((tag) { + return FilterChip( + label: Text(tag), + selected: _selected.contains(tag), + onSelected: (value) { + setState(() { + if (_selected.contains(tag)) { + _selected.remove(tag); + } else { + _selected.add(tag); + } + }); + }, + ); + }).toList(), + ), + Divider( + color: Colors.grey, + height: 32.0, + // indent: 32.0, + ), + Container( + width: double.infinity, + child: Text('ChoiceChip: $_choice'), + ), + Wrap( + spacing: 8.0, + children: _tags.map((tag) { + return ChoiceChip( + label: Text(tag), + selectedColor: Colors.black, + selected: _choice == tag, + onSelected: (value) { + setState(() { + _choice = tag; + }); + }, + ); + }).toList(), + ), + ], + ), + ], + ), + ), + floatingActionButton: FloatingActionButton( + child: Icon(Icons.restore), + onPressed: () { + setState(() { + _tags = [ + 'Apple', + 'Banana', + 'Lemon', + ]; + + _selected = []; + + _choice = 'Lemon'; + }); + }, + ), + ); + } +} \ No newline at end of file diff --git a/FlutterHelper/ninghao_flutter-master/lib/demo/data_table_demo.dart b/FlutterHelper/ninghao_flutter-master/lib/demo/data_table_demo.dart new file mode 100644 index 00000000..2394e974 --- /dev/null +++ b/FlutterHelper/ninghao_flutter-master/lib/demo/data_table_demo.dart @@ -0,0 +1,78 @@ +import 'package:flutter/material.dart'; +import '../model/post.dart'; + +class DataTableDemo extends StatefulWidget { + @override + _DataTableDemoState createState() => _DataTableDemoState(); +} + +class _DataTableDemoState extends State { + int _sortColumnIndex; + bool _sortAscending = true; + + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: AppBar( + title: Text('DataTableDemo'), + elevation: 0.0, + ), + body: Container( + padding: EdgeInsets.all(16.0), + child: ListView( + children: [ + DataTable( + sortColumnIndex: _sortColumnIndex, + sortAscending: _sortAscending, + // onSelectAll: (bool value) {}, + columns: [ + DataColumn( + label: Text('Title'), + onSort: (int index, bool ascending) { + setState(() { + _sortColumnIndex = index; + _sortAscending = ascending; + + posts.sort((a, b) { + if (!ascending) { + final c = a; + a = b; + b = c; + } + + return a.title.length.compareTo(b.title.length); + }); + }); + }, + ), + DataColumn( + label: Text('Author'), + ), + DataColumn( + label: Text('Image'), + ), + ], + rows: posts.map((post) { + return DataRow( + selected: post.selected, + onSelectChanged: (bool value) { + setState(() { + if (post.selected != value) { + post.selected = value; + } + }); + }, + cells: [ + DataCell(Text(post.title)), + DataCell(Text(post.author)), + DataCell(Image.network(post.imageUrl)), + ] + ); + }).toList(), + ), + ], + ), + ) + ); + } +} \ No newline at end of file diff --git a/FlutterHelper/ninghao_flutter-master/lib/demo/datetime_demo.dart b/FlutterHelper/ninghao_flutter-master/lib/demo/datetime_demo.dart new file mode 100644 index 00000000..c5e0f4ec --- /dev/null +++ b/FlutterHelper/ninghao_flutter-master/lib/demo/datetime_demo.dart @@ -0,0 +1,82 @@ +import 'package:flutter/material.dart'; +import 'package:intl/intl.dart'; +import 'dart:async'; + +class DateTimeDemo extends StatefulWidget { + @override + _DateTimeDemoState createState() => _DateTimeDemoState(); +} + +class _DateTimeDemoState extends State { + DateTime selectedDate = DateTime.now(); + TimeOfDay selectedTime = TimeOfDay(hour: 9, minute: 30); + + Future _selectDate() async { + final DateTime date = await showDatePicker( + context: context, + initialDate: selectedDate, + firstDate: DateTime(1900), + lastDate: DateTime(2100), + ); + + if (date == null) return; + + setState(() { + selectedDate = date; + }); + } + + Future _selectTime() async { + final TimeOfDay time = await showTimePicker( + context: context, + initialTime: selectedTime, + ); + + if (time == null) return; + + setState(() { + selectedTime = time; + }); + } + + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: AppBar( + title: Text('DateTimeDemo'), + elevation: 0.0, + ), + body: Container( + padding: EdgeInsets.all(16.0), + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + InkWell( + onTap: _selectDate, + child: Row( + children: [ + Text(DateFormat.yMMMMd().format(selectedDate)), + Icon(Icons.arrow_drop_down), + ], + ), + ), + InkWell( + onTap: _selectTime, + child: Row( + children: [ + Text(selectedTime.format(context)), + Icon(Icons.arrow_drop_down), + ], + ), + ), + ], + ), + ], + ), + ) + ); + } +} \ No newline at end of file diff --git a/FlutterHelper/ninghao_flutter-master/lib/demo/drawer_demo.dart b/FlutterHelper/ninghao_flutter-master/lib/demo/drawer_demo.dart new file mode 100644 index 00000000..04f738cb --- /dev/null +++ b/FlutterHelper/ninghao_flutter-master/lib/demo/drawer_demo.dart @@ -0,0 +1,58 @@ +import 'package:flutter/material.dart'; + +class DrawerDemo extends StatelessWidget { + @override + Widget build(BuildContext context) { + // TODO: implement build + return Drawer( + child: ListView( + padding: EdgeInsets.zero, + children: [ + UserAccountsDrawerHeader( + accountName: + Text('wanghao', style: TextStyle(fontWeight: FontWeight.bold)), + accountEmail: Text('wanghao@ninghao.net'), + currentAccountPicture: CircleAvatar( + backgroundImage: NetworkImage( + 'https://resources.ninghao.org/images/wanghao.jpg'), + ), + decoration: BoxDecoration( + color: Colors.yellow[400], + image: DecorationImage( + image: NetworkImage( + 'https://resources.ninghao.org/images/childhood-in-a-picture.jpg'), + fit: BoxFit.cover, + colorFilter: ColorFilter.mode( + Colors.yellow[400].withOpacity(0.6), BlendMode.hardLight), + ), + ), + ), + ListTile( + title: Text( + 'Messages', + textAlign: TextAlign.right, + ), + trailing: Icon(Icons.message, color: Colors.black12, size: 22.0), + onTap: () => Navigator.pop(context), + ), + ListTile( + title: Text( + 'Favorite', + textAlign: TextAlign.right, + ), + trailing: Icon(Icons.favorite, color: Colors.black12, size: 22.0), + onTap: () => Navigator.pop(context), + ), + ListTile( + title: Text( + 'Settings', + textAlign: TextAlign.right, + ), + trailing: Icon(Icons.settings, color: Colors.black12, size: 22.0), + onTap: () => Navigator.pop(context), + ), + ], + ), + ); + } +} diff --git a/FlutterHelper/ninghao_flutter-master/lib/demo/expansion_panel_demo.dart b/FlutterHelper/ninghao_flutter-master/lib/demo/expansion_panel_demo.dart new file mode 100644 index 00000000..2624fdb7 --- /dev/null +++ b/FlutterHelper/ninghao_flutter-master/lib/demo/expansion_panel_demo.dart @@ -0,0 +1,99 @@ +import 'package:flutter/material.dart'; + +class ExpansionPanelItem { + final String headerText; + final Widget body; + bool isExpanded; + + ExpansionPanelItem({ + this.headerText, + this.body, + this.isExpanded, + }); +} + +class ExpansionPanelDemo extends StatefulWidget { + @override + _ExpansionPanelDemoState createState() => _ExpansionPanelDemoState(); +} + +class _ExpansionPanelDemoState extends State { + List _expansionPanelItems; + + @override + void initState() { + super.initState(); + + _expansionPanelItems = [ + ExpansionPanelItem( + headerText: 'Panel A', + body: Container( + padding: EdgeInsets.all(16.0), + width: double.infinity, + child: Text('Content for Panel A.'), + ), + isExpanded: false, + ), + ExpansionPanelItem( + headerText: 'Panel B', + body: Container( + padding: EdgeInsets.all(16.0), + width: double.infinity, + child: Text('Content for Panel B.'), + ), + isExpanded: false, + ), + ExpansionPanelItem( + headerText: 'Panel C', + body: Container( + padding: EdgeInsets.all(16.0), + width: double.infinity, + child: Text('Content for Panel C.'), + ), + isExpanded: false, + ), + ]; + } + + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: AppBar( + title: Text('ExpansionPanelDemo'), + elevation: 0.0, + ), + body: Container( + padding: EdgeInsets.all(16.0), + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + ExpansionPanelList( + expansionCallback: (int panelIndex, bool isExpanded) { + setState(() { + _expansionPanelItems[panelIndex].isExpanded = !isExpanded; + }); + }, + children: _expansionPanelItems.map( + (ExpansionPanelItem item) { + return ExpansionPanel( + isExpanded: item.isExpanded, + body: item.body, + headerBuilder: (BuildContext context, bool isExpanded) { + return Container( + padding: EdgeInsets.all(16.0), + child: Text( + item.headerText, + style: Theme.of(context).textTheme.title, + ), + ); + }, + ); + } + ).toList(), + ), + ], + ), + ), + ); + } +} \ No newline at end of file diff --git a/FlutterHelper/ninghao_flutter-master/lib/demo/floating_action_button_demo.dart b/FlutterHelper/ninghao_flutter-master/lib/demo/floating_action_button_demo.dart new file mode 100644 index 00000000..a5ad148e --- /dev/null +++ b/FlutterHelper/ninghao_flutter-master/lib/demo/floating_action_button_demo.dart @@ -0,0 +1,37 @@ +import 'package:flutter/material.dart'; + +class FloatingActionButtonDemo extends StatelessWidget { + @override + Widget build(BuildContext context) { + final Widget _floatingActionButton = FloatingActionButton( + onPressed: () {}, + child: Icon(Icons.add), + elevation: 0.0, + backgroundColor: Colors.black87, + // shape: BeveledRectangleBorder( + // borderRadius: BorderRadius.circular(30.0) + // ), + ); + + final Widget _floatingActionButtonExtended = FloatingActionButton.extended( + onPressed: () {}, + icon: Icon(Icons.add), + label: Text('Add'), + ); + + return Scaffold( + appBar: AppBar( + title: Text('FloatingActionButtonDemo'), + elevation: 0.0, + ), + floatingActionButton: _floatingActionButton, + floatingActionButtonLocation: FloatingActionButtonLocation.centerDocked, + bottomNavigationBar: BottomAppBar( + child: Container( + height: 80.0, + ), + shape: CircularNotchedRectangle(), + ), + ); + } +} \ No newline at end of file diff --git a/FlutterHelper/ninghao_flutter-master/lib/demo/form_demo.dart b/FlutterHelper/ninghao_flutter-master/lib/demo/form_demo.dart new file mode 100644 index 00000000..9caea518 --- /dev/null +++ b/FlutterHelper/ninghao_flutter-master/lib/demo/form_demo.dart @@ -0,0 +1,173 @@ +import 'package:flutter/material.dart'; + +class FormDemo extends StatelessWidget { + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: AppBar( + title: Text('FormDemo'), + elevation: 0.0, + ), + body: Theme( + data: Theme.of(context).copyWith( + primaryColor: Colors.black, + ), + child: Container( + padding: EdgeInsets.all(16.0), + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + RegisterForm(), + ], + ), + ), + ), + ); + } +} + +class RegisterForm extends StatefulWidget { + @override + RegisterFormState createState() => RegisterFormState(); +} + +class RegisterFormState extends State { + final registerFormKey = GlobalKey(); + String username, password; + bool autovalidate = false; + + void submitRegisterForm() { + if (registerFormKey.currentState.validate()) { + registerFormKey.currentState.save(); + + debugPrint('username: $username'); + debugPrint('password: $password'); + + Scaffold.of(context).showSnackBar( + SnackBar( + content: Text('Registering...'), + ) + ); + } else { + setState(() { + autovalidate = true; + }); + } + } + + String validateUsername(value) { + if (value.isEmpty) { + return 'Username is required.'; + } + + return null; + } + + String validatePassword(value) { + if (value.isEmpty) { + return 'Password is required.'; + } + + return null; + } + + @override + Widget build(BuildContext context) { + return Form( + key: registerFormKey, + child: Column( + children: [ + TextFormField( + decoration: InputDecoration( + labelText: 'Username', + helperText: '', + ), + onSaved: (value) { + username = value; + }, + validator: validateUsername, + autovalidate: autovalidate, + ), + TextFormField( + obscureText: true, + decoration: InputDecoration( + labelText: 'Password', + helperText: '', + ), + onSaved: (value) { + password = value; + }, + validator: validatePassword, + autovalidate: autovalidate, + ), + SizedBox(height: 32.0,), + Container( + width: double.infinity, + child: RaisedButton( + color: Theme.of(context).accentColor, + child: Text('Register', style: TextStyle(color: Colors.white)), + elevation: 0.0, + onPressed: submitRegisterForm, + ), + ), + ], + ), + ); + } +} + +class TextFieldDemo extends StatefulWidget { + @override + TextFieldDemoState createState() => TextFieldDemoState(); +} + +class TextFieldDemoState extends State { + final textEditingController = TextEditingController(); + + @override + void dispose() { + textEditingController.dispose(); + super.dispose(); + } + + @override + void initState() { + super.initState(); + // textEditingController.text = 'hi'; + textEditingController.addListener( + () { + debugPrint('input: ${textEditingController.text}'); + } + ); + } + + @override + Widget build(BuildContext context) { + return TextField( + controller: textEditingController, + // onChanged: (value) { + // debugPrint('input: $value'); + // }, + onSubmitted: (value) { + debugPrint('submit: $value'); + }, + decoration: InputDecoration( + icon: Icon(Icons.subject), + labelText: 'Title', + hintText: 'Enter the post title.', + // border: InputBorder.none, + // border: OutlineInputBorder(), + filled: true, + ), + ); + } +} + +class ThemeDemo extends StatelessWidget { + @override + Widget build(BuildContext context) { + return Container( + color: Theme.of(context).accentColor, + ); + } +} \ No newline at end of file diff --git a/FlutterHelper/ninghao_flutter-master/lib/demo/hello_demo.dart b/FlutterHelper/ninghao_flutter-master/lib/demo/hello_demo.dart new file mode 100644 index 00000000..de8f67b7 --- /dev/null +++ b/FlutterHelper/ninghao_flutter-master/lib/demo/hello_demo.dart @@ -0,0 +1,18 @@ +import 'package:flutter/material.dart'; + +class Hello extends StatelessWidget { + @override + Widget build(BuildContext context) { + return Center( + child: Text( + 'hello', + textDirection: TextDirection.ltr, + style: TextStyle( + fontSize: 40.0, + fontWeight: FontWeight.bold, + color: Colors.black87, + ) + ), + ); + } +} \ No newline at end of file diff --git a/FlutterHelper/ninghao_flutter-master/lib/demo/http/http_demo.dart b/FlutterHelper/ninghao_flutter-master/lib/demo/http/http_demo.dart new file mode 100644 index 00000000..3a5e1cde --- /dev/null +++ b/FlutterHelper/ninghao_flutter-master/lib/demo/http/http_demo.dart @@ -0,0 +1,129 @@ +import 'dart:convert'; + +import 'package:flutter/material.dart'; +import 'package:http/http.dart' as http; +import 'dart:async'; + +class HttpDemo extends StatelessWidget { + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: AppBar( + title: Text('HttpDemo'), + elevation: 0.0, + ), + body: HttpDemoHome(), + ); + } +} + +class HttpDemoHome extends StatefulWidget { + @override + _HttpDemoHomeState createState() => _HttpDemoHomeState(); +} + +class _HttpDemoHomeState extends State { + @override + void initState() { + super.initState(); + // fetchPosts() + // .then((value) => print(value)); + + // final post = { + // 'title': 'hello', + // 'description': 'nice to meet you.', + // }; + + // print(post['title']); + // print(post['description']); + + // final postJson = json.encode(post); + // print(postJson); + + // final postJsonConverted = json.decode(postJson); + // print(postJsonConverted['title']); + // print(postJsonConverted['description']); + // print(postJsonConverted is Map); + + // final postModel = Post.fromJson(postJsonConverted); + // print('title: ${postModel.title}, description: ${postModel.description}'); + + // print('${json.encode(postModel)}'); + } + + Future> fetchPosts() async { + final response = + await http.get('https://resources.ninghao.net/demo/posts.json'); + + // print('statusCode: ${response.statusCode}'); + // print('body: ${response.body}'); + + if (response.statusCode == 200) { + final responseBody = json.decode(response.body); + List posts = responseBody['posts'] + .map((item) => Post.fromJson(item)) + .toList(); + + return posts; + } else { + throw Exception('Failed to fetch posts.'); + } + } + + @override + Widget build(BuildContext context) { + return FutureBuilder( + future: fetchPosts(), + builder: (BuildContext context, AsyncSnapshot snapshot) { + print('data: ${snapshot.data}'); + print('connectionState: ${snapshot.connectionState}'); + + if (snapshot.connectionState == ConnectionState.waiting) { + return Center( + child: Text('loading...'), + ); + } + + return ListView( + children: snapshot.data.map((item) { + return ListTile( + title: Text(item.title), + subtitle: Text(item.author), + leading: CircleAvatar( + backgroundImage: NetworkImage(item.imageUrl), + ), + ); + }).toList(), + ); + }, + ); + } +} + +class Post { + final int id; + final String title; + final String description; + final String author; + final String imageUrl; + + Post( + this.id, + this.title, + this.description, + this.author, + this.imageUrl, + ); + + Post.fromJson(Map json) + : id = json['id'], + title = json['title'], + description = json['description'], + author = json['author'], + imageUrl = json['imageUrl']; + + Map toJson() => { + 'title': title, + 'descritpion': description, + }; +} diff --git a/FlutterHelper/ninghao_flutter-master/lib/demo/i18n/i18n_demo.dart b/FlutterHelper/ninghao_flutter-master/lib/demo/i18n/i18n_demo.dart new file mode 100644 index 00000000..8a4877b9 --- /dev/null +++ b/FlutterHelper/ninghao_flutter-master/lib/demo/i18n/i18n_demo.dart @@ -0,0 +1,31 @@ +import 'package:flutter/material.dart'; +// import 'package:ninghao_flutter/demo/i18n/map/ninghao_demo_localizations.dart'; +import 'package:ninghao_flutter/demo/i18n/intl/ninghao_demo_localizations.dart'; + +class I18nDemo extends StatelessWidget { + @override + Widget build(BuildContext context) { + Locale locale = Localizations.localeOf(context); + + return Scaffold( + appBar: AppBar( + title: Text('I18nDemo'), + elevation: 0.0, + ), + body: Center( + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Text(locale.toString()), + Text( + // Localizations.of(context, NinghaoDemoLocalizations).title, + // NinghaoDemoLocalizations.of(context).title, + NinghaoDemoLocalizations.of(context).greet('ninghao'), + style: Theme.of(context).textTheme.title, + ) + ], + ), + ) + ); + } +} \ No newline at end of file diff --git a/FlutterHelper/ninghao_flutter-master/lib/demo/i18n/intl/intl_en.arb b/FlutterHelper/ninghao_flutter-master/lib/demo/i18n/intl/intl_en.arb new file mode 100644 index 00000000..15d5b6f2 --- /dev/null +++ b/FlutterHelper/ninghao_flutter-master/lib/demo/i18n/intl/intl_en.arb @@ -0,0 +1,17 @@ +{ + "@@last_modified": "2018-10-19T15:45:15.386436", + "title": "hello", + "@title": { + "description": "demo localizations.", + "type": "text", + "placeholders": {} + }, + "greet": "hello {name}", + "@greet": { + "description": "greet someone.", + "type": "text", + "placeholders": { + "name": {} + } + } +} \ No newline at end of file diff --git a/FlutterHelper/ninghao_flutter-master/lib/demo/i18n/intl/intl_messages.arb b/FlutterHelper/ninghao_flutter-master/lib/demo/i18n/intl/intl_messages.arb new file mode 100644 index 00000000..15d5b6f2 --- /dev/null +++ b/FlutterHelper/ninghao_flutter-master/lib/demo/i18n/intl/intl_messages.arb @@ -0,0 +1,17 @@ +{ + "@@last_modified": "2018-10-19T15:45:15.386436", + "title": "hello", + "@title": { + "description": "demo localizations.", + "type": "text", + "placeholders": {} + }, + "greet": "hello {name}", + "@greet": { + "description": "greet someone.", + "type": "text", + "placeholders": { + "name": {} + } + } +} \ No newline at end of file diff --git a/FlutterHelper/ninghao_flutter-master/lib/demo/i18n/intl/intl_zh.arb b/FlutterHelper/ninghao_flutter-master/lib/demo/i18n/intl/intl_zh.arb new file mode 100644 index 00000000..1e602a43 --- /dev/null +++ b/FlutterHelper/ninghao_flutter-master/lib/demo/i18n/intl/intl_zh.arb @@ -0,0 +1,17 @@ +{ + "@@last_modified": "2018-10-19T15:45:15.386436", + "title": "您好", + "@title": { + "description": "演示本地化", + "type": "text", + "placeholders": {} + }, + "greet": "您好 {name}", + "@greet": { + "description": "问候某人", + "type": "text", + "placeholders": { + "name": {} + } + } +} \ No newline at end of file diff --git a/FlutterHelper/ninghao_flutter-master/lib/demo/i18n/intl/ninghao_demo_localizations.dart b/FlutterHelper/ninghao_flutter-master/lib/demo/i18n/intl/ninghao_demo_localizations.dart new file mode 100644 index 00000000..3275282a --- /dev/null +++ b/FlutterHelper/ninghao_flutter-master/lib/demo/i18n/intl/ninghao_demo_localizations.dart @@ -0,0 +1,57 @@ +import 'package:flutter/material.dart'; +import 'package:intl/intl.dart'; +import 'ninghao_demo_messages_all.dart'; + +class NinghaoDemoLocalizations { + static NinghaoDemoLocalizations of(BuildContext context) { + return Localizations.of( + context, + NinghaoDemoLocalizations + ); + } + + static Future load(Locale locale) { + final String name = + locale.countryCode.isEmpty ? locale.languageCode : locale.toString(); + + final String localeName = Intl.canonicalizedLocale(name); + + return initializeMessages(localeName).then((bool _) { + Intl.defaultLocale = localeName; + return NinghaoDemoLocalizations(); + }); + } + + String get title => Intl.message( + 'hello', + name: 'title', + desc: 'demo localizations.', + ); + + String greet(String name) => Intl.message( + 'hello $name', + name: 'greet', + desc: 'greet someone.', + args: [name], + ); +} + +class NinghaoDemoLocalizationsDelegate + extends LocalizationsDelegate { + NinghaoDemoLocalizationsDelegate(); + + @override + Future load(Locale locale) { + return NinghaoDemoLocalizations.load(locale); + } + + @override + bool isSupported(Locale locale) { + return true; + } + + @override + bool shouldReload(LocalizationsDelegate old) { + return false; + } +} \ No newline at end of file diff --git a/FlutterHelper/ninghao_flutter-master/lib/demo/i18n/intl/ninghao_demo_messages_all.dart b/FlutterHelper/ninghao_flutter-master/lib/demo/i18n/intl/ninghao_demo_messages_all.dart new file mode 100644 index 00000000..548ef28c --- /dev/null +++ b/FlutterHelper/ninghao_flutter-master/lib/demo/i18n/intl/ninghao_demo_messages_all.dart @@ -0,0 +1,72 @@ +// DO NOT EDIT. This is code generated via package:intl/generate_localized.dart +// This is a library that looks up messages for specific locales by +// delegating to the appropriate library. + +import 'dart:async'; + +import 'package:intl/intl.dart'; +import 'package:intl/message_lookup_by_library.dart'; +// ignore: implementation_imports +import 'package:intl/src/intl_helpers.dart'; + +import 'ninghao_demo_messages_en.dart' as messages_en; +import 'ninghao_demo_messages_messages.dart' as messages_messages; +import 'ninghao_demo_messages_zh.dart' as messages_zh; + +typedef Future LibraryLoader(); +Map _deferredLibraries = { +// ignore: unnecessary_new + 'en': () => new Future.value(null), +// ignore: unnecessary_new + 'messages': () => new Future.value(null), +// ignore: unnecessary_new + 'zh': () => new Future.value(null), +}; + +MessageLookupByLibrary _findExact(localeName) { + switch (localeName) { + case 'en': + return messages_en.messages; + case 'messages': + return messages_messages.messages; + case 'zh': + return messages_zh.messages; + default: + return null; + } +} + +/// User programs should call this before using [localeName] for messages. +Future initializeMessages(String localeName) async { + var availableLocale = Intl.verifiedLocale( + localeName, + (locale) => _deferredLibraries[locale] != null, + onFailure: (_) => null); + if (availableLocale == null) { + // ignore: unnecessary_new + return new Future.value(false); + } + var lib = _deferredLibraries[availableLocale]; + // ignore: unnecessary_new + await (lib == null ? new Future.value(false) : lib()); + // ignore: unnecessary_new + initializeInternalMessageLookup(() => new CompositeMessageLookup()); + messageLookup.addLocale(availableLocale, _findGeneratedMessagesFor); + // ignore: unnecessary_new + return new Future.value(true); +} + +bool _messagesExistFor(String locale) { + try { + return _findExact(locale) != null; + } catch (e) { + return false; + } +} + +MessageLookupByLibrary _findGeneratedMessagesFor(locale) { + var actualLocale = Intl.verifiedLocale(locale, _messagesExistFor, + onFailure: (_) => null); + if (actualLocale == null) return null; + return _findExact(actualLocale); +} diff --git a/FlutterHelper/ninghao_flutter-master/lib/demo/i18n/intl/ninghao_demo_messages_en.dart b/FlutterHelper/ninghao_flutter-master/lib/demo/i18n/intl/ninghao_demo_messages_en.dart new file mode 100644 index 00000000..50e6cecc --- /dev/null +++ b/FlutterHelper/ninghao_flutter-master/lib/demo/i18n/intl/ninghao_demo_messages_en.dart @@ -0,0 +1,28 @@ +// DO NOT EDIT. This is code generated via package:intl/generate_localized.dart +// This is a library that provides messages for a en locale. All the +// messages from the main program should be duplicated here with the same +// function name. + +import 'package:intl/intl.dart'; +import 'package:intl/message_lookup_by_library.dart'; + +// ignore: unnecessary_new +final messages = new MessageLookup(); + +// ignore: unused_element +final _keepAnalysisHappy = Intl.defaultLocale; + +// ignore: non_constant_identifier_names +typedef MessageIfAbsent(String message_str, List args); + +class MessageLookup extends MessageLookupByLibrary { + get localeName => 'en'; + + static m0(name) => "hello ${name}"; + + final messages = _notInlinedMessages(_notInlinedMessages); + static _notInlinedMessages(_) => { + "greet" : m0, + "title" : MessageLookupByLibrary.simpleMessage("hello") + }; +} diff --git a/FlutterHelper/ninghao_flutter-master/lib/demo/i18n/intl/ninghao_demo_messages_messages.dart b/FlutterHelper/ninghao_flutter-master/lib/demo/i18n/intl/ninghao_demo_messages_messages.dart new file mode 100644 index 00000000..33b8e3b0 --- /dev/null +++ b/FlutterHelper/ninghao_flutter-master/lib/demo/i18n/intl/ninghao_demo_messages_messages.dart @@ -0,0 +1,28 @@ +// DO NOT EDIT. This is code generated via package:intl/generate_localized.dart +// This is a library that provides messages for a messages locale. All the +// messages from the main program should be duplicated here with the same +// function name. + +import 'package:intl/intl.dart'; +import 'package:intl/message_lookup_by_library.dart'; + +// ignore: unnecessary_new +final messages = new MessageLookup(); + +// ignore: unused_element +final _keepAnalysisHappy = Intl.defaultLocale; + +// ignore: non_constant_identifier_names +typedef MessageIfAbsent(String message_str, List args); + +class MessageLookup extends MessageLookupByLibrary { + get localeName => 'messages'; + + static m0(name) => "hello ${name}"; + + final messages = _notInlinedMessages(_notInlinedMessages); + static _notInlinedMessages(_) => { + "greet" : m0, + "title" : MessageLookupByLibrary.simpleMessage("hello") + }; +} diff --git a/FlutterHelper/ninghao_flutter-master/lib/demo/i18n/intl/ninghao_demo_messages_zh.dart b/FlutterHelper/ninghao_flutter-master/lib/demo/i18n/intl/ninghao_demo_messages_zh.dart new file mode 100644 index 00000000..29786aa9 --- /dev/null +++ b/FlutterHelper/ninghao_flutter-master/lib/demo/i18n/intl/ninghao_demo_messages_zh.dart @@ -0,0 +1,28 @@ +// DO NOT EDIT. This is code generated via package:intl/generate_localized.dart +// This is a library that provides messages for a zh locale. All the +// messages from the main program should be duplicated here with the same +// function name. + +import 'package:intl/intl.dart'; +import 'package:intl/message_lookup_by_library.dart'; + +// ignore: unnecessary_new +final messages = new MessageLookup(); + +// ignore: unused_element +final _keepAnalysisHappy = Intl.defaultLocale; + +// ignore: non_constant_identifier_names +typedef MessageIfAbsent(String message_str, List args); + +class MessageLookup extends MessageLookupByLibrary { + get localeName => 'zh'; + + static m0(name) => "您好 ${name}"; + + final messages = _notInlinedMessages(_notInlinedMessages); + static _notInlinedMessages(_) => { + "greet" : m0, + "title" : MessageLookupByLibrary.simpleMessage("您好") + }; +} diff --git a/FlutterHelper/ninghao_flutter-master/lib/demo/i18n/map/ninghao_demo_localizations.dart b/FlutterHelper/ninghao_flutter-master/lib/demo/i18n/map/ninghao_demo_localizations.dart new file mode 100644 index 00000000..3f5e75b3 --- /dev/null +++ b/FlutterHelper/ninghao_flutter-master/lib/demo/i18n/map/ninghao_demo_localizations.dart @@ -0,0 +1,49 @@ +import 'package:flutter/foundation.dart' show SynchronousFuture; +import 'package:flutter/material.dart'; + +class NinghaoDemoLocalizations { + final Locale locale; + + NinghaoDemoLocalizations(this.locale); + + static NinghaoDemoLocalizations of(BuildContext context) { + return Localizations.of( + context, + NinghaoDemoLocalizations + ); + } + + static Map> _localized = { + 'en': { + 'title': 'hello', + }, + 'zh': { + 'title': '您好', + } + }; + + String get title { + return _localized[locale.languageCode]['title']; + } +} + +class NinghaoDemoLocalizationsDelegate + extends LocalizationsDelegate { + NinghaoDemoLocalizationsDelegate(); + + @override + Future load(Locale locale) { + return SynchronousFuture( + NinghaoDemoLocalizations(locale)); + } + + @override + bool isSupported(Locale locale) { + return true; + } + + @override + bool shouldReload(LocalizationsDelegate old) { + return false; + } +} diff --git a/FlutterHelper/ninghao_flutter-master/lib/demo/layout_demo.dart b/FlutterHelper/ninghao_flutter-master/lib/demo/layout_demo.dart new file mode 100644 index 00000000..386e305f --- /dev/null +++ b/FlutterHelper/ninghao_flutter-master/lib/demo/layout_demo.dart @@ -0,0 +1,134 @@ +import 'package:flutter/material.dart'; + +class LayoutDemo extends StatelessWidget { + @override + Widget build(BuildContext context) { + return Container( + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + StackDemo(), + ], + ), + ); + } +} + +class ConstrainedBoxDemo extends StatelessWidget { + @override + Widget build(BuildContext context) { + return ConstrainedBox( + constraints: BoxConstraints( + minHeight: 200.0, + maxWidth: 200.0, + ), + child: Container( + color: Color.fromRGBO(3, 54, 255, 1.0), + ), + ); + } +} + +class AspectRatioDemo extends StatelessWidget { + @override + Widget build(BuildContext context) { + return AspectRatio( + aspectRatio: 16.0 / 9.0, + child: Container( + color: Color.fromRGBO(3, 54, 255, 1.0), + ), + ); + } +} + +class StackDemo extends StatelessWidget { + @override + Widget build(BuildContext context) { + return Stack( + alignment: Alignment.topLeft, + children: [ + SizedBox( + width: 200.0, + height: 300.0, + child: Container( + alignment: Alignment(0.0, -0.9), + decoration: BoxDecoration( + color: Color.fromRGBO(3, 54, 255, 1.0), + borderRadius: BorderRadius.circular(8.0), + ), + ), + ), + SizedBox( + height: 32.0, + ), + SizedBox( + width: 100.0, + height: 100.0, + child: Container( + decoration: BoxDecoration( + color: Color.fromRGBO(3, 54, 255, 1.0), + shape: BoxShape.circle, + gradient: RadialGradient(colors: [ + Color.fromRGBO(7, 102, 255, 1.0), + Color.fromRGBO(3, 54, 255, 1.0), + ]), + ), + child: Icon(Icons.brightness_2, color: Colors.white, size: 32.0), + ), + ), + Positioned( + right: 20.0, + top: 20.0, + child: Icon(Icons.ac_unit, color: Colors.white, size: 16.0), + ), + Positioned( + right: 40.0, + top: 60.0, + child: Icon(Icons.ac_unit, color: Colors.white, size: 18.0), + ), + Positioned( + right: 20.0, + top: 120.0, + child: Icon(Icons.ac_unit, color: Colors.white, size: 20.0), + ), + Positioned( + right: 70.0, + top: 180.0, + child: Icon(Icons.ac_unit, color: Colors.white, size: 16.0), + ), + Positioned( + right: 30.0, + top: 230.0, + child: Icon(Icons.ac_unit, color: Colors.white, size: 18.0), + ), + Positioned( + right: 90.0, + bottom: 20.0, + child: Icon(Icons.ac_unit, color: Colors.white, size: 16.0), + ), + Positioned( + right: 4.0, + bottom: -4.0, + child: Icon(Icons.ac_unit, color: Colors.white, size: 16.0), + ), + ], + ); + } +} + +class IconBadge extends StatelessWidget { + final IconData icon; + final double size; + + IconBadge(this.icon, {this.size = 32.0}); + + @override + Widget build(BuildContext context) { + return Container( + child: Icon(icon, size: size, color: Colors.white), + width: size + 60, + height: size + 60, + color: Color.fromRGBO(3, 54, 255, 1.0), + ); + } +} diff --git a/FlutterHelper/ninghao_flutter-master/lib/demo/listview_demo.dart b/FlutterHelper/ninghao_flutter-master/lib/demo/listview_demo.dart new file mode 100644 index 00000000..c353d923 --- /dev/null +++ b/FlutterHelper/ninghao_flutter-master/lib/demo/listview_demo.dart @@ -0,0 +1,57 @@ +import 'package:flutter/material.dart'; +import './post_show.dart'; +import '../model/post.dart'; + +class ListViewDemo extends StatelessWidget { + Widget _listItemBuilder(BuildContext context, int index) { + return Container( + color: Colors.white, + margin: EdgeInsets.all(8.0), + child: Stack( + children: [ + Column( + children: [ + AspectRatio( + aspectRatio: 16/9, + child: Image.network(posts[index].imageUrl, fit: BoxFit.cover), + ), + SizedBox(height: 16.0), + Text( + posts[index].title, + style: Theme.of(context).textTheme.title + ), + Text( + posts[index].author, + style: Theme.of(context).textTheme.subhead + ), + SizedBox(height: 16.0), + ], + ), + Positioned.fill( + child: Material( + color: Colors.transparent, + child: InkWell( + splashColor: Colors.white.withOpacity(0.3), + highlightColor: Colors.white.withOpacity(0.1), + onTap: () { + Navigator.of(context).push( + MaterialPageRoute(builder: (context) => PostShow(post: posts[index])) + ); + } + ), + ), + ), + ], + ), + ); + } + + @override + Widget build(BuildContext context) { + // TODO: implement build + return ListView.builder( + itemCount: posts.length, + itemBuilder: _listItemBuilder, + ); + } +} \ No newline at end of file diff --git a/FlutterHelper/ninghao_flutter-master/lib/demo/material_components.dart b/FlutterHelper/ninghao_flutter-master/lib/demo/material_components.dart new file mode 100644 index 00000000..e1515365 --- /dev/null +++ b/FlutterHelper/ninghao_flutter-master/lib/demo/material_components.dart @@ -0,0 +1,103 @@ +import 'package:flutter/material.dart'; +import './button_demo.dart'; +import './floating_action_button_demo.dart'; +import './popup_menu_button_demo.dart'; +import './form_demo.dart'; +import './checkbox_demo.dart'; +import './radio_demo.dart'; +import './switch_demo.dart'; +import './slider_demo.dart'; +import './datetime_demo.dart'; +import './simple_dialog_demo.dart'; +import './alert_dialog_demo.dart'; +import './bottom_sheet_demo.dart'; +import './snack_bar_demo.dart'; +import './expansion_panel_demo.dart'; +import './chip_demo.dart'; +import './data_table_demo.dart'; +import './paginated_data_table_demo.dart'; +import './card_demo.dart'; +import './stepper_demo.dart'; + +class MaterialComponents extends StatelessWidget { + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: AppBar( + title: Text('MaterialComponents'), + elevation: 0.0, + ), + body: ListView( + children: [ + ListItem(title: 'Stepper', page: StepperDemo()), + ListItem(title: 'Card', page: CardDemo()), + ListItem(title: 'PaginatedDataTable', page: PaginatedDataTableDemo()), + ListItem(title: 'DataTable', page: DataTableDemo()), + ListItem(title: 'Chip', page: ChipDemo()), + ListItem(title: 'ExpansionPanel', page: ExpansionPanelDemo()), + ListItem(title: 'SnackBar', page: SnackBarDemo()), + ListItem(title: 'BottomSheet', page: BottomSheetDemo()), + ListItem(title: 'AlertDialog', page: AlertDialogDemo()), + ListItem(title: 'SimpleDialog', page: SimpleDialogDemo()), + ListItem(title: 'Date & Time', page: DateTimeDemo()), + ListItem(title: 'Slider', page: SliderDemo()), + ListItem(title: 'Switch', page: SwitchDemo()), + ListItem(title: 'Radio', page: RadioDemo()), + ListItem(title: 'Checkbox', page: CheckboxDemo()), + ListItem(title: 'Form', page: FormDemo()), + ListItem(title: 'PopupMenuButton', page: PopupMenuButtonDemo()), + ListItem(title: 'Button', page: ButtonDemo()), + ListItem(title: 'FloatingActionButton', page: FloatingActionButtonDemo()), + ], + ), + ); + } +} + +class _WidgetDemo extends StatelessWidget { + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: AppBar( + title: Text('_WidgetDemo'), + elevation: 0.0, + ), + body: Container( + padding: EdgeInsets.all(16.0), + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + + ], + ), + ], + ), + ) + ); + } +} + +class ListItem extends StatelessWidget { + final String title; + final Widget page; + + ListItem({ + this.title, + this.page, + }); + + @override + Widget build(BuildContext context) { + return ListTile( + title: Text(title), + onTap: () { + Navigator.of(context).push( + MaterialPageRoute(builder: (context) => page), + ); + }, + ); + } +} \ No newline at end of file diff --git a/FlutterHelper/ninghao_flutter-master/lib/demo/navigator_demo.dart b/FlutterHelper/ninghao_flutter-master/lib/demo/navigator_demo.dart new file mode 100644 index 00000000..50a11323 --- /dev/null +++ b/FlutterHelper/ninghao_flutter-master/lib/demo/navigator_demo.dart @@ -0,0 +1,50 @@ +import 'package:flutter/material.dart'; + +class NavigatorDemo extends StatelessWidget { + @override + Widget build(BuildContext context) { + return Scaffold( + body: Center( + child: Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + FlatButton( + child: Text('Home'), + onPressed: null, + ), + FlatButton( + child: Text('About'), + onPressed: () { + Navigator.pushNamed(context, '/about'); + }, + ), + ], + ), + ), + ); + } +} + +class Page extends StatelessWidget { + final String title; + + Page({ + this.title + }); + + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: AppBar( + title: Text(title), + elevation: 0.0, + ), + floatingActionButton: FloatingActionButton( + child: Icon(Icons.arrow_back), + onPressed: () { + Navigator.pop(context); + }, + ), + ); + } +} \ No newline at end of file diff --git a/FlutterHelper/ninghao_flutter-master/lib/demo/paginated_data_table_demo.dart b/FlutterHelper/ninghao_flutter-master/lib/demo/paginated_data_table_demo.dart new file mode 100644 index 00000000..052ff125 --- /dev/null +++ b/FlutterHelper/ninghao_flutter-master/lib/demo/paginated_data_table_demo.dart @@ -0,0 +1,102 @@ +import 'package:flutter/material.dart'; +import '../model/post.dart'; + +class PostDataSource extends DataTableSource { + final List _posts = posts; + int _selectedCount = 0; + + @override + int get rowCount => _posts.length; + + @override + bool get isRowCountApproximate => false; + + @override + int get selectedRowCount => _selectedCount; + + @override + DataRow getRow(int index) { + final Post post = _posts[index]; + + return DataRow.byIndex( + index: index, + cells: [ + DataCell(Text(post.title)), + DataCell(Text(post.author)), + DataCell(Image.network(post.imageUrl)), + ], + ); + } + + void _sort(getField(post), bool ascending) { + _posts.sort((a, b) { + if (!ascending) { + final c = a; + a = b; + b = c; + } + + final aValue = getField(a); + final bValue = getField(b); + + return Comparable.compare(aValue, bValue); + }); + + notifyListeners(); + } +} + +class PaginatedDataTableDemo extends StatefulWidget { + @override + _PaginatedDataTableDemoState createState() => _PaginatedDataTableDemoState(); +} + +class _PaginatedDataTableDemoState extends State { + int _sortColumnIndex; + bool _sortAscending = true; + + final PostDataSource _postsDataSource = PostDataSource(); + + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: AppBar( + title: Text('PaginatedDataTableDemo'), + elevation: 0.0, + ), + body: Container( + padding: EdgeInsets.all(16.0), + child: ListView( + children: [ + PaginatedDataTable( + header: Text('Posts'), + rowsPerPage: 5, + source: _postsDataSource, + sortColumnIndex: _sortColumnIndex, + sortAscending: _sortAscending, + // onSelectAll: (bool value) {}, + columns: [ + DataColumn( + label: Text('Title'), + onSort: (int columnIndex, bool ascending) { + _postsDataSource._sort((post) => post.title.length, ascending); + + setState(() { + _sortColumnIndex = columnIndex; + _sortAscending = ascending; + }); + }, + ), + DataColumn( + label: Text('Author'), + ), + DataColumn( + label: Text('Image'), + ), + ], + ), + ], + ), + )); + } +} diff --git a/FlutterHelper/ninghao_flutter-master/lib/demo/popup_menu_button_demo.dart b/FlutterHelper/ninghao_flutter-master/lib/demo/popup_menu_button_demo.dart new file mode 100644 index 00000000..70e046a4 --- /dev/null +++ b/FlutterHelper/ninghao_flutter-master/lib/demo/popup_menu_button_demo.dart @@ -0,0 +1,56 @@ +import 'package:flutter/material.dart'; + +class PopupMenuButtonDemo extends StatefulWidget { + @override + _PopupMenuButtonDemoState createState() => _PopupMenuButtonDemoState(); +} + +class _PopupMenuButtonDemoState extends State { + String _currentMenuItem = 'Home'; + + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: AppBar( + title: Text('PopupMenuButtonDemo'), + elevation: 0.0, + ), + body: Container( + padding: EdgeInsets.all(16.0), + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Text(_currentMenuItem), + PopupMenuButton( + onSelected: (value) { + print(value); + setState(() { + _currentMenuItem = value; + }); + }, + itemBuilder: (BuildContext context) => [ + PopupMenuItem( + value: 'Home', + child: Text('Home'), + ), + PopupMenuItem( + value: 'Discover', + child: Text('Discover'), + ), + PopupMenuItem( + value: 'Community', + child: Text('Community'), + ), + ], + ), + ], + ), + ], + ), + ) + ); + } +} \ No newline at end of file diff --git a/FlutterHelper/ninghao_flutter-master/lib/demo/post_show.dart b/FlutterHelper/ninghao_flutter-master/lib/demo/post_show.dart new file mode 100644 index 00000000..ec4a90ce --- /dev/null +++ b/FlutterHelper/ninghao_flutter-master/lib/demo/post_show.dart @@ -0,0 +1,40 @@ +import 'package:flutter/material.dart'; +import '../model/post.dart'; + +class PostShow extends StatelessWidget { + final Post post; + + PostShow({ + @required this.post, + }); + + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: AppBar( + title: Text('${post.title}'), + elevation: 0.0, + ), + body: Column( + children: [ + Image.network( + post.imageUrl + ), + Container( + padding: EdgeInsets.all(32.0), + width: double.infinity, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text('${post.title}', style: Theme.of(context).textTheme.title), + Text('${post.author}', style: Theme.of(context).textTheme.subhead), + SizedBox(height: 32.0), + Text('${post.description}', style: Theme.of(context).textTheme.body1), + ], + ), + ), + ], + ), + ); + } +} \ No newline at end of file diff --git a/FlutterHelper/ninghao_flutter-master/lib/demo/radio_demo.dart b/FlutterHelper/ninghao_flutter-master/lib/demo/radio_demo.dart new file mode 100644 index 00000000..e082174c --- /dev/null +++ b/FlutterHelper/ninghao_flutter-master/lib/demo/radio_demo.dart @@ -0,0 +1,71 @@ +import 'package:flutter/material.dart'; + +class RadioDemo extends StatefulWidget { + @override + _RadioDemoState createState() => _RadioDemoState(); +} + +class _RadioDemoState extends State { + int _radioGroupA = 0; + + void _handleRadioValueChanged(int value) { + setState(() { + _radioGroupA = value; + }); + } + + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: AppBar( + title: Text('RadioDemo'), + elevation: 0.0, + ), + body: Container( + padding: EdgeInsets.all(16.0), + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Text('RadioGroupValue: $_radioGroupA'), + SizedBox(height: 32.0), + RadioListTile( + value: 0, + groupValue: _radioGroupA, + onChanged: _handleRadioValueChanged, + title: Text('Options A'), + subtitle: Text('Description'), + secondary: Icon(Icons.filter_1), + selected: _radioGroupA == 0, + ), + RadioListTile( + value: 1, + groupValue: _radioGroupA, + onChanged: _handleRadioValueChanged, + title: Text('Options B'), + subtitle: Text('Description'), + secondary: Icon(Icons.filter_2), + selected: _radioGroupA == 1, + ), + Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + // Radio( + // value: 0, + // groupValue: _radioGroupA, + // onChanged: _handleRadioValueChanged, + // activeColor: Colors.black, + // ), + // Radio( + // value: 1, + // groupValue: _radioGroupA, + // onChanged: _handleRadioValueChanged, + // activeColor: Colors.black, + // ), + ], + ), + ], + ), + ) + ); + } +} \ No newline at end of file diff --git a/FlutterHelper/ninghao_flutter-master/lib/demo/rxdart/rxdart_demo.dart b/FlutterHelper/ninghao_flutter-master/lib/demo/rxdart/rxdart_demo.dart new file mode 100644 index 00000000..d77ae91c --- /dev/null +++ b/FlutterHelper/ninghao_flutter-master/lib/demo/rxdart/rxdart_demo.dart @@ -0,0 +1,86 @@ +import 'package:flutter/material.dart'; +import 'package:rxdart/rxdart.dart'; +import 'dart:async'; + +class RxDartDemo extends StatelessWidget { + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: AppBar( + title: Text('RxDartDemo'), + elevation: 0.0, + ), + body: RxDartDemoHome(), + ); + } +} + +class RxDartDemoHome extends StatefulWidget { + @override + _RxDartDemoHomeState createState() => _RxDartDemoHomeState(); +} + +class _RxDartDemoHomeState extends State { + PublishSubject _textFieldSubject; + + @override + void initState() { + super.initState(); + + _textFieldSubject = PublishSubject(); + + _textFieldSubject + // .map((item) => 'item: $item') + // .where((item) => item.length > 9) + .debounce(Duration(milliseconds: 500)) + .listen((data) => print(data)); + + // Observable _observable = + // // Observable(Stream.fromIterable(['hello', '您好'])); + // // Observable.fromFuture(Future.value('hello ~')); + // // Observable.fromIterable(['hello', '您好']); + // // Observable.just('hello ~'); + // Observable.periodic(Duration(seconds: 3), (x) => x.toString()); + + // _observable.listen(print); + + // PublishSubject _subject = PublishSubject(); + // BehaviorSubject _subject = BehaviorSubject(); + // ReplaySubject _subject = ReplaySubject(maxSize: 2); + + // _subject.add('hello'); + // _subject.add('hola'); + // _subject.add('hi'); + // _subject.listen((data) => print('listen 1: $data')); + // _subject.listen((data) => print('listen 2: ${data.toUpperCase()}')); + + // _subject.close(); + } + + @override + void dispose() { + super.dispose(); + _textFieldSubject.close(); + } + + @override + Widget build(BuildContext context) { + return Theme( + data: Theme.of(context).copyWith( + primaryColor: Colors.black, + ), + child: TextField( + onChanged: (value) { + _textFieldSubject.add('input: $value'); + }, + onSubmitted: (value) { + _textFieldSubject.add('submit: $value'); + }, + decoration: InputDecoration( + labelText: 'Title', + filled: true, + ), + ), + ); + } +} diff --git a/FlutterHelper/ninghao_flutter-master/lib/demo/simple_dialog_demo.dart b/FlutterHelper/ninghao_flutter-master/lib/demo/simple_dialog_demo.dart new file mode 100644 index 00000000..c183f90e --- /dev/null +++ b/FlutterHelper/ninghao_flutter-master/lib/demo/simple_dialog_demo.dart @@ -0,0 +1,93 @@ +import 'package:flutter/material.dart'; +import 'dart:async'; + +enum Option { + A, B, C +} + +class SimpleDialogDemo extends StatefulWidget { + @override + _SimpleDialogDemoState createState() => _SimpleDialogDemoState(); +} + +class _SimpleDialogDemoState extends State { + String _choice = 'Nothing'; + + Future _openSimpleDialog() async { + final option = await showDialog( + context: context, + builder: (BuildContext context) { + return SimpleDialog( + title: Text('SimpleDialog'), + children: [ + SimpleDialogOption( + child: Text('Option A'), + onPressed: () { + Navigator.pop(context, Option.A); + }, + ), + SimpleDialogOption( + child: Text('Option B'), + onPressed: () { + Navigator.pop(context, Option.B); + }, + ), + SimpleDialogOption( + child: Text('Option C'), + onPressed: () { + Navigator.pop(context, Option.C); + }, + ), + ], + ); + } + ); + + switch (option) { + case Option.A: + setState(() { + _choice = 'A'; + }); + break; + case Option.B: + setState(() { + _choice = 'B'; + }); + break; + case Option.C: + setState(() { + _choice = 'C'; + }); + break; + default: + } + } + + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: AppBar( + title: Text('SimpleDialogDemo'), + elevation: 0.0, + ), + body: Container( + padding: EdgeInsets.all(16.0), + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Text('Your choice is: $_choice'), + Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + ], + ), + ], + ), + ), + floatingActionButton: FloatingActionButton( + child: Icon(Icons.format_list_numbered), + onPressed: _openSimpleDialog, + ), + ); + } +} \ No newline at end of file diff --git a/FlutterHelper/ninghao_flutter-master/lib/demo/slider_demo.dart b/FlutterHelper/ninghao_flutter-master/lib/demo/slider_demo.dart new file mode 100644 index 00000000..330706d2 --- /dev/null +++ b/FlutterHelper/ninghao_flutter-master/lib/demo/slider_demo.dart @@ -0,0 +1,49 @@ +import 'package:flutter/material.dart'; + +class SliderDemo extends StatefulWidget { + @override + _SliderDemoState createState() => _SliderDemoState(); +} + +class _SliderDemoState extends State { + double _sliderItemA = 0.0; + + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: AppBar( + title: Text('SliderDemo'), + elevation: 0.0, + ), + body: Container( + padding: EdgeInsets.all(16.0), + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Slider( + value: _sliderItemA, + onChanged: (value) { + setState(() { + _sliderItemA = value; + }); + }, + activeColor: Theme.of(context).accentColor, + inactiveColor: Theme.of(context).accentColor.withOpacity(0.3), + min: 0.0, + max: 10.0, + divisions: 10, + label: '${_sliderItemA.toInt()}', + ), + ], + ), + SizedBox(height: 16.0,), + Text('SliderValue: $_sliderItemA'), + ], + ), + ) + ); + } +} \ No newline at end of file diff --git a/FlutterHelper/ninghao_flutter-master/lib/demo/sliver_demo.dart b/FlutterHelper/ninghao_flutter-master/lib/demo/sliver_demo.dart new file mode 100644 index 00000000..cde1d0a2 --- /dev/null +++ b/FlutterHelper/ninghao_flutter-master/lib/demo/sliver_demo.dart @@ -0,0 +1,120 @@ +import 'package:flutter/material.dart'; +import '../model/post.dart'; + +class SliverDemo extends StatelessWidget { + @override + Widget build(BuildContext context) { + return Scaffold( + body: CustomScrollView( + slivers: [ + SliverAppBar( + // title: Text('NINGHAO'), + // pinned: true, + floating: true, + expandedHeight: 178.0, + flexibleSpace: FlexibleSpaceBar( + title: Text( + 'Ninghao Flutter'.toUpperCase(), + style: TextStyle( + fontSize: 15.0, + letterSpacing: 3.0, + fontWeight: FontWeight.w400, + ), + ), + background: Image.network( + 'https://resources.ninghao.net/images/overkill.png', + fit: BoxFit.cover, + ), + ), + ), + SliverSafeArea( + sliver: SliverPadding( + padding: EdgeInsets.all(8.0), + sliver: SliverGridDemo() + ), + ), + ], + ), + ); + } +} + +class SliverListDemo extends StatelessWidget { + @override + Widget build(BuildContext context) { + return SliverList( + delegate: SliverChildBuilderDelegate( + (BuildContext context, int index) { + return Padding( + padding: EdgeInsets.only(bottom: 32.0), + child: Material( + borderRadius: BorderRadius.circular(12.0), + elevation: 14.0, + shadowColor: Colors.grey.withOpacity(0.5), + child: Stack( + children: [ + AspectRatio( + aspectRatio: 16/9, + child: Image.network( + posts[index].imageUrl, + fit: BoxFit.cover, + ), + ), + Positioned( + top: 32.0, + left: 32.0, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + posts[index].title, + style: TextStyle( + fontSize: 20.0, + color: Colors.white + ), + ), + Text( + posts[index].author, + style: TextStyle( + fontSize: 13.0, + color: Colors.white + ), + ), + ], + ), + ), + ], + ), + ), + ); + }, + childCount: posts.length, + ), + ); + } +} + +class SliverGridDemo extends StatelessWidget { + @override + Widget build(BuildContext context) { + return SliverGrid( + gridDelegate: SliverGridDelegateWithFixedCrossAxisCount( + crossAxisCount: 2, + crossAxisSpacing: 8.0, + mainAxisSpacing: 8.0, + childAspectRatio: 1.0, + ), + delegate: SliverChildBuilderDelegate( + (BuildContext context, int index) { + return Container( + child: Image.network( + posts[index].imageUrl, + fit: BoxFit.cover, + ), + ); + }, + childCount: posts.length, + ), + ); + } +} diff --git a/FlutterHelper/ninghao_flutter-master/lib/demo/snack_bar_demo.dart b/FlutterHelper/ninghao_flutter-master/lib/demo/snack_bar_demo.dart new file mode 100644 index 00000000..408b605f --- /dev/null +++ b/FlutterHelper/ninghao_flutter-master/lib/demo/snack_bar_demo.dart @@ -0,0 +1,52 @@ +import 'package:flutter/material.dart'; + +class SnackBarDemo extends StatefulWidget { + @override + _SnackBarDemoState createState() => _SnackBarDemoState(); +} + +class _SnackBarDemoState extends State { + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: AppBar( + title: Text('SnackBarDemo'), + elevation: 0.0, + ), + body: Container( + padding: EdgeInsets.all(16.0), + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + SnackBarButton(), + ] + ), + ], + ), + ), + ); + } +} + +class SnackBarButton extends StatelessWidget { + @override + Widget build(BuildContext context) { + return FlatButton( + child: Text('Open SnackBar'), + onPressed: () { + Scaffold.of(context).showSnackBar( + SnackBar( + content: Text('Processing...'), + action: SnackBarAction( + label: 'OK', + onPressed: () {}, + ), + ) + ); + }, + ); + } +} \ No newline at end of file diff --git a/FlutterHelper/ninghao_flutter-master/lib/demo/state/state_management_demo.dart b/FlutterHelper/ninghao_flutter-master/lib/demo/state/state_management_demo.dart new file mode 100644 index 00000000..fd35aaf5 --- /dev/null +++ b/FlutterHelper/ninghao_flutter-master/lib/demo/state/state_management_demo.dart @@ -0,0 +1,76 @@ +import 'package:flutter/material.dart'; +import 'package:scoped_model/scoped_model.dart'; + +class StateManagementDemo extends StatelessWidget { + @override + Widget build(BuildContext context) { + return ScopedModel( + model: CounterModel(), + child: Scaffold( + appBar: AppBar( + title: Text('StateManagementDemo'), + elevation: 0.0, + ), + body: CounterWrapper(), + floatingActionButton: ScopedModelDescendant( + rebuildOnChange: false, + builder: (context, _, model) => FloatingActionButton( + child: Icon(Icons.add), + onPressed: model.increaseCount, + ), + ), + ), + ); + } +} + +class CounterWrapper extends StatelessWidget { + @override + Widget build(BuildContext context) { + return Center( + child: Counter(), + ); + } +} + +class Counter extends StatelessWidget { + @override + Widget build(BuildContext context) { + return ScopedModelDescendant( + builder: (context, _, model) => ActionChip( + label: Text('${model.count}'), + onPressed: model.increaseCount, + ), + ); + } +} + +class CounterProvider extends InheritedWidget { + final int count; + final VoidCallback increaseCount; + final Widget child; + + CounterProvider({ + this.count, + this.increaseCount, + this.child, + }) : super(child: child); + + static CounterProvider of(BuildContext context) => + context.inheritFromWidgetOfExactType(CounterProvider); + + @override + bool updateShouldNotify(InheritedWidget oldWidget) { + return true; + } +} + +class CounterModel extends Model { + int _count = 0; + int get count => _count; + + void increaseCount() { + _count += 1; + notifyListeners(); + } +} diff --git a/FlutterHelper/ninghao_flutter-master/lib/demo/stepper_demo.dart b/FlutterHelper/ninghao_flutter-master/lib/demo/stepper_demo.dart new file mode 100644 index 00000000..0593211b --- /dev/null +++ b/FlutterHelper/ninghao_flutter-master/lib/demo/stepper_demo.dart @@ -0,0 +1,71 @@ +import 'package:flutter/material.dart'; + +class StepperDemo extends StatefulWidget { + @override + _StepperDemoState createState() => _StepperDemoState(); +} + +class _StepperDemoState extends State { + int _currentStep = 0; + + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: AppBar( + title: Text('StepperDemo'), + elevation: 0.0, + ), + body: Container( + padding: EdgeInsets.all(16.0), + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Theme( + data: Theme.of(context).copyWith( + primaryColor: Colors.black, + ), + child: Stepper( + currentStep: _currentStep, + onStepTapped: (int value) { + setState(() { + _currentStep = value; + }); + }, + onStepContinue: () { + setState(() { + _currentStep < 2 ? _currentStep += 1 : _currentStep = 0; + }); + }, + onStepCancel: () { + setState(() { + _currentStep > 0 ? _currentStep -= 1 : _currentStep = 0; + }); + }, + steps: [ + Step( + title: Text('Login'), + subtitle: Text('Login first'), + content: Text('Magna exercitation duis non sint eu nostrud.'), + isActive: _currentStep == 0, + ), + Step( + title: Text('Choose Plan'), + subtitle: Text('Choose you plan.'), + content: Text('Magna exercitation duis non sint eu nostrud.'), + isActive: _currentStep == 1, + ), + Step( + title: Text('Confirm payment'), + subtitle: Text('Confirm your payment method.'), + content: Text('Magna exercitation duis non sint eu nostrud.'), + isActive: _currentStep == 2, + ), + ], + ), + ), + ], + ), + ) + ); + } +} \ No newline at end of file diff --git a/FlutterHelper/ninghao_flutter-master/lib/demo/stream/stream_demo.dart b/FlutterHelper/ninghao_flutter-master/lib/demo/stream/stream_demo.dart new file mode 100644 index 00000000..e4aa66e7 --- /dev/null +++ b/FlutterHelper/ninghao_flutter-master/lib/demo/stream/stream_demo.dart @@ -0,0 +1,142 @@ +import 'dart:async'; + +import 'package:flutter/material.dart'; + +class StreamDemo extends StatelessWidget { + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: AppBar( + title: Text('StreamDemo'), + elevation: 0.0, + ), + body: StreamDemoHome(), + ); + } +} + +class StreamDemoHome extends StatefulWidget { + @override + _StreamDemoHomeState createState() => _StreamDemoHomeState(); +} + +class _StreamDemoHomeState extends State { + StreamSubscription _streamDemoSubscription; + StreamController _streamDemo; + StreamSink _sinkDemo; + String _data = '...'; + + @override + void dispose() { + _streamDemo.close(); + super.dispose(); + } + + @override + void initState() { + super.initState(); + + print('Create a stream.'); + // Stream _streamDemo = Stream.fromFuture(fetchData()); + _streamDemo = StreamController.broadcast(); + _sinkDemo = _streamDemo.sink; + + print('Start listening on a stream.'); + _streamDemoSubscription = + _streamDemo.stream.listen(onData, onError: onError, onDone: onDone); + + _streamDemo.stream.listen(onDataTwo, onError: onError, onDone: onDone); + + print('Initialize completed.'); + } + + void onDone() { + print('Done!'); + } + + void onError(error) { + print('Error: $error'); + } + + void onData(String data) { + setState(() { + _data = data; + }); + print('$data'); + } + + void onDataTwo(String data) { + print('onDataTwo: $data'); + } + + void _pauseStream() { + print('Pause subscription'); + _streamDemoSubscription.pause(); + } + + void _resumeStream() { + print('Resume subscription'); + _streamDemoSubscription.resume(); + } + + void _cancelStream() { + print('Cancel subscription'); + _streamDemoSubscription.cancel(); + } + + void _addDataToStream() async { + print('Add data to stream.'); + + String data = await fetchData(); + // _streamDemo.add(data); + _sinkDemo.add(data); + } + + Future fetchData() async { + await Future.delayed(Duration(seconds: 5)); + // throw 'Something happened'; + return 'hello ~'; + } + + @override + Widget build(BuildContext context) { + return Container( + child: Center( + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + // Text(_data), + StreamBuilder( + stream: _streamDemo.stream, + initialData: '...', + builder: (context, snapshot) { + return Text('${snapshot.data}'); + }, + ), + Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + FlatButton( + child: Text('Add'), + onPressed: _addDataToStream, + ), + FlatButton( + child: Text('Pause'), + onPressed: _pauseStream, + ), + FlatButton( + child: Text('Resume'), + onPressed: _resumeStream, + ), + FlatButton( + child: Text('Cancel'), + onPressed: _cancelStream, + ), + ], + ), + ], + ), + ), + ); + } +} diff --git a/FlutterHelper/ninghao_flutter-master/lib/demo/switch_demo.dart b/FlutterHelper/ninghao_flutter-master/lib/demo/switch_demo.dart new file mode 100644 index 00000000..40408f9f --- /dev/null +++ b/FlutterHelper/ninghao_flutter-master/lib/demo/switch_demo.dart @@ -0,0 +1,54 @@ +import 'package:flutter/material.dart'; + +class SwitchDemo extends StatefulWidget { + @override + _SwitchDemoState createState() => _SwitchDemoState(); +} + +class _SwitchDemoState extends State { + bool _switchItemA = false; + + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: AppBar( + title: Text('SwitchDemo'), + elevation: 0.0, + ), + body: Container( + padding: EdgeInsets.all(16.0), + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + SwitchListTile( + value: _switchItemA, + onChanged: (value) { + setState(() { + _switchItemA = value; + }); + }, + title: Text('Switch Item A'), + subtitle: Text('Description'), + secondary: Icon(_switchItemA ? Icons.visibility : Icons.visibility_off), + selected: _switchItemA, + ), + Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + // Text(_switchItemA ? '😁' : '😐', style: TextStyle(fontSize: 32.0),), + // Switch( + // value: _switchItemA, + // onChanged: (value) { + // setState(() { + // _switchItemA = value; + // }); + // }, + // ), + ], + ), + ], + ), + ) + ); + } +} \ No newline at end of file diff --git a/FlutterHelper/ninghao_flutter-master/lib/demo/test/test_demo.dart b/FlutterHelper/ninghao_flutter-master/lib/demo/test/test_demo.dart new file mode 100644 index 00000000..fa0921f6 --- /dev/null +++ b/FlutterHelper/ninghao_flutter-master/lib/demo/test/test_demo.dart @@ -0,0 +1,49 @@ +import 'package:flutter/material.dart'; + +class TestDemo extends StatelessWidget { + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: AppBar( + title: Text('TestDemo'), + elevation: 0.0, + ), + body: TestDemoHome(), + ); + } +} + +class TestDemoHome extends StatefulWidget { + @override + _TestDemoHomeState createState() => _TestDemoHomeState(); +} + +class _TestDemoHomeState extends State { + int count = 0; + + @override + Widget build(BuildContext context) { + return Row( + children: [ + Chip( + label: Text('hello'), + ), + ActionChip( + key: Key('actionChip'), + label: Text('$count', key: Key('actionChipLabelText')), + onPressed: () { + setState(() { + count++; + }); + }, + ) + ], + ); + } +} + +class NinghaoTestDemo { + static greet(String name) { + return 'hello $name ~~'; + } +} \ No newline at end of file diff --git a/FlutterHelper/ninghao_flutter-master/lib/demo/view_demo.dart b/FlutterHelper/ninghao_flutter-master/lib/demo/view_demo.dart new file mode 100644 index 00000000..27f2d794 --- /dev/null +++ b/FlutterHelper/ninghao_flutter-master/lib/demo/view_demo.dart @@ -0,0 +1,154 @@ +import 'package:flutter/material.dart'; +import '../model/post.dart'; + +class ViewDemo extends StatelessWidget { + @override + Widget build(BuildContext context) { + return GridViewBuilderDemo(); + } +} + +class GridViewBuilderDemo extends StatelessWidget { + Widget _gridItemBuilder(BuildContext context, int index) { + return Container( + child: Image.network( + posts[index].imageUrl, + fit: BoxFit.cover + ), + ); + } + + @override + Widget build(BuildContext context) { + return GridView.builder( + padding: EdgeInsets.all(8.0), + itemCount: posts.length, + itemBuilder: _gridItemBuilder, + gridDelegate: SliverGridDelegateWithMaxCrossAxisExtent( + // crossAxisCount: 3, + maxCrossAxisExtent: 150.0, + crossAxisSpacing: 8.0, + mainAxisSpacing: 8.0, + ), + ); + } +} + +class GridViewExtentDemo extends StatelessWidget { + List _buildTiles(int length) { + return List.generate(length, (int index) { + return Container( + color: Colors.grey[300], + alignment: Alignment(0.0, 0.0), + child: Text('Item $index', + style: TextStyle(fontSize: 18.0, color: Colors.grey)), + ); + }); + } + + @override + Widget build(BuildContext context) { + return GridView.extent( + maxCrossAxisExtent: 150.0, + crossAxisSpacing: 16.0, + mainAxisSpacing: 16.0, + // scrollDirection: Axis.horizontal, + children: _buildTiles(100), + ); + } +} + +class GridViewCountDemo extends StatelessWidget { + List _buildTiles(int length) { + return List.generate(length, (int index) { + return Container( + color: Colors.grey[300], + alignment: Alignment(0.0, 0.0), + child: Text('Item $index', + style: TextStyle(fontSize: 18.0, color: Colors.grey)), + ); + }); + } + + @override + Widget build(BuildContext context) { + return GridView.count( + crossAxisCount: 3, + crossAxisSpacing: 16.0, + mainAxisSpacing: 16.0, + scrollDirection: Axis.horizontal, + children: _buildTiles(100), + ); + } +} + +class PageViewBuilderDemo extends StatelessWidget { + Widget _pageItemBuilder(BuildContext context, int index) { + return Stack( + children: [ + SizedBox.expand( + child: Image.network(posts[index].imageUrl, fit: BoxFit.cover), + ), + Positioned( + bottom: 8.0, + left: 8.0, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text(posts[index].title, + style: TextStyle(fontWeight: FontWeight.bold)), + Text(posts[index].author), + ], + ), + ), + ], + ); + } + + @override + Widget build(BuildContext context) { + // TODO: implement build + return PageView.builder( + itemCount: posts.length, + itemBuilder: _pageItemBuilder, + ); + } +} + +class PageViewDemo extends StatelessWidget { + @override + Widget build(BuildContext context) { + // TODO: implement build + return PageView( + // pageSnapping: false, + // reverse: true, + scrollDirection: Axis.vertical, + onPageChanged: (currentPage) => debugPrint('Page: $currentPage'), + controller: PageController( + initialPage: 1, + keepPage: false, + viewportFraction: 0.85, + ), + children: [ + Container( + color: Colors.brown[900], + alignment: Alignment(0.0, 0.0), + child: Text('ONE', + style: TextStyle(fontSize: 32.0, color: Colors.white)), + ), + Container( + color: Colors.grey[900], + alignment: Alignment(0.0, 0.0), + child: Text('TWO', + style: TextStyle(fontSize: 32.0, color: Colors.white)), + ), + Container( + color: Colors.blueGrey[900], + alignment: Alignment(0.0, 0.0), + child: Text('THREE', + style: TextStyle(fontSize: 32.0, color: Colors.white)), + ), + ], + ); + } +} diff --git a/FlutterHelper/ninghao_flutter-master/lib/main.dart b/FlutterHelper/ninghao_flutter-master/lib/main.dart new file mode 100644 index 00000000..be738d5b --- /dev/null +++ b/FlutterHelper/ninghao_flutter-master/lib/main.dart @@ -0,0 +1,116 @@ +import 'package:flutter/material.dart'; +import 'package:ninghao_flutter/demo/animation/animation_demo.dart'; +import 'package:ninghao_flutter/demo/bloc/bloc_demo.dart'; +import 'package:ninghao_flutter/demo/http/http_demo.dart'; +import 'package:ninghao_flutter/demo/i18n/i18n_demo.dart'; +import 'package:ninghao_flutter/demo/rxdart/rxdart_demo.dart'; +import 'package:ninghao_flutter/demo/state/state_management_demo.dart'; +import 'package:ninghao_flutter/demo/stream/stream_demo.dart'; +import 'package:ninghao_flutter/demo/test/test_demo.dart'; +import './demo/drawer_demo.dart'; +import './demo/bottom_navigation_bar_demo.dart'; +import './demo/listview_demo.dart'; +import './demo/basic_demo.dart'; +import './demo/layout_demo.dart'; +import './demo/view_demo.dart'; +import './demo/sliver_demo.dart'; +import './demo/navigator_demo.dart'; +import './demo/form_demo.dart'; +import './demo/material_components.dart'; +import 'package:flutter_localizations/flutter_localizations.dart'; +// import 'package:ninghao_flutter/demo/i18n/map/ninghao_demo_localizations.dart'; +import 'package:ninghao_flutter/demo/i18n/intl/ninghao_demo_localizations.dart'; + +void main() => runApp(App()); + +class App extends StatelessWidget { + @override + Widget build(BuildContext context) { + return MaterialApp( + locale: Locale('en', 'US'), + // locale: Locale('zh', 'CN'), + // localeResolutionCallback: (Locale locale, Iterable supportedLocales) { + // return Locale('en', 'US'); + // }, + localizationsDelegates: [ + NinghaoDemoLocalizationsDelegate(), + GlobalMaterialLocalizations.delegate, + GlobalWidgetsLocalizations.delegate, + ], + supportedLocales: [ + Locale('en', 'US'), + Locale('zh', 'CN'), + ], + debugShowCheckedModeBanner: false, + // home: NavigatorDemo(), + initialRoute: '/test', + routes: { + '/': (context) => Home(), + '/about': (context) => Page(title: 'About'), + '/form': (context) => FormDemo(), + '/mdc': (context) => MaterialComponents(), + '/state-management': (context) => StateManagementDemo(), + '/stream': (context) => StreamDemo(), + '/rxdart': (context) => RxDartDemo(), + '/bloc': (context) => BlocDemo(), + '/http': (context) => HttpDemo(), + '/animation': (context) => AnimationDemo(), + '/i18n': (context) => I18nDemo(), + '/test': (context) => TestDemo(), + }, + theme: ThemeData( + primarySwatch: Colors.yellow, + highlightColor: Color.fromRGBO(255, 255, 255, 0.5), + splashColor: Colors.white70, + accentColor: Color.fromRGBO(3, 54, 255, 1.0), + ) + ); + } +} + +class Home extends StatelessWidget { + @override + Widget build(BuildContext context) { + return DefaultTabController( + length: 4, + child: Scaffold( + backgroundColor: Colors.grey[100], + appBar: AppBar( + title: Text('NINGHAO'), + actions: [ + IconButton( + icon: Icon(Icons.search), + tooltip: 'Search', + onPressed: () => debugPrint('Search button is pressed.'), + ) + ], + elevation: 0.0, + bottom: TabBar( + unselectedLabelColor: Colors.black38, + indicatorColor: Colors.black54, + indicatorSize: TabBarIndicatorSize.label, + indicatorWeight: 1.0, + tabs: [ + Tab(icon: Icon(Icons.local_florist)), + Tab(icon: Icon(Icons.change_history)), + Tab(icon: Icon(Icons.directions_bike)), + Tab(icon: Icon(Icons.view_quilt)), + ], + ), + ), + body: TabBarView( + children: [ + ListViewDemo(), + // Icon(Icons.change_history, size: 128.0, color: Colors.black12), + BasicDemo(), + // Icon(Icons.directions_bike, size: 128.0, color: Colors.black12), + LayoutDemo(), + SliverDemo(), + ], + ), + drawer: DrawerDemo(), + bottomNavigationBar: BottomNavigationBarDemo(), + ), + ); + } +} diff --git a/FlutterHelper/ninghao_flutter-master/lib/model/post.dart b/FlutterHelper/ninghao_flutter-master/lib/model/post.dart new file mode 100644 index 00000000..2187663b --- /dev/null +++ b/FlutterHelper/ninghao_flutter-master/lib/model/post.dart @@ -0,0 +1,108 @@ +class Post { + Post({ + this.title, + this.author, + this.imageUrl, + this.description, + }); + + final String title; + final String author; + final String imageUrl; + final String description; + + bool selected = false; +} + +final List posts = [ + Post( + title: 'Candy Shop', + author: 'Mohamed Chahin', + description: 'Esse ut nulla velit reprehenderit veniam sint nostrud nulla exercitation ipsum. Officia deserunt aliquip aliquip excepteur eiusmod dolor. Elit amet ipsum labore sint occaecat dolore tempor officia irure voluptate ad. Veniam laboris deserunt aute excepteur sit deserunt dolor esse dolor velit sint nulla anim ut. Reprehenderit voluptate adipisicing culpa magna ea nulla ullamco consectetur. Cupidatat adipisicing consequat adipisicing sit consectetur dolor occaecat.', + imageUrl: 'https://resources.ninghao.org/images/candy-shop.jpg', + ), + Post( + title: 'Childhood in a picture', + author: 'Mohamed Chahin', + description: 'Esse ut nulla velit reprehenderit veniam sint nostrud nulla exercitation ipsum. Officia deserunt aliquip aliquip excepteur eiusmod dolor. Elit amet ipsum labore sint occaecat dolore tempor officia irure voluptate ad. Veniam laboris deserunt aute excepteur sit deserunt dolor esse dolor velit sint nulla anim ut. Reprehenderit voluptate adipisicing culpa magna ea nulla ullamco consectetur. Cupidatat adipisicing consequat adipisicing sit consectetur dolor occaecat.', + imageUrl: 'https://resources.ninghao.org/images/childhood-in-a-picture.jpg', + ), + Post( + title: 'Contained', + author: 'Mohamed Chahin', + description: 'Esse ut nulla velit reprehenderit veniam sint nostrud nulla exercitation ipsum. Officia deserunt aliquip aliquip excepteur eiusmod dolor. Elit amet ipsum labore sint occaecat dolore tempor officia irure voluptate ad. Veniam laboris deserunt aute excepteur sit deserunt dolor esse dolor velit sint nulla anim ut. Reprehenderit voluptate adipisicing culpa magna ea nulla ullamco consectetur. Cupidatat adipisicing consequat adipisicing sit consectetur dolor occaecat.', + imageUrl: 'https://resources.ninghao.org/images/contained.jpg', + ), + Post( + title: 'Dragon', + author: 'Mohamed Chahin', + description: 'Esse ut nulla velit reprehenderit veniam sint nostrud nulla exercitation ipsum. Officia deserunt aliquip aliquip excepteur eiusmod dolor. Elit amet ipsum labore sint occaecat dolore tempor officia irure voluptate ad. Veniam laboris deserunt aute excepteur sit deserunt dolor esse dolor velit sint nulla anim ut. Reprehenderit voluptate adipisicing culpa magna ea nulla ullamco consectetur. Cupidatat adipisicing consequat adipisicing sit consectetur dolor occaecat.', + imageUrl: 'https://resources.ninghao.org/images/dragon.jpg', + ), + Post( + title: 'Free Hugs', + author: 'Mohamed Chahin', + description: 'Esse ut nulla velit reprehenderit veniam sint nostrud nulla exercitation ipsum. Officia deserunt aliquip aliquip excepteur eiusmod dolor. Elit amet ipsum labore sint occaecat dolore tempor officia irure voluptate ad. Veniam laboris deserunt aute excepteur sit deserunt dolor esse dolor velit sint nulla anim ut. Reprehenderit voluptate adipisicing culpa magna ea nulla ullamco consectetur. Cupidatat adipisicing consequat adipisicing sit consectetur dolor occaecat.', + imageUrl: 'https://resources.ninghao.org/images/free_hugs.jpg', + ), + Post( + title: 'Gravity Falls', + author: 'Mohamed Chahin', + description: 'Esse ut nulla velit reprehenderit veniam sint nostrud nulla exercitation ipsum. Officia deserunt aliquip aliquip excepteur eiusmod dolor. Elit amet ipsum labore sint occaecat dolore tempor officia irure voluptate ad. Veniam laboris deserunt aute excepteur sit deserunt dolor esse dolor velit sint nulla anim ut. Reprehenderit voluptate adipisicing culpa magna ea nulla ullamco consectetur. Cupidatat adipisicing consequat adipisicing sit consectetur dolor occaecat.', + imageUrl: 'https://resources.ninghao.org/images/gravity-falls.png', + ), + Post( + title: 'Icecream Truck', + author: 'Mohamed Chahin', + description: 'Esse ut nulla velit reprehenderit veniam sint nostrud nulla exercitation ipsum. Officia deserunt aliquip aliquip excepteur eiusmod dolor. Elit amet ipsum labore sint occaecat dolore tempor officia irure voluptate ad. Veniam laboris deserunt aute excepteur sit deserunt dolor esse dolor velit sint nulla anim ut. Reprehenderit voluptate adipisicing culpa magna ea nulla ullamco consectetur. Cupidatat adipisicing consequat adipisicing sit consectetur dolor occaecat.', + imageUrl: 'https://resources.ninghao.org/images/icecreamtruck.png', + ), + Post( + title: 'keyclack', + author: 'Mohamed Chahin', + description: 'Esse ut nulla velit reprehenderit veniam sint nostrud nulla exercitation ipsum. Officia deserunt aliquip aliquip excepteur eiusmod dolor. Elit amet ipsum labore sint occaecat dolore tempor officia irure voluptate ad. Veniam laboris deserunt aute excepteur sit deserunt dolor esse dolor velit sint nulla anim ut. Reprehenderit voluptate adipisicing culpa magna ea nulla ullamco consectetur. Cupidatat adipisicing consequat adipisicing sit consectetur dolor occaecat.', + imageUrl: 'https://resources.ninghao.org/images/keyclack.jpg', + ), + Post( + title: 'Overkill', + author: 'Mohamed Chahin', + description: 'Esse ut nulla velit reprehenderit veniam sint nostrud nulla exercitation ipsum. Officia deserunt aliquip aliquip excepteur eiusmod dolor. Elit amet ipsum labore sint occaecat dolore tempor officia irure voluptate ad. Veniam laboris deserunt aute excepteur sit deserunt dolor esse dolor velit sint nulla anim ut. Reprehenderit voluptate adipisicing culpa magna ea nulla ullamco consectetur. Cupidatat adipisicing consequat adipisicing sit consectetur dolor occaecat.', + imageUrl: 'https://resources.ninghao.org/images/overkill.png', + ), + Post( + title: 'Say Hello to Barry', + author: 'Mohamed Chahin', + description: 'Esse ut nulla velit reprehenderit veniam sint nostrud nulla exercitation ipsum. Officia deserunt aliquip aliquip excepteur eiusmod dolor. Elit amet ipsum labore sint occaecat dolore tempor officia irure voluptate ad. Veniam laboris deserunt aute excepteur sit deserunt dolor esse dolor velit sint nulla anim ut. Reprehenderit voluptate adipisicing culpa magna ea nulla ullamco consectetur. Cupidatat adipisicing consequat adipisicing sit consectetur dolor occaecat.', + imageUrl: 'https://resources.ninghao.org/images/say-hello-to-barry.jpg', + ), + Post( + title: 'Space Skull', + author: 'Mohamed Chahin', + description: 'Esse ut nulla velit reprehenderit veniam sint nostrud nulla exercitation ipsum. Officia deserunt aliquip aliquip excepteur eiusmod dolor. Elit amet ipsum labore sint occaecat dolore tempor officia irure voluptate ad. Veniam laboris deserunt aute excepteur sit deserunt dolor esse dolor velit sint nulla anim ut. Reprehenderit voluptate adipisicing culpa magna ea nulla ullamco consectetur. Cupidatat adipisicing consequat adipisicing sit consectetur dolor occaecat.', + imageUrl: 'https://resources.ninghao.org/images/space-skull.jpg', + ), + Post( + title: 'The Old Fashioned', + author: 'Mohamed Chahin', + description: 'Esse ut nulla velit reprehenderit veniam sint nostrud nulla exercitation ipsum. Officia deserunt aliquip aliquip excepteur eiusmod dolor. Elit amet ipsum labore sint occaecat dolore tempor officia irure voluptate ad. Veniam laboris deserunt aute excepteur sit deserunt dolor esse dolor velit sint nulla anim ut. Reprehenderit voluptate adipisicing culpa magna ea nulla ullamco consectetur. Cupidatat adipisicing consequat adipisicing sit consectetur dolor occaecat.', + imageUrl: 'https://resources.ninghao.org/images/the-old-fashioned.png', + ), + Post( + title: 'Tornado', + author: 'Mohamed Chahin', + description: 'Esse ut nulla velit reprehenderit veniam sint nostrud nulla exercitation ipsum. Officia deserunt aliquip aliquip excepteur eiusmod dolor. Elit amet ipsum labore sint occaecat dolore tempor officia irure voluptate ad. Veniam laboris deserunt aute excepteur sit deserunt dolor esse dolor velit sint nulla anim ut. Reprehenderit voluptate adipisicing culpa magna ea nulla ullamco consectetur. Cupidatat adipisicing consequat adipisicing sit consectetur dolor occaecat.', + imageUrl: 'https://resources.ninghao.org/images/tornado.jpg', + ), + Post( + title: 'Undo', + author: 'Mohamed Chahin', + description: 'Esse ut nulla velit reprehenderit veniam sint nostrud nulla exercitation ipsum. Officia deserunt aliquip aliquip excepteur eiusmod dolor. Elit amet ipsum labore sint occaecat dolore tempor officia irure voluptate ad. Veniam laboris deserunt aute excepteur sit deserunt dolor esse dolor velit sint nulla anim ut. Reprehenderit voluptate adipisicing culpa magna ea nulla ullamco consectetur. Cupidatat adipisicing consequat adipisicing sit consectetur dolor occaecat.', + imageUrl: 'https://resources.ninghao.org/images/undo.jpg', + ), + Post( + title: 'White Dragon', + author: 'Mohamed Chahin', + description: 'Esse ut nulla velit reprehenderit veniam sint nostrud nulla exercitation ipsum. Officia deserunt aliquip aliquip excepteur eiusmod dolor. Elit amet ipsum labore sint occaecat dolore tempor officia irure voluptate ad. Veniam laboris deserunt aute excepteur sit deserunt dolor esse dolor velit sint nulla anim ut. Reprehenderit voluptate adipisicing culpa magna ea nulla ullamco consectetur. Cupidatat adipisicing consequat adipisicing sit consectetur dolor occaecat.', + imageUrl: 'https://resources.ninghao.org/images/white-dragon.jpg', + ) +]; \ No newline at end of file diff --git a/FlutterHelper/ninghao_flutter-master/pubspec.lock b/FlutterHelper/ninghao_flutter-master/pubspec.lock new file mode 100644 index 00000000..46e7a78f --- /dev/null +++ b/FlutterHelper/ninghao_flutter-master/pubspec.lock @@ -0,0 +1,247 @@ +# Generated by pub +# See https://dart.dev/tools/pub/glossary#lockfile +packages: + archive: + dependency: transitive + description: + name: archive + url: "https://pub.flutter-io.cn" + source: hosted + version: "3.1.2" + async: + dependency: transitive + description: + name: async + url: "https://pub.flutter-io.cn" + source: hosted + version: "2.6.1" + boolean_selector: + dependency: transitive + description: + name: boolean_selector + url: "https://pub.flutter-io.cn" + source: hosted + version: "2.1.0" + characters: + dependency: transitive + description: + name: characters + url: "https://pub.flutter-io.cn" + source: hosted + version: "1.1.0" + charcode: + dependency: transitive + description: + name: charcode + url: "https://pub.flutter-io.cn" + source: hosted + version: "1.2.0" + clock: + dependency: transitive + description: + name: clock + url: "https://pub.flutter-io.cn" + source: hosted + version: "1.1.0" + collection: + dependency: transitive + description: + name: collection + url: "https://pub.flutter-io.cn" + source: hosted + version: "1.15.0" + crypto: + dependency: transitive + description: + name: crypto + url: "https://pub.flutter-io.cn" + source: hosted + version: "3.0.1" + cupertino_icons: + dependency: "direct main" + description: + name: cupertino_icons + url: "https://pub.flutter-io.cn" + source: hosted + version: "0.1.2" + fake_async: + dependency: transitive + description: + name: fake_async + url: "https://pub.flutter-io.cn" + source: hosted + version: "1.2.0" + file: + dependency: transitive + description: + name: file + url: "https://pub.flutter-io.cn" + source: hosted + version: "6.1.0" + flutter: + dependency: "direct main" + description: flutter + source: sdk + version: "0.0.0" + flutter_driver: + dependency: "direct dev" + description: flutter + source: sdk + version: "0.0.0" + flutter_test: + dependency: "direct dev" + description: flutter + source: sdk + version: "0.0.0" + fuchsia_remote_debug_protocol: + dependency: transitive + description: flutter + source: sdk + version: "0.0.0" + http: + dependency: "direct main" + description: + name: http + url: "https://pub.flutter-io.cn" + source: hosted + version: "0.12.0" + http_parser: + dependency: transitive + description: + name: http_parser + url: "https://pub.flutter-io.cn" + source: hosted + version: "3.1.3" + matcher: + dependency: transitive + description: + name: matcher + url: "https://pub.flutter-io.cn" + source: hosted + version: "0.12.10" + meta: + dependency: transitive + description: + name: meta + url: "https://pub.flutter-io.cn" + source: hosted + version: "1.3.0" + path: + dependency: transitive + description: + name: path + url: "https://pub.flutter-io.cn" + source: hosted + version: "1.8.0" + platform: + dependency: transitive + description: + name: platform + url: "https://pub.flutter-io.cn" + source: hosted + version: "3.0.0" + process: + dependency: transitive + description: + name: process + url: "https://pub.flutter-io.cn" + source: hosted + version: "4.2.1" + rxdart: + dependency: "direct main" + description: + name: rxdart + url: "https://pub.flutter-io.cn" + source: hosted + version: "0.18.1" + scoped_model: + dependency: "direct main" + description: + name: scoped_model + url: "https://pub.flutter-io.cn" + source: hosted + version: "0.3.0" + sky_engine: + dependency: transitive + description: flutter + source: sdk + version: "0.0.99" + source_span: + dependency: transitive + description: + name: source_span + url: "https://pub.flutter-io.cn" + source: hosted + version: "1.8.1" + stack_trace: + dependency: transitive + description: + name: stack_trace + url: "https://pub.flutter-io.cn" + source: hosted + version: "1.10.0" + stream_channel: + dependency: transitive + description: + name: stream_channel + url: "https://pub.flutter-io.cn" + source: hosted + version: "2.1.0" + string_scanner: + dependency: transitive + description: + name: string_scanner + url: "https://pub.flutter-io.cn" + source: hosted + version: "1.1.0" + sync_http: + dependency: transitive + description: + name: sync_http + url: "https://pub.flutter-io.cn" + source: hosted + version: "0.3.0" + term_glyph: + dependency: transitive + description: + name: term_glyph + url: "https://pub.flutter-io.cn" + source: hosted + version: "1.2.0" + test_api: + dependency: transitive + description: + name: test_api + url: "https://pub.flutter-io.cn" + source: hosted + version: "0.3.0" + typed_data: + dependency: transitive + description: + name: typed_data + url: "https://pub.flutter-io.cn" + source: hosted + version: "1.3.0" + vector_math: + dependency: transitive + description: + name: vector_math + url: "https://pub.flutter-io.cn" + source: hosted + version: "2.1.0" + vm_service: + dependency: transitive + description: + name: vm_service + url: "https://pub.flutter-io.cn" + source: hosted + version: "6.2.0" + webdriver: + dependency: transitive + description: + name: webdriver + url: "https://pub.flutter-io.cn" + source: hosted + version: "3.0.0" +sdks: + dart: ">=2.12.0 <3.0.0" diff --git a/FlutterHelper/ninghao_flutter-master/pubspec.yaml b/FlutterHelper/ninghao_flutter-master/pubspec.yaml new file mode 100644 index 00000000..1c10140d --- /dev/null +++ b/FlutterHelper/ninghao_flutter-master/pubspec.yaml @@ -0,0 +1,75 @@ +name: ninghao_flutter +description: A new Flutter project. + +# The following defines the version and build number for your application. +# A version number is three numbers separated by dots, like 1.2.43 +# followed by an optional build number separated by a +. +# Both the version and the builder number may be overridden in flutter +# build by specifying --build-name and --build-number, respectively. +# Read more about versioning at semver.org. +version: 1.0.0+1 + +dependencies: + flutter: + sdk: flutter + scoped_model: ^0.3.0 + rxdart: ^0.18.1 + http: ^0.12.0 +# flutter_localizations: +# sdk: flutter +# intl: ^0.17.0 + + # The following adds the Cupertino Icons font to your application. + # Use with the CupertinoIcons class for iOS style icons. + cupertino_icons: ^0.1.2 + +dev_dependencies: + flutter_test: + sdk: flutter + flutter_driver: + sdk: flutter +# intl_translation: ^0.17.2 + +environment: + sdk: '>=2.10.0 <3.0.0' +# For information on the generic Dart part of this file, see the +# following page: https://www.dartlang.org/tools/pub/pubspec + +# The following section is specific to Flutter. +flutter: + + # The following line ensures that the Material Icons font is + # included with your application, so that you can use the icons in + # the material Icons class. + uses-material-design: true + + # To add assets to your application, add an assets section, like this: + # assets: + # - images/a_dot_burr.jpeg + # - images/a_dot_ham.jpeg + + # An image asset can refer to one or more resolution-specific "variants", see + # https://flutter.io/assets-and-images/#resolution-aware. + + # For details regarding adding assets from package dependencies, see + # https://flutter.io/assets-and-images/#from-packages + + # To add custom fonts to your application, add a fonts section here, + # in this "flutter" section. Each entry in this list should have a + # "family" key with the font family name, and a "fonts" key with a + # list giving the asset and other descriptors for the font. For + # example: + # fonts: + # - family: Schyler + # fonts: + # - asset: fonts/Schyler-Regular.ttf + # - asset: fonts/Schyler-Italic.ttf + # style: italic + # - family: Trajan Pro + # fonts: + # - asset: fonts/TrajanPro.ttf + # - asset: fonts/TrajanPro_Bold.ttf + # weight: 700 + # + # For details regarding fonts from package dependencies, + # see https://flutter.io/custom-fonts/#from-packages diff --git a/FlutterHelper/ninghao_flutter-master/test/ninghao_demo_test.dart b/FlutterHelper/ninghao_flutter-master/test/ninghao_demo_test.dart new file mode 100644 index 00000000..55320349 --- /dev/null +++ b/FlutterHelper/ninghao_flutter-master/test/ninghao_demo_test.dart @@ -0,0 +1,35 @@ +import 'package:flutter/material.dart'; +import 'package:flutter_test/flutter_test.dart'; +import 'package:ninghao_flutter/demo/test/test_demo.dart'; + +void main() { + test('should return hello + something.', () { + var string = NinghaoTestDemo.greet('ninghao'); + expect(string, 'hello ninghao ~~'); + }); + + testWidgets('widget testing demo', (WidgetTester tester) async { + await tester.pumpWidget( + MaterialApp( + home: TestDemo() + ) + ); + + final labelText = find.text('hello'); + + // expect(labelText, findsNothing); + // expect(labelText, findsOneWidget); + expect(labelText, findsNWidgets(1)); + + final actionChipLabelText = find.text('0'); + expect(actionChipLabelText, findsOneWidget); + + final actionChip = find.byType(ActionChip); + await tester.tap(actionChip); + await tester.pump(); + + final actionChipLabelTextAfterTap = find.text('1'); + expect(actionChipLabelTextAfterTap, findsOneWidget); + expect(actionChipLabelText, findsNothing); + }); +} \ No newline at end of file diff --git a/FlutterHelper/ninghao_flutter-master/test_driver/app.dart b/FlutterHelper/ninghao_flutter-master/test_driver/app.dart new file mode 100644 index 00000000..99aa8a03 --- /dev/null +++ b/FlutterHelper/ninghao_flutter-master/test_driver/app.dart @@ -0,0 +1,8 @@ +import 'package:flutter_driver/driver_extension.dart'; +import 'package:ninghao_flutter/main.dart' as app; + +void main() { + enableFlutterDriverExtension(); + + app.main(); +} \ No newline at end of file diff --git a/FlutterHelper/ninghao_flutter-master/test_driver/app_test.dart b/FlutterHelper/ninghao_flutter-master/test_driver/app_test.dart new file mode 100644 index 00000000..f9877237 --- /dev/null +++ b/FlutterHelper/ninghao_flutter-master/test_driver/app_test.dart @@ -0,0 +1,31 @@ +import 'package:flutter_driver/flutter_driver.dart'; +import 'package:test/test.dart'; + +void main() { + group('App', () { + FlutterDriver driver; + + final actionChip = find.byValueKey('actionChip'); + final actionChipLabelText = find.byValueKey('actionChipLabelText'); + + setUpAll(() async { + driver = await FlutterDriver.connect(); + }); + + tearDownAll(() async { + if (driver != null) { + driver.close(); + } + }); + + test('starts at 0', () async { + expect(await driver.getText(actionChipLabelText), '0'); + }); + + test('increments the counter', () async { + await driver.tap(actionChip); + + expect(await driver.getText(actionChipLabelText), '1'); + }); + }); +} \ No newline at end of file diff --git a/build.gradle b/build.gradle index b5e2bbce..650dc963 100644 --- a/build.gradle +++ b/build.gradle @@ -37,13 +37,14 @@ buildscript { //google() //jcenter() maven { url 'http://repo.duowan.com:8181/nexus/content/groups/public' } + maven { url "https://plugins.gradle.org/m2/" } } dependencies { classpath 'com.android.tools.build:gradle:4.2.1'//3.6.2 classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" classpath 'com.hujiang.aspectjx:gradle-android-plugin-aspectjx:2.0.8' - + classpath "de.undercouch:gradle-download-task:4.1.2" classpath 'me.ele:lancet-plugin:1.0.4' //classpath 'com.imooc.router:router-gradle-plugin:1.0.0' // NOTE: Do not place your application dependencies here; they belong diff --git a/buildSrc/build/libs/buildSrc.jar b/buildSrc/build/libs/buildSrc.jar index 051e976d..e4bfea7d 100644 Binary files a/buildSrc/build/libs/buildSrc.jar and b/buildSrc/build/libs/buildSrc.jar differ diff --git a/buildSrc/src/main/groovy/com/immoc/router/gradle/RouterPlugin.groovy b/buildSrc/src/main/groovy/com/immoc/router/gradle/RouterPlugin.groovy index 7b5f667c..92524135 100644 --- a/buildSrc/src/main/groovy/com/immoc/router/gradle/RouterPlugin.groovy +++ b/buildSrc/src/main/groovy/com/immoc/router/gradle/RouterPlugin.groovy @@ -2,12 +2,38 @@ package com.immoc.router.gradle import org.gradle.api.Plugin import org.gradle.api.Project +import groovy.json.JsonSlurper class RouterPlugin implements Plugin { // 实现apply方法,注入插件的逻辑 @Override void apply(Project project) { + // 1. 自动的帮助用户传递路径参数到注解处理器中 + // 2. 实现旧的构建产物的自动清理 + // 3。在javac任务后汇总生成文档 + + //kapt { + // arguments { + // arg("root_project_dir", rootProject.projectDir.absolutePath) + // } + //} + // 1. 自动的帮助用户传递路径参数到注解处理器中 + if (project.extensions.findByName("kapt") != null) { + project.extensions.findByName("kapt").arguments { + arg("root_project_dir", project.rootProject.projectDir.absolutePath) + } + } + // 2. 实现旧的构建产物的自动清理 + project.clean.doFirst { + // 删除上一次生成的router_mapping目录 + File routerMappingDir = new File(project.rootProject.projectDir.absolutePath, "router_mapping") + if (routerMappingDir.exists()) { + routerMappingDir.deleteDir() + } + + } + println("I am from RouterPlugin, apply from ${project.name}") project.getExtensions().create("router", RouterExtension) //使用Extension @@ -15,6 +41,50 @@ class RouterPlugin implements Plugin { // 拿到配置的router RouterExtension extension = project["router"] println("用户设置的WIKI路径为:${extension.wikiDir}") + + // 3。在javac任务后汇总生成文档 + // compileDebugJavaWithJavac + project.tasks.findAll { task -> + task.name.startsWith("compile") && task.name.endsWith("JavaWithJavac") + }.each { task -> + task.doLast { + File routerMappingDir = new File(project.rootProject.projectDir, "router_mapping") + if (!routerMappingDir.exists()) { + return + } + // 所有子文件 + File[] allChildFiles = routerMappingDir.listFiles() + if (allChildFiles.length < 1) { + return + } + StringBuilder markdownBuilder = new StringBuilder() + markdownBuilder.append("# 页面文档\n\n") + allChildFiles.each { child -> + if (child.name.endsWith(".json")) { + JsonSlurper jsonSlurper = new JsonSlurper() + def content = jsonSlurper.parse(child) + content.each { innerContent -> + def url = innerContent['url'] + def description = innerContent['description'] + def realPath = innerContent['realPath'] + markdownBuilder.append("## $description \n") + markdownBuilder.append("- url: $url \n") + markdownBuilder.append("- realPath: $realPath \n") + } + + } + } + File wikiFileDir = new File(extension.wikiDir) + if (!wikiFileDir.exists()) { + wikiFileDir.mkdir() + } + File wikiFile = new File(wikiFileDir, "页面文档") + if (wikiFile.exists()) { + wikiFile.delete() + } + wikiFile.write(markdownBuilder.toString()) + } + } } } } \ No newline at end of file diff --git a/cpp/demo/cmake-build-debug/CMakeFiles/clion-log.txt b/cpp/demo/cmake-build-debug/CMakeFiles/clion-log.txt index 951082ac..62864c2d 100644 --- a/cpp/demo/cmake-build-debug/CMakeFiles/clion-log.txt +++ b/cpp/demo/cmake-build-debug/CMakeFiles/clion-log.txt @@ -1,4 +1,15 @@ /Applications/CLion.app/Contents/bin/cmake/mac/bin/cmake -DCMAKE_BUILD_TYPE=Debug -G "CodeBlocks - Unix Makefiles" /Users/flannery/Desktop/AndroidHelper/cpp/demo +CMake Warning at /Applications/CLion.app/Contents/bin/cmake/mac/share/cmake-3.17/Modules/Platform/Darwin-Initialize.cmake:286 (message): + Ignoring CMAKE_OSX_SYSROOT value: + + /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.3.sdk + + because the directory does not exist. +Call Stack (most recent call first): + /Applications/CLion.app/Contents/bin/cmake/mac/share/cmake-3.17/Modules/CMakeSystemSpecificInitialize.cmake:21 (include) + CMakeLists.txt:2 (project) + + -- Configuring done -- Generating done -- Build files have been written to: /Users/flannery/Desktop/AndroidHelper/cpp/demo/cmake-build-debug diff --git a/cpp/demo/cmake-build-debug/CMakeFiles/demo.dir/flags.make b/cpp/demo/cmake-build-debug/CMakeFiles/demo.dir/flags.make index e4d0c69d..1ec6a81b 100644 --- a/cpp/demo/cmake-build-debug/CMakeFiles/demo.dir/flags.make +++ b/cpp/demo/cmake-build-debug/CMakeFiles/demo.dir/flags.make @@ -2,7 +2,7 @@ # Generated by "Unix Makefiles" Generator, CMake Version 3.17 # compile CXX with /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++ -CXX_FLAGS = -g -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.3.sdk -std=gnu++14 +CXX_FLAGS = -g -std=gnu++14 CXX_DEFINES = diff --git a/cpp/demo/cmake-build-debug/CMakeFiles/demo.dir/link.txt b/cpp/demo/cmake-build-debug/CMakeFiles/demo.dir/link.txt index b7878813..0e6e8ef6 100644 --- a/cpp/demo/cmake-build-debug/CMakeFiles/demo.dir/link.txt +++ b/cpp/demo/cmake-build-debug/CMakeFiles/demo.dir/link.txt @@ -1 +1 @@ -/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++ -g -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.3.sdk -Wl,-search_paths_first -Wl,-headerpad_max_install_names CMakeFiles/demo.dir/main.cpp.o CMakeFiles/demo.dir/limits.cpp.o CMakeFiles/demo.dir/hexoct2.cpp.o -o demo +/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++ -g -Wl,-search_paths_first -Wl,-headerpad_max_install_names CMakeFiles/demo.dir/main.cpp.o CMakeFiles/demo.dir/limits.cpp.o CMakeFiles/demo.dir/hexoct2.cpp.o -o demo diff --git a/cpp/demo/cmake-build-debug/Testing/Temporary/LastTest.log b/cpp/demo/cmake-build-debug/Testing/Temporary/LastTest.log index a913f18c..365e5e9d 100644 --- a/cpp/demo/cmake-build-debug/Testing/Temporary/LastTest.log +++ b/cpp/demo/cmake-build-debug/Testing/Temporary/LastTest.log @@ -1,3 +1,3 @@ -Start testing: Jul 09 13:58 CST +Start testing: Jul 14 14:45 CST ---------------------------------------------------------- -End testing: Jul 09 13:58 CST +End testing: Jul 14 14:45 CST diff --git a/cpp/xcode/Test/Test.xcodeproj/project.pbxproj b/cpp/xcode/Test/Test.xcodeproj/project.pbxproj new file mode 100644 index 00000000..403b01e0 --- /dev/null +++ b/cpp/xcode/Test/Test.xcodeproj/project.pbxproj @@ -0,0 +1,279 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 50; + objects = { + +/* Begin PBXBuildFile section */ + BEC96F8A269FCCDA008F460F /* main.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BEC96F89269FCCDA008F460F /* main.cpp */; }; +/* End PBXBuildFile section */ + +/* Begin PBXCopyFilesBuildPhase section */ + BEC96F84269FCCD9008F460F /* CopyFiles */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 2147483647; + dstPath = /usr/share/man/man1/; + dstSubfolderSpec = 0; + files = ( + ); + runOnlyForDeploymentPostprocessing = 1; + }; +/* End PBXCopyFilesBuildPhase section */ + +/* Begin PBXFileReference section */ + BEC96F86269FCCD9008F460F /* Test */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = Test; sourceTree = BUILT_PRODUCTS_DIR; }; + BEC96F89269FCCDA008F460F /* main.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = main.cpp; sourceTree = ""; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + BEC96F83269FCCD9008F460F /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + BEC96F7D269FCCD9008F460F = { + isa = PBXGroup; + children = ( + BEC96F88269FCCD9008F460F /* Test */, + BEC96F87269FCCD9008F460F /* Products */, + ); + sourceTree = ""; + }; + BEC96F87269FCCD9008F460F /* Products */ = { + isa = PBXGroup; + children = ( + BEC96F86269FCCD9008F460F /* Test */, + ); + name = Products; + sourceTree = ""; + }; + BEC96F88269FCCD9008F460F /* Test */ = { + isa = PBXGroup; + children = ( + BEC96F89269FCCDA008F460F /* main.cpp */, + ); + path = Test; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + BEC96F85269FCCD9008F460F /* Test */ = { + isa = PBXNativeTarget; + buildConfigurationList = BEC96F8D269FCCDA008F460F /* Build configuration list for PBXNativeTarget "Test" */; + buildPhases = ( + BEC96F82269FCCD9008F460F /* Sources */, + BEC96F83269FCCD9008F460F /* Frameworks */, + BEC96F84269FCCD9008F460F /* CopyFiles */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = Test; + productName = Test; + productReference = BEC96F86269FCCD9008F460F /* Test */; + productType = "com.apple.product-type.tool"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + BEC96F7E269FCCD9008F460F /* Project object */ = { + isa = PBXProject; + attributes = { + LastUpgradeCheck = 1210; + TargetAttributes = { + BEC96F85269FCCD9008F460F = { + CreatedOnToolsVersion = 12.1; + }; + }; + }; + buildConfigurationList = BEC96F81269FCCD9008F460F /* Build configuration list for PBXProject "Test" */; + compatibilityVersion = "Xcode 9.3"; + developmentRegion = en; + hasScannedForEncodings = 0; + knownRegions = ( + en, + Base, + ); + mainGroup = BEC96F7D269FCCD9008F460F; + productRefGroup = BEC96F87269FCCD9008F460F /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + BEC96F85269FCCD9008F460F /* Test */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXSourcesBuildPhase section */ + BEC96F82269FCCD9008F460F /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + BEC96F8A269FCCDA008F460F /* main.cpp in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin XCBuildConfiguration section */ + BEC96F8B269FCCDA008F460F /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_ENABLE_OBJC_WEAK = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = dwarf; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_TESTABILITY = YES; + GCC_C_LANGUAGE_STANDARD = gnu11; + GCC_DYNAMIC_NO_PIC = NO; + GCC_NO_COMMON_BLOCKS = YES; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + MACOSX_DEPLOYMENT_TARGET = 10.15; + MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; + MTL_FAST_MATH = YES; + ONLY_ACTIVE_ARCH = YES; + SDKROOT = macosx; + }; + name = Debug; + }; + BEC96F8C269FCCDA008F460F /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_ENABLE_OBJC_WEAK = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + GCC_C_LANGUAGE_STANDARD = gnu11; + GCC_NO_COMMON_BLOCKS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + MACOSX_DEPLOYMENT_TARGET = 10.15; + MTL_ENABLE_DEBUG_INFO = NO; + MTL_FAST_MATH = YES; + SDKROOT = macosx; + }; + name = Release; + }; + BEC96F8E269FCCDA008F460F /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + CODE_SIGN_STYLE = Automatic; + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Debug; + }; + BEC96F8F269FCCDA008F460F /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + CODE_SIGN_STYLE = Automatic; + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + BEC96F81269FCCD9008F460F /* Build configuration list for PBXProject "Test" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + BEC96F8B269FCCDA008F460F /* Debug */, + BEC96F8C269FCCDA008F460F /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + BEC96F8D269FCCDA008F460F /* Build configuration list for PBXNativeTarget "Test" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + BEC96F8E269FCCDA008F460F /* Debug */, + BEC96F8F269FCCDA008F460F /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = BEC96F7E269FCCD9008F460F /* Project object */; +} diff --git a/cpp/xcode/Test/Test.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/cpp/xcode/Test/Test.xcodeproj/project.xcworkspace/contents.xcworkspacedata new file mode 100644 index 00000000..919434a6 --- /dev/null +++ b/cpp/xcode/Test/Test.xcodeproj/project.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,7 @@ + + + + + diff --git a/cpp/xcode/Test/Test.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/cpp/xcode/Test/Test.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist new file mode 100644 index 00000000..18d98100 --- /dev/null +++ b/cpp/xcode/Test/Test.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist @@ -0,0 +1,8 @@ + + + + + IDEDidComputeMac32BitWarning + + + diff --git a/cpp/xcode/Test/Test.xcodeproj/project.xcworkspace/xcuserdata/flannery.xcuserdatad/UserInterfaceState.xcuserstate b/cpp/xcode/Test/Test.xcodeproj/project.xcworkspace/xcuserdata/flannery.xcuserdatad/UserInterfaceState.xcuserstate new file mode 100644 index 00000000..f19f5c70 Binary files /dev/null and b/cpp/xcode/Test/Test.xcodeproj/project.xcworkspace/xcuserdata/flannery.xcuserdatad/UserInterfaceState.xcuserstate differ diff --git a/cpp/xcode/Test/Test.xcodeproj/xcuserdata/flannery.xcuserdatad/xcschemes/xcschememanagement.plist b/cpp/xcode/Test/Test.xcodeproj/xcuserdata/flannery.xcuserdatad/xcschemes/xcschememanagement.plist new file mode 100644 index 00000000..1c42a578 --- /dev/null +++ b/cpp/xcode/Test/Test.xcodeproj/xcuserdata/flannery.xcuserdatad/xcschemes/xcschememanagement.plist @@ -0,0 +1,14 @@ + + + + + SchemeUserState + + Test.xcscheme_^#shared#^_ + + orderHint + 0 + + + + diff --git a/cpp/xcode/Test/Test/main.cpp b/cpp/xcode/Test/Test/main.cpp new file mode 100644 index 00000000..56958b5d --- /dev/null +++ b/cpp/xcode/Test/Test/main.cpp @@ -0,0 +1,14 @@ +// +// main.cpp +// Test +// +// Created by 赵健 on 2021/7/15. +// + +#include + +int main(int argc, const char * argv[]) { + // insert code here... + std::cout << "Hello, World!\n"; + return 0; +} diff --git a/flutter_helper/.gitignore b/flutter_helper/.gitignore new file mode 100644 index 00000000..9d532b18 --- /dev/null +++ b/flutter_helper/.gitignore @@ -0,0 +1,41 @@ +# Miscellaneous +*.class +*.log +*.pyc +*.swp +.DS_Store +.atom/ +.buildlog/ +.history +.svn/ + +# IntelliJ related +*.iml +*.ipr +*.iws +.idea/ + +# The .vscode folder contains launch configuration and tasks you configure in +# VS Code which you may wish to be included in version control, so this line +# is commented out by default. +#.vscode/ + +# Flutter/Dart/Pub related +**/doc/api/ +**/ios/Flutter/.last_build_id +.dart_tool/ +.flutter-plugins +.flutter-plugins-dependencies +.packages +.pub-cache/ +.pub/ +/build/ + +# Web related +lib/generated_plugin_registrant.dart + +# Symbolication related +app.*.symbols + +# Obfuscation related +app.*.map.json diff --git a/flutter_helper/.metadata b/flutter_helper/.metadata new file mode 100644 index 00000000..9432b087 --- /dev/null +++ b/flutter_helper/.metadata @@ -0,0 +1,10 @@ +# This file tracks properties of this Flutter project. +# Used by Flutter tool to assess capabilities and perform upgrades etc. +# +# This file should be version controlled and should not be manually edited. + +version: + revision: f30b7f4db93ee747cd727df747941a28ead25ff5 + channel: stable + +project_type: app diff --git a/flutter_helper/README.md b/flutter_helper/README.md new file mode 100644 index 00000000..784d34d3 --- /dev/null +++ b/flutter_helper/README.md @@ -0,0 +1,16 @@ +# flutter_helper + +A new Flutter project. + +## Getting Started + +This project is a starting point for a Flutter application. + +A few resources to get you started if this is your first Flutter project: + +- [Lab: Write your first Flutter app](https://flutter.dev/docs/get-started/codelab) +- [Cookbook: Useful Flutter samples](https://flutter.dev/docs/cookbook) + +For help getting started with Flutter, view our +[online documentation](https://flutter.dev/docs), which offers tutorials, +samples, guidance on mobile development, and a full API reference. diff --git a/flutter_helper/android/.gitignore b/flutter_helper/android/.gitignore new file mode 100644 index 00000000..0a741cb4 --- /dev/null +++ b/flutter_helper/android/.gitignore @@ -0,0 +1,11 @@ +gradle-wrapper.jar +/.gradle +/captures/ +/gradlew +/gradlew.bat +/local.properties +GeneratedPluginRegistrant.java + +# Remember to never publicly share your keystore. +# See https://flutter.dev/docs/deployment/android#reference-the-keystore-from-the-app +key.properties diff --git a/flutter_helper/android/app/build.gradle b/flutter_helper/android/app/build.gradle new file mode 100644 index 00000000..265f3279 --- /dev/null +++ b/flutter_helper/android/app/build.gradle @@ -0,0 +1,63 @@ +def localProperties = new Properties() +def localPropertiesFile = rootProject.file('local.properties') +if (localPropertiesFile.exists()) { + localPropertiesFile.withReader('UTF-8') { reader -> + localProperties.load(reader) + } +} + +def flutterRoot = localProperties.getProperty('flutter.sdk') +if (flutterRoot == null) { + throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.") +} + +def flutterVersionCode = localProperties.getProperty('flutter.versionCode') +if (flutterVersionCode == null) { + flutterVersionCode = '1' +} + +def flutterVersionName = localProperties.getProperty('flutter.versionName') +if (flutterVersionName == null) { + flutterVersionName = '1.0' +} + +apply plugin: 'com.android.application' +apply plugin: 'kotlin-android' +apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" + +android { + compileSdkVersion 29 + + sourceSets { + main.java.srcDirs += 'src/main/kotlin' + } + + lintOptions { + disable 'InvalidPackage' + } + + defaultConfig { + // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). + applicationId "com.example.flutter_helper" + minSdkVersion 16 + targetSdkVersion 29 + versionCode flutterVersionCode.toInteger() + versionName flutterVersionName + } + + buildTypes { + release { + // TODO: Add your own signing config for the release build. + // Signing with the debug keys for now, so `flutter run --release` works. + signingConfig signingConfigs.debug + } + } +} + +flutter { + source '../..' +} + +dependencies { + implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" +} diff --git a/flutter_helper/android/app/src/debug/AndroidManifest.xml b/flutter_helper/android/app/src/debug/AndroidManifest.xml new file mode 100644 index 00000000..6e9515b9 --- /dev/null +++ b/flutter_helper/android/app/src/debug/AndroidManifest.xml @@ -0,0 +1,7 @@ + + + + diff --git a/flutter_helper/android/app/src/main/AndroidManifest.xml b/flutter_helper/android/app/src/main/AndroidManifest.xml new file mode 100644 index 00000000..cafa5191 --- /dev/null +++ b/flutter_helper/android/app/src/main/AndroidManifest.xml @@ -0,0 +1,47 @@ + + + + + + + + + + + + + + + + + diff --git a/flutter_helper/android/app/src/main/kotlin/com/example/flutter_helper/MainActivity.kt b/flutter_helper/android/app/src/main/kotlin/com/example/flutter_helper/MainActivity.kt new file mode 100644 index 00000000..4cd8d47b --- /dev/null +++ b/flutter_helper/android/app/src/main/kotlin/com/example/flutter_helper/MainActivity.kt @@ -0,0 +1,6 @@ +package com.example.flutter_helper + +import io.flutter.embedding.android.FlutterActivity + +class MainActivity: FlutterActivity() { +} diff --git a/flutter_helper/android/app/src/main/res/drawable/launch_background.xml b/flutter_helper/android/app/src/main/res/drawable/launch_background.xml new file mode 100644 index 00000000..304732f8 --- /dev/null +++ b/flutter_helper/android/app/src/main/res/drawable/launch_background.xml @@ -0,0 +1,12 @@ + + + + + + + + diff --git a/flutter_helper/android/app/src/main/res/mipmap-hdpi/ic_launcher.png b/flutter_helper/android/app/src/main/res/mipmap-hdpi/ic_launcher.png new file mode 100644 index 00000000..db77bb4b Binary files /dev/null and b/flutter_helper/android/app/src/main/res/mipmap-hdpi/ic_launcher.png differ diff --git a/flutter_helper/android/app/src/main/res/mipmap-mdpi/ic_launcher.png b/flutter_helper/android/app/src/main/res/mipmap-mdpi/ic_launcher.png new file mode 100644 index 00000000..17987b79 Binary files /dev/null and b/flutter_helper/android/app/src/main/res/mipmap-mdpi/ic_launcher.png differ diff --git a/flutter_helper/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png b/flutter_helper/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png new file mode 100644 index 00000000..09d43914 Binary files /dev/null and b/flutter_helper/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png differ diff --git a/flutter_helper/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png b/flutter_helper/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png new file mode 100644 index 00000000..d5f1c8d3 Binary files /dev/null and b/flutter_helper/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png differ diff --git a/flutter_helper/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png b/flutter_helper/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png new file mode 100644 index 00000000..4d6372ee Binary files /dev/null and b/flutter_helper/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png differ diff --git a/flutter_helper/android/app/src/main/res/values/styles.xml b/flutter_helper/android/app/src/main/res/values/styles.xml new file mode 100644 index 00000000..1f83a33f --- /dev/null +++ b/flutter_helper/android/app/src/main/res/values/styles.xml @@ -0,0 +1,18 @@ + + + + + + + diff --git a/flutter_helper/android/app/src/profile/AndroidManifest.xml b/flutter_helper/android/app/src/profile/AndroidManifest.xml new file mode 100644 index 00000000..6e9515b9 --- /dev/null +++ b/flutter_helper/android/app/src/profile/AndroidManifest.xml @@ -0,0 +1,7 @@ + + + + diff --git a/flutter_helper/android/build.gradle b/flutter_helper/android/build.gradle new file mode 100644 index 00000000..3100ad2d --- /dev/null +++ b/flutter_helper/android/build.gradle @@ -0,0 +1,31 @@ +buildscript { + ext.kotlin_version = '1.3.50' + repositories { + google() + jcenter() + } + + dependencies { + classpath 'com.android.tools.build:gradle:3.5.0' + classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" + } +} + +allprojects { + repositories { + google() + jcenter() + } +} + +rootProject.buildDir = '../build' +subprojects { + project.buildDir = "${rootProject.buildDir}/${project.name}" +} +subprojects { + project.evaluationDependsOn(':app') +} + +task clean(type: Delete) { + delete rootProject.buildDir +} diff --git a/flutter_helper/android/gradle.properties b/flutter_helper/android/gradle.properties new file mode 100644 index 00000000..a6738207 --- /dev/null +++ b/flutter_helper/android/gradle.properties @@ -0,0 +1,4 @@ +org.gradle.jvmargs=-Xmx1536M +android.useAndroidX=true +android.enableJetifier=true +android.enableR8=true diff --git a/flutter_helper/android/gradle/wrapper/gradle-wrapper.properties b/flutter_helper/android/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 00000000..296b146b --- /dev/null +++ b/flutter_helper/android/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,6 @@ +#Fri Jun 23 08:50:38 CEST 2017 +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.2-all.zip diff --git a/flutter_helper/android/settings.gradle b/flutter_helper/android/settings.gradle new file mode 100644 index 00000000..44e62bcf --- /dev/null +++ b/flutter_helper/android/settings.gradle @@ -0,0 +1,11 @@ +include ':app' + +def localPropertiesFile = new File(rootProject.projectDir, "local.properties") +def properties = new Properties() + +assert localPropertiesFile.exists() +localPropertiesFile.withReader("UTF-8") { reader -> properties.load(reader) } + +def flutterSdkPath = properties.getProperty("flutter.sdk") +assert flutterSdkPath != null, "flutter.sdk not set in local.properties" +apply from: "$flutterSdkPath/packages/flutter_tools/gradle/app_plugin_loader.gradle" diff --git a/flutter_helper/images/beatiful_lady.jpeg b/flutter_helper/images/beatiful_lady.jpeg new file mode 100644 index 00000000..5a3a3b77 Binary files /dev/null and b/flutter_helper/images/beatiful_lady.jpeg differ diff --git a/flutter_helper/images/bird.png b/flutter_helper/images/bird.png new file mode 100644 index 00000000..53f9d556 Binary files /dev/null and b/flutter_helper/images/bird.png differ diff --git a/flutter_helper/images/bossapp2x.png b/flutter_helper/images/bossapp2x.png new file mode 100644 index 00000000..d316f538 Binary files /dev/null and b/flutter_helper/images/bossapp2x.png differ diff --git a/flutter_helper/images/ic_main_tab_company_nor.png b/flutter_helper/images/ic_main_tab_company_nor.png new file mode 100755 index 00000000..371d5ac1 Binary files /dev/null and b/flutter_helper/images/ic_main_tab_company_nor.png differ diff --git a/flutter_helper/images/ic_main_tab_company_pre.png b/flutter_helper/images/ic_main_tab_company_pre.png new file mode 100755 index 00000000..83c709f9 Binary files /dev/null and b/flutter_helper/images/ic_main_tab_company_pre.png differ diff --git a/flutter_helper/images/ic_main_tab_contacts_nor.png b/flutter_helper/images/ic_main_tab_contacts_nor.png new file mode 100755 index 00000000..fbcc9d58 Binary files /dev/null and b/flutter_helper/images/ic_main_tab_contacts_nor.png differ diff --git a/flutter_helper/images/ic_main_tab_contacts_pre.png b/flutter_helper/images/ic_main_tab_contacts_pre.png new file mode 100755 index 00000000..17ad70f0 Binary files /dev/null and b/flutter_helper/images/ic_main_tab_contacts_pre.png differ diff --git a/flutter_helper/images/ic_main_tab_find_nor.png b/flutter_helper/images/ic_main_tab_find_nor.png new file mode 100755 index 00000000..89c6433d Binary files /dev/null and b/flutter_helper/images/ic_main_tab_find_nor.png differ diff --git a/flutter_helper/images/ic_main_tab_find_pre.png b/flutter_helper/images/ic_main_tab_find_pre.png new file mode 100755 index 00000000..7bc21fd7 Binary files /dev/null and b/flutter_helper/images/ic_main_tab_find_pre.png differ diff --git a/flutter_helper/images/ic_main_tab_my_nor.png b/flutter_helper/images/ic_main_tab_my_nor.png new file mode 100755 index 00000000..0766c144 Binary files /dev/null and b/flutter_helper/images/ic_main_tab_my_nor.png differ diff --git a/flutter_helper/images/ic_main_tab_my_pre.png b/flutter_helper/images/ic_main_tab_my_pre.png new file mode 100755 index 00000000..94e689cd Binary files /dev/null and b/flutter_helper/images/ic_main_tab_my_pre.png differ diff --git a/flutter_helper/images/ic_purchase_history_blank.jpeg b/flutter_helper/images/ic_purchase_history_blank.jpeg new file mode 100644 index 00000000..7720479c Binary files /dev/null and b/flutter_helper/images/ic_purchase_history_blank.jpeg differ diff --git a/flutter_helper/images/ic_purchase_history_blank.png b/flutter_helper/images/ic_purchase_history_blank.png new file mode 100644 index 00000000..b1284412 Binary files /dev/null and b/flutter_helper/images/ic_purchase_history_blank.png differ diff --git a/flutter_helper/images/ic_purchase_history_blank.webp b/flutter_helper/images/ic_purchase_history_blank.webp new file mode 100644 index 00000000..0acacfba Binary files /dev/null and b/flutter_helper/images/ic_purchase_history_blank.webp differ diff --git a/flutter_helper/images/image_-pet-wild.png b/flutter_helper/images/image_-pet-wild.png new file mode 100644 index 00000000..a1c79ca8 Binary files /dev/null and b/flutter_helper/images/image_-pet-wild.png differ diff --git a/flutter_helper/images/image_1111.png b/flutter_helper/images/image_1111.png new file mode 100644 index 00000000..4046de2a Binary files /dev/null and b/flutter_helper/images/image_1111.png differ diff --git a/flutter_helper/images/image_2222.png b/flutter_helper/images/image_2222.png new file mode 100644 index 00000000..897018c4 Binary files /dev/null and b/flutter_helper/images/image_2222.png differ diff --git a/flutter_helper/images/image_3333.png b/flutter_helper/images/image_3333.png new file mode 100644 index 00000000..0c8f2c9c Binary files /dev/null and b/flutter_helper/images/image_3333.png differ diff --git a/flutter_helper/images/image_and_nature.png b/flutter_helper/images/image_and_nature.png new file mode 100644 index 00000000..d99e7bdf Binary files /dev/null and b/flutter_helper/images/image_and_nature.png differ diff --git a/flutter_helper/images/image_animaltest.png b/flutter_helper/images/image_animaltest.png new file mode 100644 index 00000000..11beacd1 Binary files /dev/null and b/flutter_helper/images/image_animaltest.png differ diff --git a/flutter_helper/images/image_domestic_3204653.png b/flutter_helper/images/image_domestic_3204653.png new file mode 100644 index 00000000..03e4039d Binary files /dev/null and b/flutter_helper/images/image_domestic_3204653.png differ diff --git a/flutter_helper/images/image_eye_care.png b/flutter_helper/images/image_eye_care.png new file mode 100644 index 00000000..062aa2ac Binary files /dev/null and b/flutter_helper/images/image_eye_care.png differ diff --git a/flutter_helper/images/image_hospital.png b/flutter_helper/images/image_hospital.png new file mode 100644 index 00000000..0a230858 Binary files /dev/null and b/flutter_helper/images/image_hospital.png differ diff --git a/flutter_helper/ios/.gitignore b/flutter_helper/ios/.gitignore new file mode 100644 index 00000000..e96ef602 --- /dev/null +++ b/flutter_helper/ios/.gitignore @@ -0,0 +1,32 @@ +*.mode1v3 +*.mode2v3 +*.moved-aside +*.pbxuser +*.perspectivev3 +**/*sync/ +.sconsign.dblite +.tags* +**/.vagrant/ +**/DerivedData/ +Icon? +**/Pods/ +**/.symlinks/ +profile +xcuserdata +**/.generated/ +Flutter/App.framework +Flutter/Flutter.framework +Flutter/Flutter.podspec +Flutter/Generated.xcconfig +Flutter/app.flx +Flutter/app.zip +Flutter/flutter_assets/ +Flutter/flutter_export_environment.sh +ServiceDefinitions.json +Runner/GeneratedPluginRegistrant.* + +# Exceptions to above rules. +!default.mode1v3 +!default.mode2v3 +!default.pbxuser +!default.perspectivev3 diff --git a/flutter_helper/ios/Flutter/AppFrameworkInfo.plist b/flutter_helper/ios/Flutter/AppFrameworkInfo.plist new file mode 100644 index 00000000..f2872cf4 --- /dev/null +++ b/flutter_helper/ios/Flutter/AppFrameworkInfo.plist @@ -0,0 +1,26 @@ + + + + + CFBundleDevelopmentRegion + $(DEVELOPMENT_LANGUAGE) + CFBundleExecutable + App + CFBundleIdentifier + io.flutter.flutter.app + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + App + CFBundlePackageType + FMWK + CFBundleShortVersionString + 1.0 + CFBundleSignature + ???? + CFBundleVersion + 1.0 + MinimumOSVersion + 9.0 + + diff --git a/flutter_helper/ios/Flutter/Debug.xcconfig b/flutter_helper/ios/Flutter/Debug.xcconfig new file mode 100644 index 00000000..ec97fc6f --- /dev/null +++ b/flutter_helper/ios/Flutter/Debug.xcconfig @@ -0,0 +1,2 @@ +#include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig" +#include "Generated.xcconfig" diff --git a/flutter_helper/ios/Flutter/Release.xcconfig b/flutter_helper/ios/Flutter/Release.xcconfig new file mode 100644 index 00000000..c4855bfe --- /dev/null +++ b/flutter_helper/ios/Flutter/Release.xcconfig @@ -0,0 +1,2 @@ +#include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig" +#include "Generated.xcconfig" diff --git a/flutter_helper/ios/Podfile b/flutter_helper/ios/Podfile new file mode 100644 index 00000000..1e8c3c90 --- /dev/null +++ b/flutter_helper/ios/Podfile @@ -0,0 +1,41 @@ +# Uncomment this line to define a global platform for your project +# platform :ios, '9.0' + +# CocoaPods analytics sends network stats synchronously affecting flutter build latency. +ENV['COCOAPODS_DISABLE_STATS'] = 'true' + +project 'Runner', { + 'Debug' => :debug, + 'Profile' => :release, + 'Release' => :release, +} + +def flutter_root + generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'Generated.xcconfig'), __FILE__) + unless File.exist?(generated_xcode_build_settings_path) + raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure flutter pub get is executed first" + end + + File.foreach(generated_xcode_build_settings_path) do |line| + matches = line.match(/FLUTTER_ROOT\=(.*)/) + return matches[1].strip if matches + end + raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Generated.xcconfig, then run flutter pub get" +end + +require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root) + +flutter_ios_podfile_setup + +target 'Runner' do + use_frameworks! + use_modular_headers! + + flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__)) +end + +post_install do |installer| + installer.pods_project.targets.each do |target| + flutter_additional_ios_build_settings(target) + end +end diff --git a/flutter_helper/ios/Runner.xcodeproj/project.pbxproj b/flutter_helper/ios/Runner.xcodeproj/project.pbxproj new file mode 100644 index 00000000..eb76b764 --- /dev/null +++ b/flutter_helper/ios/Runner.xcodeproj/project.pbxproj @@ -0,0 +1,495 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 46; + objects = { + +/* Begin PBXBuildFile section */ + 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */ = {isa = PBXBuildFile; fileRef = 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */; }; + 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; }; + 74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74858FAE1ED2DC5600515810 /* AppDelegate.swift */; }; + 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; }; + 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FD1CF9000F007C117D /* Assets.xcassets */; }; + 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */; }; +/* End PBXBuildFile section */ + +/* Begin PBXCopyFilesBuildPhase section */ + 9705A1C41CF9048500538489 /* Embed Frameworks */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 2147483647; + dstPath = ""; + dstSubfolderSpec = 10; + files = ( + ); + name = "Embed Frameworks"; + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXCopyFilesBuildPhase section */ + +/* Begin PBXFileReference section */ + 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GeneratedPluginRegistrant.h; sourceTree = ""; }; + 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = ""; }; + 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = ""; }; + 74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Runner-Bridging-Header.h"; sourceTree = ""; }; + 74858FAE1ED2DC5600515810 /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; + 7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = ""; }; + 9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Debug.xcconfig; path = Flutter/Debug.xcconfig; sourceTree = ""; }; + 9740EEB31CF90195004384FC /* Generated.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Generated.xcconfig; path = Flutter/Generated.xcconfig; sourceTree = ""; }; + 97C146EE1CF9000F007C117D /* Runner.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Runner.app; sourceTree = BUILT_PRODUCTS_DIR; }; + 97C146FB1CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; + 97C146FD1CF9000F007C117D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; + 97C147001CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; + 97C147021CF9000F007C117D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + 97C146EB1CF9000F007C117D /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 9740EEB11CF90186004384FC /* Flutter */ = { + isa = PBXGroup; + children = ( + 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */, + 9740EEB21CF90195004384FC /* Debug.xcconfig */, + 7AFA3C8E1D35360C0083082E /* Release.xcconfig */, + 9740EEB31CF90195004384FC /* Generated.xcconfig */, + ); + name = Flutter; + sourceTree = ""; + }; + 97C146E51CF9000F007C117D = { + isa = PBXGroup; + children = ( + 9740EEB11CF90186004384FC /* Flutter */, + 97C146F01CF9000F007C117D /* Runner */, + 97C146EF1CF9000F007C117D /* Products */, + ); + sourceTree = ""; + }; + 97C146EF1CF9000F007C117D /* Products */ = { + isa = PBXGroup; + children = ( + 97C146EE1CF9000F007C117D /* Runner.app */, + ); + name = Products; + sourceTree = ""; + }; + 97C146F01CF9000F007C117D /* Runner */ = { + isa = PBXGroup; + children = ( + 97C146FA1CF9000F007C117D /* Main.storyboard */, + 97C146FD1CF9000F007C117D /* Assets.xcassets */, + 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */, + 97C147021CF9000F007C117D /* Info.plist */, + 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */, + 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */, + 74858FAE1ED2DC5600515810 /* AppDelegate.swift */, + 74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */, + ); + path = Runner; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + 97C146ED1CF9000F007C117D /* Runner */ = { + isa = PBXNativeTarget; + buildConfigurationList = 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */; + buildPhases = ( + 9740EEB61CF901F6004384FC /* Run Script */, + 97C146EA1CF9000F007C117D /* Sources */, + 97C146EB1CF9000F007C117D /* Frameworks */, + 97C146EC1CF9000F007C117D /* Resources */, + 9705A1C41CF9048500538489 /* Embed Frameworks */, + 3B06AD1E1E4923F5004D2608 /* Thin Binary */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = Runner; + productName = Runner; + productReference = 97C146EE1CF9000F007C117D /* Runner.app */; + productType = "com.apple.product-type.application"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + 97C146E61CF9000F007C117D /* Project object */ = { + isa = PBXProject; + attributes = { + LastUpgradeCheck = 1020; + ORGANIZATIONNAME = ""; + TargetAttributes = { + 97C146ED1CF9000F007C117D = { + CreatedOnToolsVersion = 7.3.1; + LastSwiftMigration = 1100; + }; + }; + }; + buildConfigurationList = 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */; + compatibilityVersion = "Xcode 9.3"; + developmentRegion = en; + hasScannedForEncodings = 0; + knownRegions = ( + en, + Base, + ); + mainGroup = 97C146E51CF9000F007C117D; + productRefGroup = 97C146EF1CF9000F007C117D /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + 97C146ED1CF9000F007C117D /* Runner */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXResourcesBuildPhase section */ + 97C146EC1CF9000F007C117D /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */, + 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */, + 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */, + 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXShellScriptBuildPhase section */ + 3B06AD1E1E4923F5004D2608 /* Thin Binary */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + ); + name = "Thin Binary"; + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" embed_and_thin"; + }; + 9740EEB61CF901F6004384FC /* Run Script */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + ); + name = "Run Script"; + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build"; + }; +/* End PBXShellScriptBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + 97C146EA1CF9000F007C117D /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */, + 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin PBXVariantGroup section */ + 97C146FA1CF9000F007C117D /* Main.storyboard */ = { + isa = PBXVariantGroup; + children = ( + 97C146FB1CF9000F007C117D /* Base */, + ); + name = Main.storyboard; + sourceTree = ""; + }; + 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */ = { + isa = PBXVariantGroup; + children = ( + 97C147001CF9000F007C117D /* Base */, + ); + name = LaunchScreen.storyboard; + sourceTree = ""; + }; +/* End PBXVariantGroup section */ + +/* Begin XCBuildConfiguration section */ + 249021D3217E4FDB00AE95B9 /* Profile */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_NO_COMMON_BLOCKS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 9.0; + MTL_ENABLE_DEBUG_INFO = NO; + SDKROOT = iphoneos; + SUPPORTED_PLATFORMS = iphoneos; + TARGETED_DEVICE_FAMILY = "1,2"; + VALIDATE_PRODUCT = YES; + }; + name = Profile; + }; + 249021D4217E4FDB00AE95B9 /* Profile */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CLANG_ENABLE_MODULES = YES; + CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; + ENABLE_BITCODE = NO; + FRAMEWORK_SEARCH_PATHS = ( + "$(inherited)", + "$(PROJECT_DIR)/Flutter", + ); + INFOPLIST_FILE = Runner/Info.plist; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; + LIBRARY_SEARCH_PATHS = ( + "$(inherited)", + "$(PROJECT_DIR)/Flutter", + ); + PRODUCT_BUNDLE_IDENTIFIER = com.example.flutterHelper; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; + SWIFT_VERSION = 5.0; + VERSIONING_SYSTEM = "apple-generic"; + }; + name = Profile; + }; + 97C147031CF9000F007C117D /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = dwarf; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_TESTABILITY = YES; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_DYNAMIC_NO_PIC = NO; + GCC_NO_COMMON_BLOCKS = YES; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 9.0; + MTL_ENABLE_DEBUG_INFO = YES; + ONLY_ACTIVE_ARCH = YES; + SDKROOT = iphoneos; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Debug; + }; + 97C147041CF9000F007C117D /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_NO_COMMON_BLOCKS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 9.0; + MTL_ENABLE_DEBUG_INFO = NO; + SDKROOT = iphoneos; + SUPPORTED_PLATFORMS = iphoneos; + SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; + TARGETED_DEVICE_FAMILY = "1,2"; + VALIDATE_PRODUCT = YES; + }; + name = Release; + }; + 97C147061CF9000F007C117D /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CLANG_ENABLE_MODULES = YES; + CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; + ENABLE_BITCODE = NO; + FRAMEWORK_SEARCH_PATHS = ( + "$(inherited)", + "$(PROJECT_DIR)/Flutter", + ); + INFOPLIST_FILE = Runner/Info.plist; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; + LIBRARY_SEARCH_PATHS = ( + "$(inherited)", + "$(PROJECT_DIR)/Flutter", + ); + PRODUCT_BUNDLE_IDENTIFIER = com.example.flutterHelper; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + SWIFT_VERSION = 5.0; + VERSIONING_SYSTEM = "apple-generic"; + }; + name = Debug; + }; + 97C147071CF9000F007C117D /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CLANG_ENABLE_MODULES = YES; + CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; + ENABLE_BITCODE = NO; + FRAMEWORK_SEARCH_PATHS = ( + "$(inherited)", + "$(PROJECT_DIR)/Flutter", + ); + INFOPLIST_FILE = Runner/Info.plist; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; + LIBRARY_SEARCH_PATHS = ( + "$(inherited)", + "$(PROJECT_DIR)/Flutter", + ); + PRODUCT_BUNDLE_IDENTIFIER = com.example.flutterHelper; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; + SWIFT_VERSION = 5.0; + VERSIONING_SYSTEM = "apple-generic"; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 97C147031CF9000F007C117D /* Debug */, + 97C147041CF9000F007C117D /* Release */, + 249021D3217E4FDB00AE95B9 /* Profile */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 97C147061CF9000F007C117D /* Debug */, + 97C147071CF9000F007C117D /* Release */, + 249021D4217E4FDB00AE95B9 /* Profile */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = 97C146E61CF9000F007C117D /* Project object */; +} diff --git a/flutter_helper/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/flutter_helper/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata new file mode 100644 index 00000000..1d526a16 --- /dev/null +++ b/flutter_helper/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,7 @@ + + + + + diff --git a/flutter_helper/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/flutter_helper/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist new file mode 100644 index 00000000..18d98100 --- /dev/null +++ b/flutter_helper/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist @@ -0,0 +1,8 @@ + + + + + IDEDidComputeMac32BitWarning + + + diff --git a/flutter_helper/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings b/flutter_helper/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings new file mode 100644 index 00000000..f9b0d7c5 --- /dev/null +++ b/flutter_helper/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings @@ -0,0 +1,8 @@ + + + + + PreviewsEnabled + + + diff --git a/flutter_helper/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme b/flutter_helper/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme new file mode 100644 index 00000000..a28140cf --- /dev/null +++ b/flutter_helper/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme @@ -0,0 +1,91 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/flutter_helper/ios/Runner.xcworkspace/contents.xcworkspacedata b/flutter_helper/ios/Runner.xcworkspace/contents.xcworkspacedata new file mode 100644 index 00000000..1d526a16 --- /dev/null +++ b/flutter_helper/ios/Runner.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,7 @@ + + + + + diff --git a/flutter_helper/ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/flutter_helper/ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist new file mode 100644 index 00000000..18d98100 --- /dev/null +++ b/flutter_helper/ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist @@ -0,0 +1,8 @@ + + + + + IDEDidComputeMac32BitWarning + + + diff --git a/flutter_helper/ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings b/flutter_helper/ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings new file mode 100644 index 00000000..f9b0d7c5 --- /dev/null +++ b/flutter_helper/ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings @@ -0,0 +1,8 @@ + + + + + PreviewsEnabled + + + diff --git a/flutter_helper/ios/Runner/AppDelegate.swift b/flutter_helper/ios/Runner/AppDelegate.swift new file mode 100644 index 00000000..70693e4a --- /dev/null +++ b/flutter_helper/ios/Runner/AppDelegate.swift @@ -0,0 +1,13 @@ +import UIKit +import Flutter + +@UIApplicationMain +@objc class AppDelegate: FlutterAppDelegate { + override func application( + _ application: UIApplication, + didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? + ) -> Bool { + GeneratedPluginRegistrant.register(with: self) + return super.application(application, didFinishLaunchingWithOptions: launchOptions) + } +} diff --git a/flutter_helper/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json b/flutter_helper/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json new file mode 100644 index 00000000..d36b1fab --- /dev/null +++ b/flutter_helper/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json @@ -0,0 +1,122 @@ +{ + "images" : [ + { + "size" : "20x20", + "idiom" : "iphone", + "filename" : "Icon-App-20x20@2x.png", + "scale" : "2x" + }, + { + "size" : "20x20", + "idiom" : "iphone", + "filename" : "Icon-App-20x20@3x.png", + "scale" : "3x" + }, + { + "size" : "29x29", + "idiom" : "iphone", + "filename" : "Icon-App-29x29@1x.png", + "scale" : "1x" + }, + { + "size" : "29x29", + "idiom" : "iphone", + "filename" : "Icon-App-29x29@2x.png", + "scale" : "2x" + }, + { + "size" : "29x29", + "idiom" : "iphone", + "filename" : "Icon-App-29x29@3x.png", + "scale" : "3x" + }, + { + "size" : "40x40", + "idiom" : "iphone", + "filename" : "Icon-App-40x40@2x.png", + "scale" : "2x" + }, + { + "size" : "40x40", + "idiom" : "iphone", + "filename" : "Icon-App-40x40@3x.png", + "scale" : "3x" + }, + { + "size" : "60x60", + "idiom" : "iphone", + "filename" : "Icon-App-60x60@2x.png", + "scale" : "2x" + }, + { + "size" : "60x60", + "idiom" : "iphone", + "filename" : "Icon-App-60x60@3x.png", + "scale" : "3x" + }, + { + "size" : "20x20", + "idiom" : "ipad", + "filename" : "Icon-App-20x20@1x.png", + "scale" : "1x" + }, + { + "size" : "20x20", + "idiom" : "ipad", + "filename" : "Icon-App-20x20@2x.png", + "scale" : "2x" + }, + { + "size" : "29x29", + "idiom" : "ipad", + "filename" : "Icon-App-29x29@1x.png", + "scale" : "1x" + }, + { + "size" : "29x29", + "idiom" : "ipad", + "filename" : "Icon-App-29x29@2x.png", + "scale" : "2x" + }, + { + "size" : "40x40", + "idiom" : "ipad", + "filename" : "Icon-App-40x40@1x.png", + "scale" : "1x" + }, + { + "size" : "40x40", + "idiom" : "ipad", + "filename" : "Icon-App-40x40@2x.png", + "scale" : "2x" + }, + { + "size" : "76x76", + "idiom" : "ipad", + "filename" : "Icon-App-76x76@1x.png", + "scale" : "1x" + }, + { + "size" : "76x76", + "idiom" : "ipad", + "filename" : "Icon-App-76x76@2x.png", + "scale" : "2x" + }, + { + "size" : "83.5x83.5", + "idiom" : "ipad", + "filename" : "Icon-App-83.5x83.5@2x.png", + "scale" : "2x" + }, + { + "size" : "1024x1024", + "idiom" : "ios-marketing", + "filename" : "Icon-App-1024x1024@1x.png", + "scale" : "1x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} diff --git a/flutter_helper/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png b/flutter_helper/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png new file mode 100644 index 00000000..dc9ada47 Binary files /dev/null and b/flutter_helper/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png differ diff --git a/flutter_helper/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png b/flutter_helper/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png new file mode 100644 index 00000000..28c6bf03 Binary files /dev/null and b/flutter_helper/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png differ diff --git a/flutter_helper/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png b/flutter_helper/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png new file mode 100644 index 00000000..2ccbfd96 Binary files /dev/null and b/flutter_helper/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png differ diff --git a/flutter_helper/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png b/flutter_helper/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png new file mode 100644 index 00000000..f091b6b0 Binary files /dev/null and b/flutter_helper/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png differ diff --git a/flutter_helper/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png b/flutter_helper/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png new file mode 100644 index 00000000..4cde1211 Binary files /dev/null and b/flutter_helper/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png differ diff --git a/flutter_helper/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png b/flutter_helper/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png new file mode 100644 index 00000000..d0ef06e7 Binary files /dev/null and b/flutter_helper/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png differ diff --git a/flutter_helper/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png b/flutter_helper/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png new file mode 100644 index 00000000..dcdc2306 Binary files /dev/null and b/flutter_helper/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png differ diff --git a/flutter_helper/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png b/flutter_helper/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png new file mode 100644 index 00000000..2ccbfd96 Binary files /dev/null and b/flutter_helper/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png differ diff --git a/flutter_helper/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png b/flutter_helper/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png new file mode 100644 index 00000000..c8f9ed8f Binary files /dev/null and b/flutter_helper/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png differ diff --git a/flutter_helper/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png b/flutter_helper/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png new file mode 100644 index 00000000..a6d6b860 Binary files /dev/null and b/flutter_helper/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png differ diff --git a/flutter_helper/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png b/flutter_helper/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png new file mode 100644 index 00000000..a6d6b860 Binary files /dev/null and b/flutter_helper/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png differ diff --git a/flutter_helper/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png b/flutter_helper/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png new file mode 100644 index 00000000..75b2d164 Binary files /dev/null and b/flutter_helper/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png differ diff --git a/flutter_helper/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png b/flutter_helper/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png new file mode 100644 index 00000000..c4df70d3 Binary files /dev/null and b/flutter_helper/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png differ diff --git a/flutter_helper/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png b/flutter_helper/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png new file mode 100644 index 00000000..6a84f41e Binary files /dev/null and b/flutter_helper/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png differ diff --git a/flutter_helper/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png b/flutter_helper/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png new file mode 100644 index 00000000..d0e1f585 Binary files /dev/null and b/flutter_helper/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png differ diff --git a/flutter_helper/ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json b/flutter_helper/ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json new file mode 100644 index 00000000..0bedcf2f --- /dev/null +++ b/flutter_helper/ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json @@ -0,0 +1,23 @@ +{ + "images" : [ + { + "idiom" : "universal", + "filename" : "LaunchImage.png", + "scale" : "1x" + }, + { + "idiom" : "universal", + "filename" : "LaunchImage@2x.png", + "scale" : "2x" + }, + { + "idiom" : "universal", + "filename" : "LaunchImage@3x.png", + "scale" : "3x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} diff --git a/flutter_helper/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png b/flutter_helper/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png new file mode 100644 index 00000000..9da19eac Binary files /dev/null and b/flutter_helper/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png differ diff --git a/flutter_helper/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png b/flutter_helper/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png new file mode 100644 index 00000000..9da19eac Binary files /dev/null and b/flutter_helper/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png differ diff --git a/flutter_helper/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png b/flutter_helper/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png new file mode 100644 index 00000000..9da19eac Binary files /dev/null and b/flutter_helper/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png differ diff --git a/flutter_helper/ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md b/flutter_helper/ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md new file mode 100644 index 00000000..89c2725b --- /dev/null +++ b/flutter_helper/ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md @@ -0,0 +1,5 @@ +# Launch Screen Assets + +You can customize the launch screen with your own desired assets by replacing the image files in this directory. + +You can also do it by opening your Flutter project's Xcode project with `open ios/Runner.xcworkspace`, selecting `Runner/Assets.xcassets` in the Project Navigator and dropping in the desired images. \ No newline at end of file diff --git a/flutter_helper/ios/Runner/Base.lproj/LaunchScreen.storyboard b/flutter_helper/ios/Runner/Base.lproj/LaunchScreen.storyboard new file mode 100644 index 00000000..f2e259c7 --- /dev/null +++ b/flutter_helper/ios/Runner/Base.lproj/LaunchScreen.storyboard @@ -0,0 +1,37 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/flutter_helper/ios/Runner/Base.lproj/Main.storyboard b/flutter_helper/ios/Runner/Base.lproj/Main.storyboard new file mode 100644 index 00000000..f3c28516 --- /dev/null +++ b/flutter_helper/ios/Runner/Base.lproj/Main.storyboard @@ -0,0 +1,26 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/flutter_helper/ios/Runner/Info.plist b/flutter_helper/ios/Runner/Info.plist new file mode 100644 index 00000000..b8f70ad9 --- /dev/null +++ b/flutter_helper/ios/Runner/Info.plist @@ -0,0 +1,45 @@ + + + + + CFBundleDevelopmentRegion + $(DEVELOPMENT_LANGUAGE) + CFBundleExecutable + $(EXECUTABLE_NAME) + CFBundleIdentifier + $(PRODUCT_BUNDLE_IDENTIFIER) + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + flutter_helper + CFBundlePackageType + APPL + CFBundleShortVersionString + $(FLUTTER_BUILD_NAME) + CFBundleSignature + ???? + CFBundleVersion + $(FLUTTER_BUILD_NUMBER) + LSRequiresIPhoneOS + + UILaunchStoryboardName + LaunchScreen + UIMainStoryboardFile + Main + UISupportedInterfaceOrientations + + UIInterfaceOrientationPortrait + UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationLandscapeRight + + UISupportedInterfaceOrientations~ipad + + UIInterfaceOrientationPortrait + UIInterfaceOrientationPortraitUpsideDown + UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationLandscapeRight + + UIViewControllerBasedStatusBarAppearance + + + diff --git a/flutter_helper/ios/Runner/Runner-Bridging-Header.h b/flutter_helper/ios/Runner/Runner-Bridging-Header.h new file mode 100644 index 00000000..308a2a56 --- /dev/null +++ b/flutter_helper/ios/Runner/Runner-Bridging-Header.h @@ -0,0 +1 @@ +#import "GeneratedPluginRegistrant.h" diff --git a/flutter_helper/lib/base_app.dart b/flutter_helper/lib/base_app.dart new file mode 100644 index 00000000..078f58f8 --- /dev/null +++ b/flutter_helper/lib/base_app.dart @@ -0,0 +1,12 @@ +import 'package:flutter/cupertino.dart'; + +abstract class BaseApp extends StatelessWidget { + final String name; + final String imageName; + + const BaseApp({Key key, this.name, this.imageName}) : super(key: key); + + BaseApp.withNames(this.name, this.imageName) { + print('$name - $imageName'); + } +} diff --git a/flutter_helper/lib/boss/boss_app.dart b/flutter_helper/lib/boss/boss_app.dart new file mode 100644 index 00000000..3d20cf76 --- /dev/null +++ b/flutter_helper/lib/boss/boss_app.dart @@ -0,0 +1,23 @@ +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_helper/base_app.dart'; +import 'package:flutter_helper/boss/splash.dart'; + +class BossApp extends StatelessWidget { + @override + Widget build(BuildContext context) { + return MaterialApp( + theme: ThemeData( + primaryIconTheme: IconThemeData(color: Colors.white), + brightness: Brightness.light, + primaryColor: Color.fromARGB(255, 0, 215, 198), + accentColor: Colors.cyan[300]), + home: Scaffold( + appBar: AppBar( + title: Text("BossApp"), + ), + body: SplashPage(), + ), + ); + } +} diff --git a/flutter_helper/lib/boss/chat/chat_page.dart b/flutter_helper/lib/boss/chat/chat_page.dart new file mode 100644 index 00000000..42db3a77 --- /dev/null +++ b/flutter_helper/lib/boss/chat/chat_page.dart @@ -0,0 +1,43 @@ +import 'package:flutter/material.dart'; + +class ChatPage extends StatefulWidget { + @override + _ChatPageState createState() => _ChatPageState(); +} + +class _ChatPageState extends State + with AutomaticKeepAliveClientMixin { + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: AppBar( + elevation: 0.0, + centerTitle: true, + title: Text( + '聊 天', + style: TextStyle( + fontSize: 20.0, + color: Colors.white, + ), + ), + ), + body: Center( + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Text( + '暂无消息', + style: TextStyle( + color: Colors.grey, + fontSize: 26.0, + ), + ), + ], + ), + ), + ); + } + + @override + bool get wantKeepAlive => true; +} diff --git a/flutter_helper/lib/boss/company/company.dart b/flutter_helper/lib/boss/company/company.dart new file mode 100644 index 00000000..b3586a23 --- /dev/null +++ b/flutter_helper/lib/boss/company/company.dart @@ -0,0 +1,18 @@ +class Company { + final String id; + final String company; + final String logo; + final String info; + final String hot; + + Company({this.id, this.company, this.logo, this.info, this.hot}); + + factory Company.fromJson(Map json) { + return Company( + id: json['id'], + company: json['company'], + logo: json['logo'], + info: json['info'], + hot: json['hot']); + } +} diff --git a/flutter_helper/lib/boss/company/company_detail.dart b/flutter_helper/lib/boss/company/company_detail.dart new file mode 100644 index 00000000..00d59237 --- /dev/null +++ b/flutter_helper/lib/boss/company/company_detail.dart @@ -0,0 +1,14 @@ +class CompanyDetail { + final String id; + final String inc; + final List companyImgsResult; + + CompanyDetail({this.id, this.inc, this.companyImgsResult}); + + factory CompanyDetail.fromJson(Map json) { + return CompanyDetail( + id: json['id'], + inc: json['inc'], + companyImgsResult: json['companyImgsResult'] as List); + } +} \ No newline at end of file diff --git a/flutter_helper/lib/boss/company/company_item.dart b/flutter_helper/lib/boss/company/company_item.dart new file mode 100644 index 00000000..4891e08f --- /dev/null +++ b/flutter_helper/lib/boss/company/company_item.dart @@ -0,0 +1,79 @@ +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; + +import 'company.dart'; + +class CompanyItem extends StatelessWidget { + final Company company; + final String heroLogo; + VoidCallback onPressed; + + CompanyItem({Key key, this.company, this.heroLogo, this.onPressed}) + : super(key: key); + + @override + Widget build(BuildContext context) { + return GestureDetector( + onTap: onPressed, + child: Container( + margin: EdgeInsets.only(bottom: 10.0), + padding: EdgeInsets.fromLTRB(18.0, 10.0, 18.0, 10.0), + color: Colors.white, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisSize: MainAxisSize.min, + children: [ + Row( + children: [ + Padding( + padding: EdgeInsets.only(right: 20.0), + child: Hero( + tag: heroLogo, + child: Image.network( + company.logo, + width: 40, + ), + ), + ), + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Padding( + padding: EdgeInsets.only(bottom: 6.0), + child: Text( + company.company, + style: TextStyle( + color: Colors.black, + fontSize: 16, + ), + ), + ), + Text( + company.info, + style: TextStyle( + color: Colors.grey, + fontSize: 12, + ), + ) + ], + ), + ], + ), + Container( + decoration: BoxDecoration( + color: new Color(0xFFF6F6F8), + borderRadius: BorderRadius.all(Radius.circular(6.0)), + ), + padding: EdgeInsets.fromLTRB(3.0, 3.0, 8.0, 8.0), + margin: EdgeInsets.only(top: 12.0), + child: Text( + company.hot, + style: TextStyle(color: Color(0xFF9fa3b0)), + ), + ), + ], + ), + ), + ); + } +} diff --git a/flutter_helper/lib/boss/company/company_page.dart b/flutter_helper/lib/boss/company/company_page.dart new file mode 100644 index 00000000..016da501 --- /dev/null +++ b/flutter_helper/lib/boss/company/company_page.dart @@ -0,0 +1,96 @@ +import 'package:flutter/material.dart'; +import 'package:flutter_helper/boss/company/company.dart'; +import 'package:flutter_helper/boss/company/company_item.dart'; + +import 'company_page_detail.dart'; + +class CompanyPage extends StatefulWidget { + @override + _CompanyPageState createState() => _CompanyPageState(); +} + +class _CompanyPageState extends State + with AutomaticKeepAliveClientMixin { + Future> _fetchCompanyList() async { + List companyList = []; + for (int i = 0; i < 100; i++) { + companyList.add(Company( + id: "$i", + company: "科大讯飞$i", + logo: + "https://img.bosszhipin.com/beijin/mcs/useravatar/20171211/4d147d8bb3e2a3478e20b50ad614f4d02062e3aec7ce2519b427d24a3f300d68_s.jpg", + info: "已经上市移动互联网", + hot: "热🔥招:高级测试工程师 15k-18k", + )); + } + return companyList; + } + + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: AppBar( + elevation: 0.0, + centerTitle: true, + title: Text( + '公 司', + style: TextStyle(fontSize: 20.0, color: Colors.white), + ), + actions: [ + IconButton( + onPressed: () {}, + icon: Icon( + Icons.search, + color: Colors.white, + ), + ), + ], + ), + body: Center( + child: FutureBuilder( + future: _fetchCompanyList(), + builder: (context, snapshot) { + if (ConnectionState.none == snapshot.connectionState || + ConnectionState.waiting == snapshot.connectionState) { + return CircularProgressIndicator(); + } else if (snapshot.hasError) { + return Text('Error: ${snapshot.error}'); + } else { + return _createListView(context, snapshot); + } + }, + ), + ), + ); + } + + @override + bool get wantKeepAlive => true; + + Widget _createListView( + BuildContext context, AsyncSnapshot snapshot) { + List companyList = snapshot.data; + return ListView.builder( + key: new PageStorageKey('company-list'), + itemCount: companyList.length, + itemBuilder: (BuildContext context, int index) { + return CompanyItem( + onPressed: () { + Navigator.push( + context, + MaterialPageRoute( + // fullscreenDialog: true, + builder: (context) => CompanyDetailPage( + company: companyList[index], + heroLogo: "heroLogo$index", + ), + ), + ); + }, + company: companyList[index], + heroLogo: "heroLogo${index}", + ); + }, + ); + } +} diff --git a/flutter_helper/lib/boss/company/company_page_detail.dart b/flutter_helper/lib/boss/company/company_page_detail.dart new file mode 100644 index 00000000..7cf08579 --- /dev/null +++ b/flutter_helper/lib/boss/company/company_page_detail.dart @@ -0,0 +1,381 @@ +import 'package:flutter/material.dart'; +import 'package:flutter_helper/boss/company/company.dart'; +import 'package:flutter_helper/boss/company/company_detail.dart'; +import 'package:flutter_helper/boss/company/scroll_img_item.dart'; +import 'package:flutter_helper/boss/company/welfare_item.dart'; + +import 'gallery_page.dart'; + +class CompanyDetailPage extends StatefulWidget { + final Company company; + final String heroLogo; + + const CompanyDetailPage({Key key, this.company, this.heroLogo}) + : super(key: key); + + @override + State createState() => _CompanyDetailPageState(); +} + +class _CompanyDetailPageState extends State + with SingleTickerProviderStateMixin { + ScrollController _scrollController; + bool _isShow = false; + + Future _fetchCompan() async { + return CompanyDetail( + id: "id", + inc: "无锡红光标牌有限公司是一家集研发、生产、销售和服务于一体的专业标牌生产厂家。注册资金500万人民币。主要生产塑料基材、软塑透明树脂、金属、模内复合等标牌产品,洗衣机顶盖板总成,平衡板,以及塑印、彩印、顶盖板、吸音垫等产品。公司位于长江三角洲经济快速增长、风景秀丽的太湖之畔——无锡。 公司自1984年成立至今,已经过了3次跨越式的发展。2004年至今公司投入5000多万元资金建设新的生产基地,目前已竣工并投入生产,占地面积达40000m2,厂房面积近15000m2。公司2004年的年产值达4350多万元,并且每年以平均30%的速度快速增长。目前,本公司的产品已具备国际及国内多项质量认证证书,并为知名家用电器企业:小天鹅电器有限公司、三星电子有限公司、海尔集团、惠尔普等配套生产各类标牌。可以说客户是我们的老师,和他们合作使我们得到很多的学习机会来提高自身的技术水平和管理水平,是我们生产和发展的动力。 公司本着“千方百计生产出满足顾客期望和要求的产品”的宗旨,坚持“工厂出产的不仅仅是产品,更重要的是信誉和质量”的经营理念,不断吸收新技术、引进新设备,使公司的经济效益蒸蒸日上。相信公司将会永不停止探索和发展的脚步,和中国国内以及世界国际性大公司同步发展。", + companyImgsResult: [ + 'https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fimg.zcool.cn%2Fcommunity%2F017b2a5938c8bca8012193a37db72c.jpg%402o.jpg&refer=http%3A%2F%2Fimg.zcool.cn&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=jpeg?sec=1630492567&t=e72260aeba623b96fafb25502781e504', + 'https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fimg.zcool.cn%2Fcommunity%2F017b2a5938c8bca8012193a37db72c.jpg%402o.jpg&refer=http%3A%2F%2Fimg.zcool.cn&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=jpeg?sec=1630492567&t=e72260aeba623b96fafb25502781e504', + 'https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fimg.zcool.cn%2Fcommunity%2F017b2a5938c8bca8012193a37db72c.jpg%402o.jpg&refer=http%3A%2F%2Fimg.zcool.cn&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=jpeg?sec=1630492567&t=e72260aeba623b96fafb25502781e504', + 'https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fimg.zcool.cn%2Fcommunity%2F017b2a5938c8bca8012193a37db72c.jpg%402o.jpg&refer=http%3A%2F%2Fimg.zcool.cn&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=jpeg?sec=1630492567&t=e72260aeba623b96fafb25502781e504', + 'https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fimg.zcool.cn%2Fcommunity%2F017b2a5938c8bca8012193a37db72c.jpg%402o.jpg&refer=http%3A%2F%2Fimg.zcool.cn&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=jpeg?sec=1630492567&t=e72260aeba623b96fafb25502781e504', + 'https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fimg.zcool.cn%2Fcommunity%2F017b2a5938c8bca8012193a37db72c.jpg%402o.jpg&refer=http%3A%2F%2Fimg.zcool.cn&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=jpeg?sec=1630492567&t=e72260aeba623b96fafb25502781e504', + 'https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fimg.zcool.cn%2Fcommunity%2F017b2a5938c8bca8012193a37db72c.jpg%402o.jpg&refer=http%3A%2F%2Fimg.zcool.cn&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=jpeg?sec=1630492567&t=e72260aeba623b96fafb25502781e504', + 'https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fimg.zcool.cn%2Fcommunity%2F017b2a5938c8bca8012193a37db72c.jpg%402o.jpg&refer=http%3A%2F%2Fimg.zcool.cn&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=jpeg?sec=1630492567&t=e72260aeba623b96fafb25502781e504', + 'https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fimg.zcool.cn%2Fcommunity%2F017b2a5938c8bca8012193a37db72c.jpg%402o.jpg&refer=http%3A%2F%2Fimg.zcool.cn&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=jpeg?sec=1630492567&t=e72260aeba623b96fafb25502781e504', + 'https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fimg.zcool.cn%2Fcommunity%2F017b2a5938c8bca8012193a37db72c.jpg%402o.jpg&refer=http%3A%2F%2Fimg.zcool.cn&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=jpeg?sec=1630492567&t=e72260aeba623b96fafb25502781e504', + ], + ); + } + + _scrollListener() { + setState(() { + if (_scrollController.offset < 56 && _isShow) { + _isShow = false; + } else if (_scrollController.offset >= 56 && _isShow == false) { + _isShow = true; + } + }); + } + + @override + void initState() { + _scrollController = ScrollController(); + _scrollController.addListener(_scrollListener); + super.initState(); + } + + @override + void dispose() { + _scrollController.removeListener(_scrollListener); + _scrollController.dispose(); + super.dispose(); + } + + @override + Widget build(BuildContext context) { + return Center( + child: Scaffold( + backgroundColor: Color.fromARGB(255, 68, 76, 96), + body: Container( + decoration: BoxDecoration( + image: DecorationImage( + colorFilter: ColorFilter.mode( + Colors.black.withOpacity(0.1), + BlendMode.dstATop, + ), + fit: BoxFit.cover, + image: NetworkImage(widget.company.logo), + alignment: Alignment.center, + ), + ), + child: _companyDetailView(context), + ), + ), + ); + } + + _companyDetailView(BuildContext context) { + return Stack( + alignment: Alignment.bottomCenter, + children: [ + CustomScrollView( + controller: _scrollController, + slivers: [ + _buildSliverAppBar(), + _buildSliverList(), + ], + ), + ], + ); + } + + Widget _buildSliverAppBar() { + return SliverAppBar( + elevation: 0.0, + pinned: true, + backgroundColor: Color.fromARGB(_isShow ? 255 : 0, 68, 76, 96), + centerTitle: false, + title: Text( + widget.company.company, + style: TextStyle( + fontSize: 20.0, + color: Color.fromARGB(_isShow ? 255 : 0, 255, 255, 255), + ), + ), + actions: [ + IconButton( + onPressed: () {}, + icon: Icon( + Icons.search, + color: Colors.white, + )) + ], + ); + } + + Widget _buildSliverList() { + return SliverList( + delegate: SliverChildListDelegate( + [ + Row( + children: [ + Expanded( + flex: 3, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Padding( + padding: EdgeInsets.only( + top: 20.0, + left: 25.0, + bottom: 10.0, + ), + child: Text( + '${widget.company.company}', + style: TextStyle( + color: Colors.white, + fontWeight: FontWeight.bold, + fontSize: 25.0, + ), + ), + ), + Padding( + padding: EdgeInsets.only(left: 25.0), + child: Text( + '${widget.company.info}', + style: TextStyle( + color: Colors.white, + fontSize: 25.0, + ), + ), + ), + ], + ), + ), + Expanded( + child: Padding( + padding: EdgeInsets.only( + top: 25.0, + right: 30.0, + ), + child: Hero( + tag: widget.heroLogo, + child: ClipRRect( + borderRadius: BorderRadius.circular(8.0), + child: Image.network( + widget.company.logo, + width: 70, + height: 70, + ), + ), + ), + ), + ), + ], + ), + FutureBuilder( + future: _fetchCompan(), + builder: (context, snapshot) { + if (snapshot.hasData) { + return _companBody(context, snapshot); + } else if (snapshot.hasError) { + return Text('${snapshot.error}'); + } else { + return Center( + child: CircularProgressIndicator(), + ); + } + }, + ), + ], + ), + ); + } + + // 主体 + Widget _companBody( + BuildContext context, AsyncSnapshot snapshot) { + return Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Padding( + padding: EdgeInsets.only(top: 30.0, left: 25.0, right: 20.0), + child: _craeteWorkHours(), + ), + _createWelfareItem(), + Padding( + padding: EdgeInsets.only(left: 25.0, bottom: 20.0), + child: Text( + '公司介绍', + style: TextStyle( + color: Colors.white, + fontSize: 20.0, + ), + ), + ), + Padding( + padding: EdgeInsets.only(left: 25.0, bottom: 10.0, right: 25.0), + child: Text( + snapshot.data.inc, + textAlign: TextAlign.justify, + style: TextStyle( + color: Colors.white, + fontSize: 16.0, + ), + ), + ), + Padding( + padding: EdgeInsets.only(top: 20.0, left: 25.0, bottom: 10.0), + child: Text( + "公司照片", + style: new TextStyle(color: Colors.white, fontSize: 20.0), + ), + ), + Container( + margin: + EdgeInsets.only(left: 20.0, top: 20.0, right: 0.0, bottom: 50.0), + height: 120.0, + child: _createImgList(context, snapshot), + ) + ], + ); + } + + // 上班时间 + Widget _craeteWorkHours() { + return Wrap( + spacing: 40.0, + runSpacing: 16.0, + direction: Axis.horizontal, + children: [ + Row( + mainAxisSize: MainAxisSize.min, + children: [ + Icon( + Icons.access_alarm, + color: Colors.white, + size: 18.0, + ), + Padding( + padding: EdgeInsets.only(right: 6.0), + ), + Text( + '下午1:00-下午10:00', + style: new TextStyle(color: Colors.white, fontSize: 16.0), + ), + ], + ), + Row( + mainAxisSize: MainAxisSize.min, + children: [ + Icon( + Icons.account_balance_wallet, + color: Colors.white, + size: 18.0, + ), + Padding( + padding: EdgeInsets.only(right: 6.0), + ), + Text( + '大小周', + style: new TextStyle(color: Colors.white, fontSize: 16.0), + ), + ], + ), + Row( + mainAxisSize: MainAxisSize.min, + children: [ + Icon( + Icons.movie, + color: Colors.white, + size: 18.0, + ), + Padding( + padding: EdgeInsets.only(right: 6.0), + ), + Text( + '偶尔加班', + style: new TextStyle(color: Colors.white, fontSize: 16.0), + ), + ], + ), + ], + ); + } + + // 公司福利 + Widget _createWelfareItem() { + return Padding( + padding: const EdgeInsets.only( + top: 30.0, + bottom: 10.0, + ), + child: Container( + margin: EdgeInsets.only(left: 20.0, top: 0.0, right: 0.0, bottom: 20.0), + height: 120.0, + child: ListView( + scrollDirection: Axis.horizontal, + children: [ + WelfareItem(iconData: Icons.flip, title: "五险一金"), + WelfareItem(iconData: Icons.security, title: "补充医疗\n保险"), + WelfareItem(iconData: Icons.access_alarm, title: "定期体检"), + WelfareItem(iconData: Icons.face, title: "年终奖"), + WelfareItem(iconData: Icons.brightness_5, title: "带薪年假"), + ], + ), + ), + ); + } + + // 公司照片 + // 公司照片 + Widget _createImgList(BuildContext context, AsyncSnapshot snapshot) { + List imgList = snapshot.data.companyImgsResult; + return ListView.builder( + key: PageStorageKey('img-list'), + scrollDirection: Axis.horizontal, + itemCount: imgList.length, + itemBuilder: (BuildContext context, int index) { + return ScrollImageItem( + url: imgList[index], + heroTag: 'heroTag$index', + onPressed: () { + Navigator.of(context).push( + PageRouteBuilder( + pageBuilder: (BuildContext context, + Animation animation, + Animation secondaryAnimation) { + return AnimatedBuilder( + animation: animation, + builder: (BuildContext context, Widget child) { + return Opacity( + opacity: animation.value, + child: GalleryPage( + url: imgList[index], + heroTag: 'heroTag$index', + ), + ); + }); + }, + transitionDuration: Duration(milliseconds: 300), + ), + ); + }, + ); + }); + } +} diff --git a/flutter_helper/lib/boss/company/gallery_page.dart b/flutter_helper/lib/boss/company/gallery_page.dart new file mode 100644 index 00000000..77bca7de --- /dev/null +++ b/flutter_helper/lib/boss/company/gallery_page.dart @@ -0,0 +1,40 @@ +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; + +class GalleryPage extends StatelessWidget { + final String url; + final String heroTag; + + const GalleryPage({Key key, this.url, this.heroTag}) : super(key: key); + + @override + Widget build(BuildContext context) { + return Scaffold( + backgroundColor: Color.fromARGB(100, 0, 0, 0), + appBar: AppBar( + backgroundColor: Color.fromARGB(100, 0, 0, 0), + ), + body: Padding( + padding: EdgeInsets.all(30.0), + child: Stack( + children: [ + Align( + alignment: Alignment(0, -0.2), + child: Hero( + tag: heroTag, + child: Container( + width: MediaQuery.of(context).size.width, + child: Image.network( + url, + width: 300, + fit: BoxFit.cover, + ), + ), + ), + ), + ], + ), + ), + ); + } +} diff --git a/flutter_helper/lib/boss/company/scroll_img_item.dart b/flutter_helper/lib/boss/company/scroll_img_item.dart new file mode 100644 index 00000000..b431a237 --- /dev/null +++ b/flutter_helper/lib/boss/company/scroll_img_item.dart @@ -0,0 +1,31 @@ +import 'package:flutter/cupertino.dart'; + +class ScrollImageItem extends StatelessWidget { + final String url; + final String heroTag; + VoidCallback onPressed; + + ScrollImageItem({Key key, this.url, this.heroTag, this.onPressed}) : super(key: + key); + + @override + Widget build(BuildContext context) { + return GestureDetector( + onTap: onPressed, + child: Hero( + tag: heroTag, + child: Container( + margin: EdgeInsets.only(right: 20.0), + child: ClipRRect( + borderRadius: BorderRadius.circular(8.0), + child: Image.network( + url, + width: 300, + fit: BoxFit.cover, + ), + ), + ), + ), + ); + } +} diff --git a/flutter_helper/lib/boss/company/welfare_item.dart b/flutter_helper/lib/boss/company/welfare_item.dart new file mode 100644 index 00000000..b2aa9a9a --- /dev/null +++ b/flutter_helper/lib/boss/company/welfare_item.dart @@ -0,0 +1,43 @@ +import 'package:flutter/material.dart'; + +class WelfareItem extends StatelessWidget { + WelfareItem({Key key, this.iconData, this.title}) : super(key: key); + + final IconData iconData; + final String title; + + @override + Widget build(BuildContext context) { + return Container( + width: 100.0, + height: 120.0, + alignment: Alignment.centerLeft, + padding: EdgeInsets.all(12.0), + margin: EdgeInsets.symmetric(horizontal: 6.0), + decoration: BoxDecoration( + borderRadius: BorderRadius.all(Radius.circular(6.0)), + border: Border.all( + color: Colors.white, + width: 0.25, + ), + ), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Icon( + iconData, + color: Colors.white, + size: 32.0, + ), + Padding( + padding: EdgeInsets.only(top: 8.0), + ), + Text( + title, + style: new TextStyle(color: Colors.white, fontSize: 18.0), + ), + ], + ), + ); + } +} diff --git a/flutter_helper/lib/boss/job/job.dart b/flutter_helper/lib/boss/job/job.dart new file mode 100644 index 00000000..1de59202 --- /dev/null +++ b/flutter_helper/lib/boss/job/job.dart @@ -0,0 +1,32 @@ +class Job { + final String id; + final String title; + final String salary; + final String company; + final String info; + final String category; + final String head; + final String publish; + + Job( + {this.id, + this.title, + this.salary, + this.company, + this.info, + this.category, + this.head, + this.publish}); + + factory Job.fromJson(Map json) { + return Job( + title: json['title'], + salary: json['salary'], + company: json['company'], + info: json['info'], + category: json['category'], + head: json['head'], + publish: json['publish'], + ); + } +} diff --git a/flutter_helper/lib/boss/job/job_item.dart b/flutter_helper/lib/boss/job/job_item.dart new file mode 100644 index 00000000..ea963308 --- /dev/null +++ b/flutter_helper/lib/boss/job/job_item.dart @@ -0,0 +1,72 @@ +import 'package:flutter/material.dart'; + +import 'job.dart'; + +class JobItem extends StatelessWidget { + final Job job; + VoidCallback onPressed; + + JobItem({Key key, this.job, this.onPressed}) : super(key: key); + + @override + Widget build(BuildContext context) { + return GestureDetector( + onTap: onPressed, + child: Container( + margin: EdgeInsets.only(bottom: 10.0), + padding: EdgeInsets.fromLTRB(18.0, 10.0, 18.0, 10.0), + color: Colors.white, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisSize: MainAxisSize.min, + children: [ + Row( + children: [ + Expanded( + child: Text( + job.title, + style: TextStyle(color: Colors.black, fontSize: 16), + ), + ), + Text( + job.salary, + style: TextStyle( + color: Colors.black, + fontSize: 16, + ), + ) + ], + ), + Padding( + padding: EdgeInsets.only(top: 8.0), + child: Text(job.company), + ), + Container( + decoration: BoxDecoration( + color: Color(0xFFF6F6F8), + borderRadius: BorderRadius.all(Radius.circular(6.0)), + ), + padding: EdgeInsets.fromLTRB(3.0, 3.0, 8.0, 8.0), + child: Text( + job.info, + style: TextStyle(color: Color(0xFF9fa3b0)), + ), + ), + Row( + children: [ + CircleAvatar( + backgroundImage: NetworkImage('https://img.bosszhipin.com/beijin/mcs/useravatar/20171211/4d147d8bb3e2a3478e20b50ad614f4d02062e3aec7ce2519b427d24a3f300d68_s.jpg'), + radius: 15, + ), + Padding( + padding: EdgeInsets.only(left: 8.0), + child: Text(job.publish), + ), + ], + ), + ], + ), + ), + ); + } +} diff --git a/flutter_helper/lib/boss/job/job_page.dart b/flutter_helper/lib/boss/job/job_page.dart new file mode 100644 index 00000000..9ee212a6 --- /dev/null +++ b/flutter_helper/lib/boss/job/job_page.dart @@ -0,0 +1,85 @@ +import 'dart:io'; + +import 'package:flutter/material.dart'; +import 'package:flutter_helper/boss/job/job_item.dart'; +import 'package:flutter_helper/boss/utils.dart'; + +import 'job.dart'; + +class JobPage extends StatefulWidget { + @override + _JobPageState createState() => _JobPageState(); +} + +class _JobPageState extends State with AutomaticKeepAliveClientMixin { + List listJobs = []; + + Future> _fetchJobList() async { + for (int i = 0; i < 100; i++) { + listJobs.add(Job( + id: "id", + title: "开发工程师", + salary: "10K-20K", + company: "EYE公司", + info: "Stemcor 於 1951 年在倫敦成立,乃國際化的鋼材貿易商、分銷商和儲存商。 作為私營公司,我們是獨立的貿易商,表示本公司不屬任何鋼鐵生產商所有,也不控制任何鋼鐵生產商。。", + category: "category", + head: "http://img0.baidu.com/it/u=3311900507,1448170316&fm=26&fmt=auto&gp=0.jpg", + publish: "发布于12月31日")); + } + // sleep(Duration(milliseconds: 3000)); + return listJobs; + } + + @override + Widget build(BuildContext context) { + return Center( + child: Scaffold( + appBar: AppBar( + elevation: 0.0, + centerTitle: true, + title: Text( + '职位', + style: TextStyle( + fontSize: 20.0, + color: Colors.white, + ), + ), + ), + body: Center( + child: FutureBuilder( + future: _fetchJobList(), + builder: (context, snapshot) { + if (snapshot.connectionState == ConnectionState.none || + snapshot.connectionState == ConnectionState.waiting) { + return CircularProgressIndicator(); + } else if (snapshot.hasError) { + return Text('Error: ${snapshot.error}'); + } else { + return _createListView(context, snapshot); + } + }, + ), + ), + ), + ); + } + + Widget _createListView(BuildContext context, AsyncSnapshot snapshot) { + List jobList = snapshot.data; + return ListView.builder( + key: PageStorageKey('job-list'), + itemCount: jobList.length, + itemBuilder: (BuildContext context, int index) { + return JobItem( + onPressed: () { + showToast(jobList[index].toString()); + }, + job: jobList[index], + ); + }, + ); + } + + @override + bool get wantKeepAlive => true; +} diff --git a/flutter_helper/lib/boss/layout_type.dart b/flutter_helper/lib/boss/layout_type.dart new file mode 100644 index 00000000..e6b2fcf7 --- /dev/null +++ b/flutter_helper/lib/boss/layout_type.dart @@ -0,0 +1,22 @@ +import 'package:flutter/foundation.dart'; + +abstract class HasLayoutGroup { + VoidCallback get onLayouttoggle; +} + +enum LayoutType { job, company, chat, mine } + +String layoutName(LayoutType layoutType) { + switch (layoutType) { + case LayoutType.job: + return '职位'; + case LayoutType.company: + return '公司'; + case LayoutType.chat: + return '消息'; + case LayoutType.mine: + return '我的'; + default: + return ''; + } +} diff --git a/flutter_helper/lib/boss/mainpage.dart b/flutter_helper/lib/boss/mainpage.dart new file mode 100644 index 00000000..e771a2be --- /dev/null +++ b/flutter_helper/lib/boss/mainpage.dart @@ -0,0 +1,120 @@ +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_helper/boss/chat/chat_page.dart'; +import 'package:flutter_helper/boss/company/company_page.dart'; +import 'package:flutter_helper/boss/job/job_page.dart'; +import 'package:flutter_helper/boss/layout_type.dart'; +import 'package:flutter_helper/boss/mine/mine_page.dart'; + +class MainPage extends StatefulWidget { + final String title; + + MainPage({Key key, this.title}) : super(key: key); + + @override + State createState() => _MainPageState(); +} + +class _MainPageState extends State { + LayoutType _layoutSelection = LayoutType.job; + + Color _colorTabMatching({LayoutType layoutSelection}) { + return _layoutSelection == layoutSelection ? Colors.cyan[300] : Colors.grey; + } + + BottomNavigationBarItem _buildItem( + {String icon, LayoutType layoutSelection}) { + String text = layoutName(layoutSelection); + return BottomNavigationBarItem( + icon: Image.asset( + icon, + width: 35.0, + height: 35.0, + ), + //label: text, + title: Text( + text, + style: TextStyle( + color: _colorTabMatching(layoutSelection: layoutSelection)), + ), + ); + } + + Widget _buildButtonNavBar() { + return BottomNavigationBar( + type: BottomNavigationBarType.fixed, + onTap: _onSelectTab, + items: [ + _buildItem( + icon: _layoutSelection == LayoutType.job + ? "images/ic_main_tab_find_pre.png" + : "images/ic_main_tab_find_nor.png", + layoutSelection: LayoutType.job, + ), + _buildItem( + icon: _layoutSelection == LayoutType.company + ? "images/ic_main_tab_company_pre.png" + : "images/ic_main_tab_company_nor.png", + layoutSelection: LayoutType.company, + ), + _buildItem( + icon: _layoutSelection == LayoutType.chat + ? "images/ic_main_tab_contacts_pre.png" + : "images/ic_main_tab_contacts_nor.png", + layoutSelection: LayoutType.chat, + ), + _buildItem( + icon: _layoutSelection == LayoutType.mine + ? "images/ic_main_tab_my_pre.png" + : "images/ic_main_tab_my_nor.png", + layoutSelection: LayoutType.mine, + ), + ], + ); + } + + void _onLayoutSelected(LayoutType selection) { + setState(() { + _layoutSelection = selection; + }); + } + + void _onSelectTab(int index) { + switch (index) { + case 0: + _onLayoutSelected(LayoutType.job); + break; + case 1: + _onLayoutSelected(LayoutType.company); + break; + case 2: + _onLayoutSelected(LayoutType.chat); + break; + case 3: + _onLayoutSelected(LayoutType.mine); + break; + } + } + + Widget _buildBody() { + LayoutType layoutSelection = _layoutSelection; + switch (layoutSelection) { + case LayoutType.job: + return JobPage(); + case LayoutType.company: + return CompanyPage(); + case LayoutType.chat: + return ChatPage(); + case LayoutType.mine: + return MinePage(); + } + } + + @override + Widget build(BuildContext context) { + return Scaffold( + body: _buildBody(), + bottomNavigationBar: _buildButtonNavBar(), + ); + } +} diff --git a/flutter_helper/lib/boss/mine/contact_item.dart b/flutter_helper/lib/boss/mine/contact_item.dart new file mode 100644 index 00000000..4d4e914b --- /dev/null +++ b/flutter_helper/lib/boss/mine/contact_item.dart @@ -0,0 +1,32 @@ +import 'package:flutter/material.dart'; + +class ContactItem extends StatelessWidget { + const ContactItem({Key key, this.count, this.title, this.onPressed}) + : super(key: key); + + final String count; + final String title; + final VoidCallback onPressed; + + @override + Widget build(BuildContext context) { + return GestureDetector( + onTap: onPressed, + child: Column( + children: [ + Padding( + padding: EdgeInsets.only(bottom: 4.0), + child: Text( + count, + style: TextStyle(fontSize: 18.0), + ), + ), + Text( + title, + style: TextStyle(color: Colors.black54, fontSize: 14.0), + ), + ], + ), + ); + } +} diff --git a/flutter_helper/lib/boss/mine/menu_item.dart b/flutter_helper/lib/boss/mine/menu_item.dart new file mode 100644 index 00000000..0e45a685 --- /dev/null +++ b/flutter_helper/lib/boss/mine/menu_item.dart @@ -0,0 +1,52 @@ +import 'package:flutter/material.dart'; +import 'package:flutter_helper/boss/utils.dart'; +import 'package:flutter_helper/utils/util_log.dart'; + +class MenuItem extends StatelessWidget { + final IconData icon; + final String title; + final VoidCallback onPressed; + + const MenuItem({Key key, this.icon, this.title, this.onPressed}) + : super(key: key); + + @override + Widget build(BuildContext context) { + return GestureDetector( + onTap: () { + LogUtil.e('$title'); + showToast(this.title); + // onPressed(); + }, + child: Column( + children: [ + Padding( + padding: EdgeInsets.fromLTRB(20.0, 12.0, 20.0, 10.0), + child: Row( + children: [ + Padding( + padding: EdgeInsets.only(right: 8.0), + child: Icon(icon, color: Colors.black54), + ), + Expanded( + child: Text( + title, + style: TextStyle( + color: Colors.black54, + fontSize: 16.0, + ), + ), + ), + Icon(Icons.chevron_right, color: Colors.grey), + ], + ), + ), + Padding( + padding: const EdgeInsets.only(left: 20.0, right: 20.0), + child: Divider(), + ) + ], + ), + ); + } +} diff --git a/flutter_helper/lib/boss/mine/mine_page.dart b/flutter_helper/lib/boss/mine/mine_page.dart new file mode 100644 index 00000000..5a618507 --- /dev/null +++ b/flutter_helper/lib/boss/mine/mine_page.dart @@ -0,0 +1,139 @@ +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_helper/boss/mine/contact_item.dart'; +import 'package:flutter_helper/boss/mine/menu_item.dart'; + +class MinePage extends StatefulWidget { + @override + _MinePageState createState() => _MinePageState(); +} + +class _MinePageState extends State + with AutomaticKeepAliveClientMixin { + final double _appBarHeight = 180.0; + final String _userHead = + 'https://img.bosszhipin.com/beijin/mcs/useravatar/20171211/4d147d8bb3e2a3478e20b50ad614f4d02062e3aec7ce2519b427d24a3f300d68_s.jpg'; + + @override + bool get wantKeepAlive => true; + + @override + Widget build(BuildContext context) { + return Scaffold( + backgroundColor: Color.fromARGB(255, 242, 242, 245), + body: CustomScrollView( + slivers: [ + SliverAppBar( + expandedHeight: _appBarHeight, + flexibleSpace: FlexibleSpaceBar( + collapseMode: CollapseMode.parallax, + background: backgroundWidget(), + ), + ), + SliverList(delegate: SliverChildListDelegate(delegateChildren())) + ], + ), + ); + } + + Widget backgroundWidget() => Stack( + fit: StackFit.expand, + children: [ + DecoratedBox( + decoration: BoxDecoration( + gradient: LinearGradient( + begin: Alignment(0.0, -1.0), + end: Alignment(0.0, -0.4), + colors: [ + Color(0x00000000), + Color(0x00000000), + ], + ), + ), + ), + Row( + mainAxisAlignment: MainAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Expanded( + flex: 3, + child: Column( + children: [ + Padding( + padding: EdgeInsets.only( + top: 30.0, + left: 30.0, + bottom: 15.0, + ), + child: Text( + 'kimi he', + style: TextStyle( + color: Colors.white, + fontWeight: FontWeight.bold, + fontSize: 35.0, + ), + ), + ), + Padding( + padding: EdgeInsets.only(left: 30.0), + child: Text( + '在职-不考虑v机会', + style: TextStyle( + color: Colors.white, + fontSize: 15.0, + ), + ), + ), + ], + ), + ), + Expanded( + flex: 1, + child: Padding( + padding: EdgeInsets.only(top: 40.0, right: 30.0), + child: CircleAvatar( + radius: 35.0, + backgroundImage: NetworkImage(_userHead), + ), + ), + ) + ], + ), + ], + ); + + List delegateChildren() => [ + Container( + color: Colors.white, + child: Padding( + padding: EdgeInsets.only(top: 10.0, bottom: 10.0), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceAround, + children: [ + ContactItem(count: '696', title: '沟通过'), + ContactItem(count: '0', title: '面试'), + ContactItem(count: '71', title: '已投递'), + ContactItem(count: '53', title: '感兴趣'), + ], + ), + ), + ), + Container( + color: Colors.white, + margin: const EdgeInsets.only(top: 10.0), + child: Column( + children: [ + MenuItem(icon: Icons.face, title: "体验新版本"), + MenuItem(icon: Icons.print, title: "我的微简历"), + MenuItem(icon: Icons.archive, title: "附件简历"), + MenuItem(icon: Icons.home, title: "管理求职意见"), + MenuItem(icon: Icons.title, title: "提升简历排名"), + MenuItem(icon: Icons.chat, title: "牛人问答"), + MenuItem(icon: Icons.assessment, title: "关注公司"), + MenuItem(icon: Icons.add_shopping_cart, title: "钱包"), + MenuItem(icon: Icons.security, title: "隐私设置"), + ], + ), + ), + ]; +} diff --git a/flutter_helper/lib/boss/splash.dart b/flutter_helper/lib/boss/splash.dart new file mode 100644 index 00000000..e528994f --- /dev/null +++ b/flutter_helper/lib/boss/splash.dart @@ -0,0 +1,65 @@ +import 'dart:async'; + +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; + +import 'mainpage.dart'; + +class SplashPage extends StatefulWidget { + @override + State createState() { + return SplashState(); + } +} + +class SplashState extends State { + + Timer _t; // 延迟 + + @override + void initState() { + _t = Timer(Duration(milliseconds: 100), () { + try { + Navigator.of(context).pushAndRemoveUntil( + PageRouteBuilder( + pageBuilder: (context, animation, secondaryAnimation) { + return AnimatedBuilder(animation: animation, builder: + (context, child) { + return Opacity(opacity: animation.value + , child: MainPage(),); + } + ); + } + ) + , (route) => route == null); + } catch (e) { + + } + }); + super.initState(); + } + + @override + void dispose() { + _t.cancel(); + super.dispose(); + } + + @override + Widget build(BuildContext context) { + return Material( + color: Color.fromARGB(255, 0, 215, 198), + child: Container( + alignment: Alignment(0, -0.3), + child: Text( + "BOOS", + style: TextStyle( + color: Colors.white, + fontSize: 50.0, + fontWeight: FontWeight.bold, + ), + ), + ), + ); + } +} \ No newline at end of file diff --git a/flutter_helper/lib/boss/utils.dart b/flutter_helper/lib/boss/utils.dart new file mode 100644 index 00000000..efbf1453 --- /dev/null +++ b/flutter_helper/lib/boss/utils.dart @@ -0,0 +1,13 @@ +import 'package:flutter/material.dart'; +import 'package:fluttertoast/fluttertoast.dart'; + +showToast(String txt) { + Fluttertoast.showToast( + msg: txt, + toastLength: Toast.LENGTH_SHORT, + gravity: ToastGravity.BOTTOM, + timeInSecForIosWeb: 1, + backgroundColor: Colors.black45, + textColor: Colors.white, + fontSize: 16.0); +} diff --git a/flutter_helper/lib/main.dart b/flutter_helper/lib/main.dart new file mode 100644 index 00000000..ef34f71d --- /dev/null +++ b/flutter_helper/lib/main.dart @@ -0,0 +1,298 @@ +import 'package:flutter/material.dart'; +import 'package:flutter_helper/boss/boss_app.dart'; +import 'package:flutter_helper/other/other_app.dart'; +import 'package:flutter_helper/utils/util_log.dart'; +import 'package:flutter_helper/widgets/a001_about_dialog.dart'; +import 'package:flutter_helper/widgets/a002_about_list_tile.dart'; +import 'package:flutter_helper/widgets/a003_absorbpointer.dart'; +import 'package:flutter_helper/widgets/a004_actionchip.dart'; +import 'package:flutter_helper/widgets/a005_alertdialog.dart'; +import 'package:flutter_helper/widgets/a006_align.dart'; +import 'package:flutter_helper/widgets/a007_aniatedbuilder.dart'; +import 'package:flutter_helper/widgets/a008_animated_container.dart'; +import 'package:flutter_helper/widgets/a009_animated_crossfade.dart'; +import 'package:flutter_helper/widgets/a010_animate_default_textstyle.dart'; +import 'package:flutter_helper/widgets/a011_animate_icon.dart'; +import 'package:flutter_helper/widgets/a012_animate_list.dart'; +import 'package:flutter_helper/widgets/a013_animate_modalbarrier.dart'; +import 'package:flutter_helper/widgets/a014_animate_opacity.dart'; +import 'package:flutter_helper/widgets/a015_animate_padding.dart'; +import 'package:flutter_helper/widgets/a016_animate_physicalmodel.dart'; +import 'package:flutter_helper/widgets/a017_animate_positioned.dart'; +import 'package:flutter_helper/widgets/a018_animate_positioned_directional.dart'; +import 'package:flutter_helper/widgets/a019_animate_size.dart'; +import 'package:flutter_helper/widgets/a020_animate_switcher.dart'; +import 'package:flutter_helper/widgets/a021_appbar.dart'; +import 'package:flutter_helper/widgets/a023_buttons.dart'; +import 'package:flutter_helper/widgets/a024_backdropfilter.dart'; +import 'package:flutter_helper/widgets/a025_banner.dart'; +import 'package:flutter_helper/widgets/a026_baseline.dart'; +import 'package:flutter_helper/widgets/a027_border.dart'; +import 'package:flutter_helper/widgets/a028_bottomappbar.dart'; +import 'package:flutter_helper/widgets/a029_bottomnavigationbar.dart'; +import 'package:flutter_helper/widgets/a031_builder.dart'; +import 'package:flutter_helper/widgets/a032_card.dart'; +import 'package:flutter_helper/widgets/a033_circleavator.dart'; +import 'package:flutter_helper/widgets/a034_cpertinoactionsheet.dart'; +import 'package:flutter_helper/widgets/a035_indicator.dart'; +import 'package:flutter_helper/widgets/a036_cupertinocontextmenu.dart'; +import 'package:flutter_helper/widgets/a037_cupertinodatepicker.dart'; +import 'package:flutter_helper/widgets/a038_cupertinofullscrendialogtransitionr.dart'; +import 'package:flutter_helper/widgets/a039_cupertinonavigationnar.dart'; +import 'package:flutter_helper/widgets/a040_cupertinopicker.dart'; +import 'package:flutter_helper/widgets/a041_scrollbar.dart'; +import 'package:flutter_helper/widgets/a042_slider.dart'; +import 'package:flutter_helper/widgets/a043_refreshindicator.dart'; +import 'package:flutter_helper/widgets/a044_switch.dart'; +import 'package:flutter_helper/widgets/a045_cupertinotab.dart'; +import 'package:flutter_helper/widgets/a046_textfield.dart'; +import 'package:flutter_helper/widgets/a047_cliprect.dart'; +import 'package:flutter_helper/widgets/a048_custommultichildlayout.dart'; +import 'package:flutter_helper/widgets/a050_custompaint.dart'; +import 'package:flutter_helper/widgets/a051_customscrollview.dart'; +import 'package:flutter_helper/widgets/a052_customsinglechildlayout.dart'; +import 'package:flutter_helper/widgets/a053_datatable.dart'; +import 'package:flutter_helper/widgets/a054_decoratedbox.dart'; +import 'package:flutter_helper/widgets/a055decoratedboxtransition.dart'; +import 'package:flutter_helper/widgets/a056_teststyle.dart'; +import 'package:flutter_helper/widgets/a057_directionly.dart'; +import 'package:flutter_helper/widgets/a058_widgets.dart'; +import 'package:flutter_helper/widgets/a059_draggablescrollableactuator.dart'; +import 'package:flutter_helper/widgets/a059_draggablescrollablesheet.dart'; +import 'package:flutter_helper/widgets/a060_dropdownbuttonfromfield.dart'; +import 'package:flutter_helper/widgets/a061_expansiontile.dart'; +import 'package:flutter_helper/widgets/a062_flexiable.dart'; +import 'package:flutter_helper/widgets/a063_fadetransition.dart'; +import 'package:flutter_helper/widgets/a064_dialog.dart'; +import 'package:flutter_helper/widgets/a065_wrap.dart'; +import 'package:flutter_helper/widgets/a066_fittedbox.dart'; +import 'package:flutter_helper/widgets/a067_flexible.dart'; +import 'package:flutter_helper/widgets/a068_flexiblespacebar.dart'; +import 'package:flutter_helper/widgets/a069_flow.dart'; +import 'package:flutter_helper/widgets/a070_textfield.dart'; +import 'package:flutter_helper/widgets/a071_futurebuilder.dart'; +import 'package:flutter_helper/widgets/a072_gesturedetector.dart'; +import 'package:flutter_helper/widgets/a073_hero.dart'; +import 'package:flutter_helper/widgets/a074_intrinsicheight.dart'; +import 'package:flutter_helper/widgets/a075_nestedscrollview.dart'; +import 'package:flutter_helper/widgets/a076_notificationlistener.dart'; +import 'package:flutter_helper/widgets/a077_pageview.dart'; + +void main() { + LogUtil.init(isDebug: true); + + runApp(_HomeApp()); +} + +class _HomeApp extends StatelessWidget { + var list = [ + AboutListTileApp(), + AbsorbPointerApp(), + ActionChipApp(), + AlertDialogApp(), + AlignApp(), + AnimatedBuilderApp(), + AnimatedContainerApp(), + AnimatedCrossFadeApp(), + AnimatedDefaultTextStyleApp(), + AnimatedIconApp(), + AnimatedListApp(), + AnimatedModalBarrierApp(), + AnimatedOpacityApp(), + AnimatedPaddingApp(), + AnimatedPhysicalModelApp(), + AnimatedPositionedApp(), + AnimatedPositionedDirectionalApp(), + AnimatedSizeApp(), + AnimatedSwitcherApp(), + AppbarApp(), + ButtonsApp(), + BackdropFilterApp(), + BannerApp(), + BaselineApp(), + BorderApp(), + BottomAppBarApp(), + BottomNavigationBarApp(), + BuildApp(), + CardApp(), + CircleAvatorApp(), + CupertinoActionSheetApp(), + IndicatorApp(), + CupertinoContextMenuApp(), + CupertinoDatePickeruApp(), + CupertinoFullscreenDialogTransitionApp(), + CupertinoPageScaffoldApp(), + CupertinoPickerApp(), + ScrollbarApp(), + SliderApp(), + RefreshIndicatorApp(), + SwitchApp(), + CupertinoTabBarApp(), + TextFieldApp(), + ClipRectApp(), + CustomMultiChildLayoutApp(), + CustomPaintApp(), + CustomScrollViewApp(), + CustomSingleChildLayoutApp(), + DataTableApp(), + DecoratedBoxApp(), + DecoratedBoxTransitionApp(), + TextStyleApp(), + DirectionlyApp(), + Widgets2App(), + ScraaggableScrollableActuatorApp(), + DraggableScrollableSheetApp(), + DropdownButtonFromFieldApp(), + FlexiableApp(), + ExpansionTileApp(), + FadeTransitionApp(), + DialogsApp(), + WrapApp(), + FittedBoxApp(), + FlexibleApp(), + FlexibleSpaceBarApp(), + DemoFlowPopMenuApp(), + DemoFlowCircelApp(), + DemoFlowMenuApp(), + TextField222App(), + FutureBuilderApp(), + GestureDetectorApp(), + HeroApp(), + IntrinsicHeightApp(), + NestedScrollViewApp(), + NotificationListenerApp(), + PageViewApp() + ]; + + Widget buildList() { + return ListView.builder( + itemBuilder: (BuildContext context, int index) { + var name = list[index].toStringShort(); + // return Text('$name'); + // return Center(child: Text('$name')); + return SizedBox( + height: 30, + child: Row( + children: [ + Padding( + padding: EdgeInsets.only(right: 10, bottom: 2), + child: ElevatedButton( + child: Text('点击'), + onPressed: () { + var app = list[index]; + LogUtil.d(app); + Navigator.push(context, + MaterialPageRoute(builder: (context) { + return app; + })); + }, + ), + ), + SizedBox( + width: 10, + ), + Text('$name') + ], + ), + ); + }, + itemCount: list.length, + ); + } + + var listApp = [ + AppData(app: BossApp()), + AppData(app: OtherApp(), imageUrl: 'images/beatiful_lady.jpeg'), + AppData(app: OtherApp(), imageUrl: 'images/beatiful_lady.jpeg'), + AppData(app: OtherApp(), imageUrl: 'images/beatiful_lady.jpeg'), + AppData(app: OtherApp(), imageUrl: 'images/beatiful_lady.jpeg'), + AppData(app: OtherApp(), imageUrl: 'images/beatiful_lady.jpeg'), + AppData(app: OtherApp(), imageUrl: 'images/beatiful_lady.jpeg'), + AppData(app: OtherApp(), imageUrl: 'images/beatiful_lady.jpeg'), + AppData(app: OtherApp(), imageUrl: 'images/beatiful_lady.jpeg'), + AppData(app: OtherApp(), imageUrl: 'images/beatiful_lady.jpeg'), + AppData(app: OtherApp(), imageUrl: 'images/beatiful_lady.jpeg'), + AppData(app: OtherApp(), imageUrl: 'images/beatiful_lady.jpeg'), + AppData(app: OtherApp(), imageUrl: 'images/beatiful_lady.jpeg'), + AppData(app: OtherApp(), imageUrl: 'images/beatiful_lady.jpeg'), + AppData(app: OtherApp(), imageUrl: 'images/beatiful_lady.jpeg'), + ]; + + Widget buildHorizontal() { + return Container( + height: 100, + child: ListView.builder( + scrollDirection: Axis.horizontal, + itemBuilder: (BuildContext context, int index) { + var name = listApp[index].app.toStringShort(); + return GestureDetector( + onTap: () { + Navigator.push( + context, + MaterialPageRoute(builder: (_) { + return listApp[index].app; + }), + ); + }, + child: Padding( + padding: EdgeInsets.only(right: 10), + child: Column( + children: [ + Image.asset( + listApp[index].imageUrl, + width: 60, + height: 80, + ), + Text(name) + ], + ), + ), + ); + }, + itemCount: listApp.length, + ), + ); + } + + @override + Widget build(BuildContext context) { + return MaterialApp( + title: "Flutter DEMO APP", + theme: ThemeData( + primarySwatch: Colors.orange, + visualDensity: VisualDensity.adaptivePlatformDensity, + ), + home: Scaffold( + appBar: AppBar( + title: Text("Flutter"), + ), + body: Column( + children: [ + buildHorizontal(), + Expanded(child: buildList()), + ], + ), + // body: buildHorizontal(), + // body: Row( + // children: [ + // buildHorizontal(), + // buildList(), + // ], + // ), + ), + ); + } +} + +class AppData { + final String name; + final String imageUrl; + final Widget app; + + AppData({ + Key key, + this.app, + this.imageUrl = 'images/bossapp2x.png', + this.name = "app", + }); +} diff --git a/flutter_helper/lib/other/other_app.dart b/flutter_helper/lib/other/other_app.dart new file mode 100644 index 00000000..1afd88f6 --- /dev/null +++ b/flutter_helper/lib/other/other_app.dart @@ -0,0 +1,11 @@ +import 'package:flutter/cupertino.dart'; +import 'package:flutter_helper/base_app.dart'; + +class OtherApp extends StatelessWidget { + + + @override + Widget build(BuildContext context) { + return Image.asset('images/beatiful_lady.jpeg'); + } +} diff --git a/flutter_helper/lib/test/ConstructorDemo.dart b/flutter_helper/lib/test/ConstructorDemo.dart new file mode 100644 index 00000000..83ca8da4 --- /dev/null +++ b/flutter_helper/lib/test/ConstructorDemo.dart @@ -0,0 +1,173 @@ +import 'package:flutter/cupertino.dart'; + +class Person { + String name; + num age; + + Person({this.name, this.age}); + + Person.fromDictionary(Map dic) { + this.name = dic['name']; + this.age = dic['age']; + } +} + +class Person2 { + String firstName; + + // 无参数的,非命名的构造函数 + Person2() { + print('in Person2'); + } +} + +class Son2 extends Person2 { + // 因为父类有无参数的,非命名的构造函数, 所以可以不用手动调用父类的构造函数 + Son2.fromDictionary(Map data) { + print('in son2'); + } +} + +// 如果父类不现实提供无名无参的构造函数,在子类中必须手动调用父类的一个构造函数。 +// 这种情况下,调用父类的构造函数的代码放在子类构造函数名后,子类构造函数体前,中间使用:分割 +class Son3 extends Son2 { + // 父类没有无参数的,非命名的 构造函数,所以必须手动调用一个父类的构造函数 + Son3.fromDictionary(Map data) : super.fromDictionary(data) { + print('in Son3'); + } +} + +// 父类中的命名构造函数不能被子类继承。如果想要子类也拥有一个父类一样名字的构造函数, +// 必须在子类中实现这个构造函数 + +//如果想要让类产生一个永远不会改变的对象,可以让这些对象成为编译时常量。为此,需要定义一个 const 构造函数并确保所有的实例变量都是 final 的 +class ImmutablePoint { + final num x; + final num y; + + const ImmutablePoint(this.x, this.y); + + static final ImmutablePoint origin = const ImmutablePoint(0, 0); +} + +class Point { + num x; + num y; + + // 主构造函数 + Point(this.x, this.y); + + // 重定向构造函数, 指向主构造函数, 函数体为空 + // 貌似swift中遍历构造函数,但略有不同 + Point.alongXAxis(num x) : this(x, 0); +} + +class Vehicle { + Vehicle() { + print("super constructor"); + } + + Vehicle.get() { + print("super Run"); + } + + Vehicle.create() { + print("super create"); + } +} + +class Audi extends Vehicle { + Audi() { + print("Audi constructor"); + } + + Audi.get() : super.get() { + print("Audi run"); + } + + Audi.create() { + print("Audi create"); + } +} + +class Point3 { + num x, y; + + Point3(this.x, this.y); + + Point3.origin() { + this.x = 10; + this.y = 10; + } + + // 构造参数为实例变量直接赋值 + Point3.rect(this.x, this.y); + + Point3.fromJson(Map json) + : x = json['x'], + y = json['y'] { + print("In Point.fromJson(): ($x, $y)"); + } + + void pointPrint() { + print("x = $x, y = $y"); + } +} + +class Rect { + num x, y, wid, hei; + + Rect(this.x, this.y, this.wid, this.hei); + + Rect.withSize(num width, num height) : this(0, 0, width, height); +} + +// 常量构造函数(单利) +class ImmutablePoint2 { + static final ImmutablePoint2 origin = const ImmutablePoint2(0, 0); + final num x, y; + + const ImmutablePoint2(this.x, this.y); +} + +// 工厂构造函数(池子) +class Logger { + final String name; + bool mute = false; + + // _cache is library-private, thanks to + // the _ in front of its name. + static final Map _cache = {}; + + factory Logger(String name){ + if(_cache.containsKey(name)) { + return _cache[name]; + } else { + final logger = Logger._internal(name); + _cache[name] = logger; + return logger; + } + } + + Logger._internal(this.name); + + void log(String msg) { + if(!mute) print(msg); + } + + + +} + +int main() { + Audi audi0 = Audi(); + Audi audi1 = Audi.create(); + Audi audi2 = Audi.get(); + + Point3 p3 = Point3.origin(); + p3.pointPrint(); + + // 调用 + var logger = Logger('UI'); + logger.log("Button clicked"); +} diff --git a/flutter_helper/lib/utils/util_date.dart b/flutter_helper/lib/utils/util_date.dart new file mode 100644 index 00000000..2b54aa05 --- /dev/null +++ b/flutter_helper/lib/utils/util_date.dart @@ -0,0 +1,267 @@ +class DateFormats { + static String full = 'yyyy-MM-dd HH:mm:ss'; + static String y_mo_d_h_m = 'yyyy-MM-dd HH:mm'; + static String y_mo_d = 'yyyy-MM-dd'; + static String y_mo = 'yyyy-MM'; + static String mo_d = 'MM-dd'; + static String mo_d_h_m = 'MM-dd HH:mm'; + static String h_m_s = 'HH:mm:ss'; + static String h_m = 'HH:mm'; + + static String zh_full = 'yyyy年MM月dd日 HH时mm分ss秒'; + static String zh_y_mo_d_h_m = 'yyyy年MM月dd日 HH时mm分'; + static String zh_y_mo_d = 'yyyy年MM月dd日'; + static String zh_y_mo = 'yyyy年MM月'; + static String zh_mo_d = 'MM月dd日'; + static String zh_mo_d_h_m = 'MM月dd日 HH时mm分'; + static String zh_h_m_s = 'HH时mm分ss秒'; + static String zh_h_m = 'HH时mm分'; +} + +// 这个月一共有几天, 1,2,5,7,8,10,腊,31天永不差 +Map MONTH_DAY = { + 1: 31, + 2: 28, + 3: 31, + 4: 30, + 5: 31, + 6: 30, + 7: 31, + 8: 31, + 9: 30, + 10: 31, + 11: 30, + 12: 31, +}; + +class DateUtil { + /// get DateTime By DateStr. + static DateTime getDateTime(String dateStr, {bool isUtc}) { + DateTime dateTime = DateTime.tryParse(dateStr); + if (isUtc ?? false) { + dateTime = dateTime?.toUtc(); + } else { + dateTime = dateTime?.toLocal(); + } + return dateTime; + } + + /// get DateTime By Milliseconds. + static DateTime getDateTimeByMs(int ms, {bool isUtc = false}) => + DateTime.fromMillisecondsSinceEpoch(ms, isUtc: isUtc); + + /// get DateMilliseconds By DateStr. + static int getDateMsByTimeStr(String dateStr, {bool isUtc}) => + getDateTime(dateStr, isUtc: isUtc).millisecondsSinceEpoch; + + /// get Now Date Milliseconds. + static int getNowDateMs() => DateTime.now().millisecondsSinceEpoch; + + /// get Now Date Str.(yyyy-MM-dd HH:mm:ss) + static String getNowDateStr() => formatDate(DateTime.now()); + + /// format date by milliseconds. + /// milliseconds 日期毫秒 + static String formatDateMs(int ms, {bool isUtc = false, String format}) => + formatDate(getDateTimeByMs(ms, isUtc: isUtc), format: format); + + /// format date by date str. + /// dateStr 日期字符串 + static String formatDateStr(String dateStr, {bool isUtc, String format}) => + formatDate(getDateTime(dateStr, isUtc: isUtc), format: format); + + /// format date by DateTime. + /// format 转换格式(已提供常用格式 DateFormats,可以自定义格式:'yyyy/MM/dd HH:mm:ss') + /// 格式要求 + /// year -> yyyy/yy month -> MM/M day -> dd/d + /// hour -> HH/H minute -> mm/m second -> ss/s + static String formatDate(DateTime dateTime, {String format}) { + if (dateTime == null) return ''; + format = format ?? DateFormats.full; + if (format.contains('yy')) { + String year = dateTime.year.toString(); + if (format.contains('yyyy')) { + format = format.replaceAll('yyyy', year); + } else { + format = format.replaceAll( + 'yy', year.substring(year.length - 2, year.length)); + } + } + + format = _comFormat(dateTime.month, format, 'M', 'MM'); + format = _comFormat(dateTime.day, format, 'd', 'dd'); + format = _comFormat(dateTime.hour, format, 'H', 'HH'); + format = _comFormat(dateTime.minute, format, 'm', 'mm'); + format = _comFormat(dateTime.second, format, 's', 'ss'); + format = _comFormat(dateTime.millisecond, format, 'S', 'SSS'); + + return format; + } + + /// com format. + static String _comFormat( + int value, String format, String single, String full) { + if (format.contains(single)) { + if (format.contains(full)) { + format = + format.replaceAll(full, value < 10 ? '0$value' : value.toString()); + } else { + format = format.replaceAll(single, value.toString()); + } + } + return format; + } + + /// get WeekDay. + /// dateTime + /// isUtc + /// languageCode zh or en + /// short + static String getWeekday(DateTime dateTime, + {String languageCode = 'en', bool short = false}) { + if (dateTime == null) return ""; + String weekday = ""; + switch (dateTime.weekday) { + case 1: + weekday = languageCode == 'zh' ? '星期一' : 'Monday'; + break; + case 2: + weekday = languageCode == 'zh' ? '星期二' : 'Tuesday'; + break; + case 3: + weekday = languageCode == 'zh' ? '星期三' : 'Wednesday'; + break; + case 4: + weekday = languageCode == 'zh' ? '星期四' : 'Thursday'; + break; + case 5: + weekday = languageCode == 'zh' ? '星期五' : 'Friday'; + break; + case 6: + weekday = languageCode == 'zh' ? '星期六' : 'Saturday'; + break; + case 7: + weekday = languageCode == 'zh' ? '星期日' : 'Sunday'; + break; + default: + break; + } + return languageCode == 'zh' + ? (short ? weekday.replaceAll('星期', '周') : weekday) + : weekday.substring(0, short ? 3 : weekday.length); + } + + /// get WeekDay By Milliseconds. + static String getWeekdayByMs(int milliseconds, + {bool isUtc = false, + String languageCode = 'en', + bool short = false}) => + getWeekday(getDateTimeByMs(milliseconds, isUtc: isUtc), + languageCode: languageCode, short: short); + + /// get day of year. + /// 在今年的第几天. + static int getDayOfYear(DateTime dateTime) { + int year = dateTime.year; + int month = dateTime.month; + int days = dateTime.day; + for (int i = 1; i < month; i++) { + days = days + MONTH_DAY[i]; + } + if (isLeapYearByYear(year) && month > 2) { + days = days + 1; + } + return days; + } + + /// get day of year. + /// 在今年的第几天. + static int getDayOfYearByMs(int ms, {bool isUtc = false}) { + return getDayOfYear(DateTime.fromMillisecondsSinceEpoch(ms, isUtc: isUtc)); + } + + /// is today. + /// 是否是当天. + static bool isToday(int milliseconds, {bool isUtc = false, int locMs}) { + if (milliseconds == null || milliseconds == 0) return false; + DateTime old = + DateTime.fromMillisecondsSinceEpoch(milliseconds, isUtc: isUtc); + DateTime now; + if (locMs != null) { + now = DateUtil.getDateTimeByMs(locMs); + } else { + now = isUtc ? DateTime.now().toUtc() : DateTime.now().toLocal(); + } + return old.year == now.year && old.month == now.month && old.day == now.day; + } + + /// is yesterday by dateTime. + /// 是否是昨天. + static bool isYesterday(DateTime dateTime, DateTime locDateTime) { + if (yearIsEqual(dateTime, locDateTime)) { + int spDay = getDayOfYear(locDateTime) - getDayOfYear(dateTime); + return spDay == 1; + } else { + return ((locDateTime.year - dateTime.year == 1) && + dateTime.month == 12 && + locDateTime.month == 1 && + dateTime.day == 31 && + locDateTime.day == 1); + } + } + + /// is yesterday by millis. + /// 是否是昨天. + static bool isYesterdayByMs(int ms, int locMs) { + return isYesterday(DateTime.fromMillisecondsSinceEpoch(ms), + DateTime.fromMillisecondsSinceEpoch(locMs)); + } + + /// is Week. + /// 是否是本周. + static bool isWeek(int ms, {bool isUtc = false, int locMs}) { + if (ms == null || ms <= 0) { + return false; + } + DateTime _old = DateTime.fromMillisecondsSinceEpoch(ms, isUtc: isUtc); + DateTime _now; + if (locMs != null) { + _now = DateUtil.getDateTimeByMs(locMs, isUtc: isUtc); + } else { + _now = isUtc ? DateTime.now().toUtc() : DateTime.now().toLocal(); + } + + DateTime old = + _now.millisecondsSinceEpoch > _old.millisecondsSinceEpoch ? _old : _now; + DateTime now = + _now.millisecondsSinceEpoch > _old.millisecondsSinceEpoch ? _now : _old; + return (now.weekday >= old.weekday) && + (now.millisecondsSinceEpoch - old.millisecondsSinceEpoch <= + 7 * 24 * 60 * 60 * 1000); + } + + /// year is equal. + /// 是否同年. + static bool yearIsEqual(DateTime dateTime, DateTime locDateTime) { + return dateTime.year == locDateTime.year; + } + + /// year is equal. + /// 是否同年. + static bool yearIsEqualByMs(int ms, int locMs) { + return yearIsEqual(DateTime.fromMillisecondsSinceEpoch(ms), + DateTime.fromMillisecondsSinceEpoch(locMs)); + } + + /// Return whether it is leap year. + /// 是否是闰年 + static bool isLeapYear(DateTime dateTime) { + return isLeapYearByYear(dateTime.year); + } + + /// Return whether it is leap year. + /// 是否是闰年 + static bool isLeapYearByYear(int year) { + return year % 4 == 0 && year % 100 != 0 || year % 400 == 0; + } +} diff --git a/flutter_helper/lib/utils/util_encrypt.dart b/flutter_helper/lib/utils/util_encrypt.dart new file mode 100644 index 00000000..d6267aad --- /dev/null +++ b/flutter_helper/lib/utils/util_encrypt.dart @@ -0,0 +1,50 @@ +import 'dart:convert'; +import 'package:crypto/crypto.dart'; +import 'package:convert/convert.dart'; + +/// Encrypt Utils. +class EncryptUtil { + // md5 加密 + static String encodeMd5(String data) { + return hex.encode(md5.convert(Utf8Encoder().convert(data)).bytes); + } + + // 异或对称加密 + static String xorCode(String res, String key) { + List keyList = key.split(','); + List codeUnits = res.codeUnits; + List codes = []; + for (int i = 0, length = codeUnits.length; i < length; i++) { + codes.add(codeUnits[i] ^ int.parse(keyList[i % keyList.length])); + } + return String.fromCharCodes(codes); + } + + /// 异或对称 Base64 加密 + static String xorBase64Encode(String res, String key) { + String encode = xorCode(res, key); + encode = encodeBase64(encode); + return encode; + } + + /// 异或对称 Base64 解密 + static String xorBase64Decode(String res, String key) { + String encode = decodeBase64(res); + encode = xorCode(encode, key); + return encode; + } + + /// Base64加密 + static String encodeBase64(String data) { + var content = utf8.encode(data); + var digest = base64Encode(content); + return digest; + } + + /// Base64解密 + static String decodeBase64(String data) { + List bytes = base64Decode(data); + String result = utf8.decode(bytes); + return result; + } +} diff --git a/flutter_helper/lib/utils/util_json.dart b/flutter_helper/lib/utils/util_json.dart new file mode 100644 index 00000000..179038ca --- /dev/null +++ b/flutter_helper/lib/utils/util_json.dart @@ -0,0 +1,72 @@ +import 'dart:convert'; + +class JsonUtil { + /// Converts object [value] to a JSON string. + static String encodeObj(dynamic value) { + return value == null ? null : json.encode(value); + } + + /// Converts JSON string [source] to object; + static T getObj(String source, T f(Map v)) { + if (source == null || source.isEmpty) return null; + try { + Map map = json.decode(source); + return f(map); + } catch (e, s) { + print('JsonUtil convert error, Exception: ${e.toString()}'); + } + return null; + } + + /// Converst JSON string or JSON map [source] t object. + static T getObject(dynamic source, T f(Map v)) { + if (source == null || source.toString().isEmpty) return null; + try { + Map map; + if (source is String) { + map = json.decode(source); + } else { + map = source; + } + return f(map); + } catch (e) { + print('JsonUtil convert error, Exception: ${e.toString()}'); + } + return null; + } + + // Converts JSON string list [source] to object list. + static List getObjectList(dynamic source, T f(Map v)) { + if (source == null || source.toString().isEmpty) return null; + try { + List list; + if (source is String) { + list = json.decode(source); + } else { + list = source; + } + return list.map((value) { + if (value is String) { + value = json.decode(value); + } + return f(value); + }); + } catch (e) { + print('JsonUtil convert error, Exception: ${e.toString()}'); + } + return null; + } + + /// get List + /// [1,2,3,4,5,6] + /// "[\"tom\",\"tony\",\"jacky\"]"; + static List getList(dynamic source) { + List list; + if (source is String) { + list = json.decode(source); + } else { + list = source; + } + return list?.map((e) => e as T)?.toList(); + } +} diff --git a/flutter_helper/lib/utils/util_log.dart b/flutter_helper/lib/utils/util_log.dart new file mode 100644 index 00000000..14d6a438 --- /dev/null +++ b/flutter_helper/lib/utils/util_log.dart @@ -0,0 +1,51 @@ +import 'dart:developer'; + +/// 工具类 +class LogUtil { + static const String _defTag = "common_utils"; + static bool _debugMode = true; + static int _maxLen = 128; + static String _tagValue = _defTag; + + static void init({ + String tag = _defTag, + bool isDebug = false, + int maxLen = 128, + }) { + _tagValue = tag; + _debugMode = isDebug; + _maxLen = _maxLen; + } + + static void d(object, {tag}) { + if (_debugMode) log('$tag d | ${object?.toString()}'); + } + + static void e(object, {tag}) { + //if (_debugMode) log('$tag e | ${object?.toString()}'); + if (_debugMode) _printLog(tag, ' e ', object); + } + + static void v(object, {tag}) { + if (_debugMode) _printLog(tag, ' v ', object); + } + + static void _printLog(tag, String stag, object) { + String da = object?.toString() ?? 'null'; + tag = tag ?? _tagValue; + if (da.length <= _maxLen) { + print('$tag$stag $da'); + } + print('$tag$stag---------------st--------------'); + while (da.isNotEmpty) { + if (da.length > _maxLen) { + print('$tag$stag| ${da.substring(0, _maxLen)}'); + da = da.substring(_maxLen, da.length); + } else { + print('$tag$stag| $da'); + da = ''; + } + } + print('$tag$stag---------------ed--------------'); + } +} diff --git a/flutter_helper/lib/utils/util_money.dart b/flutter_helper/lib/utils/util_money.dart new file mode 100644 index 00000000..d0e48e51 --- /dev/null +++ b/flutter_helper/lib/utils/util_money.dart @@ -0,0 +1,108 @@ +import 'package:flutter_helper/utils/util_num.dart'; + +enum MoneyUnit { + NORMAL, // 6.00 + YUAN, // ¥6.00 + YUAN_ZH, // 6.00元 + DOLLAR, // $6.00 +} +enum MoneyFormat { + NORMAL, //保留两位小数(6.00元) + END_INTEGER, //去掉末尾'0'(6.00元 -> 6元, 6.60元 -> 6.6元) + YUAN_INTEGER, //整元(6.00元 -> 6元) +} +/** + * @Author: Sky24n + * @GitHub: https://github.com/Sky24n + * @Description: Money Util. + * @Date: 2018/9/29 + */ + +/// Money Util. +class MoneyUtil { + static const String YUAN = '¥'; + static const String YUAN_ZH = '元'; + static const String DOLLAR = '\$'; + + /// fen to yuan, format output. + /// 分 转 元, format格式输出. + static String changeF2Y(int amount, + {MoneyFormat format = MoneyFormat.NORMAL}) { + String moneyTxt; + double yuan = NumUtil.divide(amount, 100); + switch (format) { + case MoneyFormat.NORMAL: + moneyTxt = yuan.toStringAsFixed(2); + break; + case MoneyFormat.END_INTEGER: + if (amount % 100 == 0) { + moneyTxt = yuan.toInt().toString(); + } else if (amount % 10 == 0) { + moneyTxt = yuan.toStringAsFixed(1); + } else { + moneyTxt = yuan.toStringAsFixed(2); + } + break; + case MoneyFormat.YUAN_INTEGER: + moneyTxt = (amount % 100 == 0) + ? yuan.toInt().toString() + : yuan.toStringAsFixed(2); + break; + } + return moneyTxt; + } + + /// fen str to yuan, format & unit output. + /// 分字符串 转 元, format 与 unit 格式 输出. + static String changeFStr2YWithUnit(String amountStr, + {MoneyFormat format = MoneyFormat.NORMAL, + MoneyUnit unit = MoneyUnit.NORMAL}) { + int amount = int.parse(amountStr); + return changeF2YWithUnit(amount, format: format, unit: unit); + } + + /// fen to yuan, format & unit output. + /// 分 转 元, format 与 unit 格式 输出. + static String changeF2YWithUnit(int amount, + {MoneyFormat format = MoneyFormat.NORMAL, + MoneyUnit unit = MoneyUnit.NORMAL}) { + return withUnit(changeF2Y(amount, format: format), unit); + } + + /// yuan, format & unit output.(yuan is int,double,str). + /// 元, format 与 unit 格式 输出. + static String changeYWithUnit(Object yuan, MoneyUnit unit, + {MoneyFormat format}) { + String yuanTxt = yuan.toString(); + if (format != null) { + int amount = changeY2F(yuan); + yuanTxt = changeF2Y(amount.toInt(), format: format); + } + return withUnit(yuanTxt, unit); + } + + /// yuan to fen. + /// 元 转 分, + static int changeY2F(Object yuan) { + return NumUtil.multiplyDecStr(yuan.toString(), '100').toInt(); + } + + /// with unit. + /// 拼接单位. + static String withUnit(String moneyTxt, MoneyUnit unit) { + switch (unit) { + case MoneyUnit.YUAN: + moneyTxt = YUAN + moneyTxt; + break; + case MoneyUnit.YUAN_ZH: + moneyTxt = moneyTxt + YUAN_ZH; + break; + case MoneyUnit.DOLLAR: + moneyTxt = DOLLAR + moneyTxt; + break; + default: + break; + } + return moneyTxt; + } +} diff --git a/flutter_helper/lib/utils/util_num.dart b/flutter_helper/lib/utils/util_num.dart new file mode 100644 index 00000000..fcf74230 --- /dev/null +++ b/flutter_helper/lib/utils/util_num.dart @@ -0,0 +1,152 @@ +import 'package:decimal/decimal.dart'; + +/// Num Util. +class NumUtil { + /// The parameter [fractionDigits] must be an integer satisfying: `0 <= fractionDigits <= 20`. + static num getNumByValueStr(String valueStr, {int fractionDigits}) { + double value = double.tryParse(valueStr); + return fractionDigits == null + ? value + : getNumByValueDouble(value, fractionDigits); + } + + /// The parameter [fractionDigits] must be an integer satisfying: `0 <= fractionDigits <= 20`. + static num getNumByValueDouble(double value, int fractionDigits) { + if (value == null) return null; + String valueStr = value.toStringAsFixed(fractionDigits); + return fractionDigits == 0 + ? int.tryParse(valueStr) + : double.tryParse(valueStr); + } + + /// get int by value str. + static int getIntByValueStr(String valueStr, {int defValue = 0}) { + return int.tryParse(valueStr) ?? defValue; + } + + /// get double by value str. + static double getDoubleByValueStr(String valueStr, {double defValue = 0}) { + return double.tryParse(valueStr) ?? defValue; + } + + ///isZero + static bool isZero(num value) => value == null || value == 0; + + /// 加 (精确相加,防止精度丢失). + /// add (without loosing precision). + static double add(num a, num b) { + return addDec(a, b).toDouble(); + } + + /// 减 (精确相减,防止精度丢失). + /// subtract (without loosing precision). + static double subtract(num a, num b) { + return subtractDec(a, b).toDouble(); + } + + /// 乘 (精确相乘,防止精度丢失). + /// multiply (without loosing precision). + static double multiply(num a, num b) { + return multiplyDec(a, b).toDouble(); + } + + /// 除 (精确相除,防止精度丢失). + /// divide (without loosing precision). + static double divide(num a, num b) { + return divideDec(a, b).toDouble(); + } + + /// 加 (精确相加,防止精度丢失). + /// add (without loosing precision). + static Decimal addDec(num a, num b) { + return addDecStr(a.toString(), b.toString()); + } + + /// 减 (精确相减,防止精度丢失). + /// subtract (without loosing precision). + static Decimal subtractDec(num a, num b) { + return subtractDecStr(a.toString(), b.toString()); + } + + /// 乘 (精确相乘,防止精度丢失). + /// multiply (without loosing precision). + static Decimal multiplyDec(num a, num b) { + return multiplyDecStr(a.toString(), b.toString()); + } + + /// 除 (精确相除,防止精度丢失). + /// divide (without loosing precision). + static Decimal divideDec(num a, num b) { + return divideDecStr(a.toString(), b.toString()); + } + + /// 余数 + static Decimal remainder(num a, num b) { + return remainderDecStr(a.toString(), b.toString()); + } + + /// Relational less than operator. + static bool lessThan(num a, num b) { + return lessThanDecStr(a.toString(), b.toString()); + } + + /// Relational less than or equal operator. + static bool thanOrEqual(num a, num b) { + return thanOrEqualDecStr(a.toString(), b.toString()); + } + + /// Relational greater than operator. + static bool greaterThan(num a, num b) { + return greaterThanDecStr(a.toString(), b.toString()); + } + + /// Relational greater than or equal operator. + static bool greaterOrEqual(num a, num b) { + return greaterOrEqualDecStr(a.toString(), b.toString()); + } + + /// 加 + static Decimal addDecStr(String a, String b) { + return Decimal.parse(a) + Decimal.parse(b); + } + + /// 减 + static Decimal subtractDecStr(String a, String b) { + return Decimal.parse(a) - Decimal.parse(b); + } + + /// 乘 + static Decimal multiplyDecStr(String a, String b) { + return Decimal.parse(a) * Decimal.parse(b); + } + + /// 除 + static Decimal divideDecStr(String a, String b) { + return Decimal.parse(a) / Decimal.parse(b); + } + + /// 余数 + static Decimal remainderDecStr(String a, String b) { + return Decimal.parse(a) % Decimal.parse(b); + } + + /// Relational less than operator. + static bool lessThanDecStr(String a, String b) { + return Decimal.parse(a) < Decimal.parse(b); + } + + /// Relational less than or equal operator. + static bool thanOrEqualDecStr(String a, String b) { + return Decimal.parse(a) <= Decimal.parse(b); + } + + /// Relational greater than operator. + static bool greaterThanDecStr(String a, String b) { + return Decimal.parse(a) > Decimal.parse(b); + } + + /// Relational greater than or equal operator. + static bool greaterOrEqualDecStr(String a, String b) { + return Decimal.parse(a) >= Decimal.parse(b); + } +} diff --git a/flutter_helper/lib/utils/util_object.dart b/flutter_helper/lib/utils/util_object.dart new file mode 100644 index 00000000..afeb6cd6 --- /dev/null +++ b/flutter_helper/lib/utils/util_object.dart @@ -0,0 +1,47 @@ +class ObjectUtil { + /// Returns true if the string is null or 0-length + static bool isEmptyString(String str) => str == null || str.isEmpty; + + /// Returns true if the list is null or 0-lenght + static bool isEmptyList(Iterable list) => list == null || list.isEmpty; + + /// Returns true if there is no key/value pair in the map + static bool isEmptyMap(Map map) => map == null || map.isEmpty; + + /// Returns true String or List or Map is empty. + static bool isEmpty(Object object) { + if (object == null) return true; + if (object is String && object.isEmpty) + return true; + else if (object is Iterable && object.isEmpty) + return true; + else if (object is Map && object.isEmpty) + return true; + else + return false; + } + + /// Returns true String or List or Map is not empty. + static bool isNotEmpty(Object object) => !isEmpty(object); + + static bool twoListIsEqual(List listA, List listB) { + if (listA == listB) return true; + if (listA == null || listB == null) return false; + if (listA.length != listB.length) return false; + listA.forEach((element) { + if (!listB.contains(element)) { + return false; + } + }); + return true; + } + + /// get length. + static int getLength(Object value) { + if (value == null) return 0; + if (value is String) return value.length; + if (value is Iterable) return value.length; + if (value is Map) return value.length; + return 0; + } +} diff --git a/flutter_helper/lib/utils/util_regex.dart b/flutter_helper/lib/utils/util_regex.dart new file mode 100644 index 00000000..17d92610 --- /dev/null +++ b/flutter_helper/lib/utils/util_regex.dart @@ -0,0 +1,231 @@ +/// id card province dict. +List ID_CARD_PROVINCE_DICT = [ + '11=北京', + '12=天津', + '13=河北', + '14=山西', + '15=内蒙古', + '21=辽宁', + '22=吉林', + '23=黑龙江', + '31=上海', + '32=江苏', + '33=浙江', + '34=安徽', + '35=福建', + '36=江西', + '37=山东', + '41=河南', + '42=湖北', + '43=湖南', + '44=广东', + '45=广西', + '46=海南', + '50=重庆', + '51=四川', + '52=贵州', + '53=云南', + '54=西藏', + '61=陕西', + '62=甘肃', + '63=青海', + '64=宁夏', + '65=新疆', + '71=台湾老', + '81=香港', + '82=澳门', + '83=台湾新', + '91=国外', +]; + +/// Regex Util. +class RegexUtil { + /// Regex of simple mobile. + static final String regexMobileSimple = '^[1]\\d{10}\$'; + + /// Regex of exact mobile. + ///

china mobile: 134(0-8), 135, 136, 137, 138, 139, 147, 150, 151, 152, 157, 158, 159, 165, 172, 178, 182, 183, 184, 187, 188, 195, 198

+ ///

china unicom: 130, 131, 132, 145, 155, 156, 166, 167, 171, 175, 176, 185, 186

+ ///

china telecom: 133, 153, 162, 173, 177, 180, 181, 189, 199, 191

+ ///

global star: 1349

+ ///

virtual operator: 170

+ static final String regexMobileExact = + '^((13[0-9])|(14[57])|(15[0-35-9])|(16[2567])|(17[01235-8])|(18[0-9])|(19[1589]))\\d{8}\$'; + + /// Regex of telephone number. + static final String regexTel = '^0\\d{2,3}[- ]?\\d{7,8}'; + + /// Regex of id card number which length is 15. + static final String regexIdCard15 = + '^[1-9]\\d{7}((0\\d)|(1[0-2]))(([0|1|2]\\d)|3[0-1])\\d{3}\$'; + + /// Regex of id card number which length is 18. + static final String regexIdCard18 = + '^[1-9]\\d{5}[1-9]\\d{3}((0\\d)|(1[0-2]))(([0|1|2]\\d)|3[0-1])\\d{3}([0-9Xx])\$'; + + /// Regex of email. + static final String regexEmail = + '^\\w+([-+.]\\w+)*@\\w+([-.]\\w+)*\\.\\w+([-.]\\w+)*\$'; + + /// Regex of url. + static final String regexUrl = '[a-zA-Z]+://[^\\s]*'; + + /// Regex of Chinese character. + static final String regexZh = '[\\u4e00-\\u9fa5]'; + + /// Regex of date which pattern is 'yyyy-MM-dd'. + static final String regexDate = + '^(?:(?!0000)[0-9]{4}-(?:(?:0[1-9]|1[0-2])-(?:0[1-9]|1[0-9]|2[0-8])|(?:0[13-9]|1[0-2])-(?:29|30)|(?:0[13578]|1[02])-31)|(?:[0-9]{2}(?:0[48]|[2468][048]|[13579][26])|(?:0[48]|[2468][048]|[13579][26])00)-02-29)\$'; + + /// Regex of ip address. + static final String regexIp = + '((2[0-4]\\d|25[0-5]|[01]?\\d\\d?)\\.){3}(2[0-4]\\d|25[0-5]|[01]?\\d\\d?)'; + + /// must contain letters and numbers, 6 ~ 18. + /// 必须包含字母和数字, 6~18. + static const String regexUsername = + '^(?![0-9]+\$)(?![a-zA-Z]+\$)[0-9A-Za-z]{6,18}\$'; + + /// must contain letters and numbers, can contain special characters 6 ~ 18. + /// 必须包含字母和数字,可包含特殊字符 6~18. + static const String regexUsername2 = + '^(?![0-9]+\$)(?![a-zA-Z]+\$)[0-9A-Za-z\\W]{6,18}\$'; + + /// must contain letters and numbers and special characters, 6 ~ 18. + /// 必须包含字母和数字和殊字符, 6~18. + static const String regexUsername3 = + '^(?![0-9]+\$)(?![a-zA-Z]+\$)(?![0-9a-zA-Z]+\$)(?![0-9\\W]+\$)(?![a-zA-Z\\W]+\$)[0-9A-Za-z\\W]{6,18}\$'; + + /// Regex of QQ number. + static final String regexQQ = '[1-9][0-9]{4,}'; + + /// Regex of postal code in China. + static final String regexChinaPostalCode = "[1-9]\\d{5}(?!\\d)"; + + /// Regex of Passport. + static final String regexPassport = + r'(^[EeKkGgDdSsPpHh]\d{8}$)|(^(([Ee][a-fA-F])|([DdSsPp][Ee])|([Kk][Jj])|([Mm][Aa])|(1[45]))\d{7}$)'; + + static final Map cityMap = Map(); + + ///Return whether input matches regex of simple mobile. + static bool isMobileSimple(String input) { + return matches(regexMobileSimple, input); + } + + ///Return whether input matches regex of exact mobile. + static bool isMobileExact(String input) { + return matches(regexMobileExact, input); + } + + /// Return whether input matches regex of telephone number. + static bool isTel(String input) { + return matches(regexTel, input); + } + + /// Return whether input matches regex of id card number. + static bool isIDCard(String input) { + if (input.length == 15) { + return isIDCard15(input); + } + if (input.length == 18) { + return isIDCard18Exact(input); + } + return false; + } + + /// Return whether input matches regex of id card number which length is 15. + static bool isIDCard15(String input) { + return matches(regexIdCard15, input); + } + + /// Return whether input matches regex of id card number which length is 18. + static bool isIDCard18(String input) { + return matches(regexIdCard18, input); + } + + ///Return whether input matches regex of exact id card number which length is 18. + static bool isIDCard18Exact(String input) { + if (isIDCard18(input)) { + List factor = [7, 9, 10, 5, 8, 4, 2, 1, 6, 3, 7, 9, 10, 5, 8, 4, 2]; + List suffix = [ + '1', + '0', + 'X', + '9', + '8', + '7', + '6', + '5', + '4', + '3', + '2' + ]; + if (cityMap.isEmpty) { + List list = ID_CARD_PROVINCE_DICT; + List> mapEntryList = []; + for (int i = 0, length = list.length; i < length; i++) { + List tokens = list[i].trim().split('='); + MapEntry mapEntry = MapEntry(tokens[0], tokens[1]); + mapEntryList.add(mapEntry); + } + cityMap.addEntries(mapEntryList); + } + if (cityMap[input.substring(0, 2)] != null) { + int weightSum = 0; + for (int i = 0; i < 17; ++i) { + weightSum += (input.codeUnitAt(i) - '0'.codeUnitAt(0)) * factor[i]; + } + int idCardMod = weightSum % 11; + String idCardLast = String.fromCharCode(input.codeUnitAt(17)); + return idCardLast == suffix[idCardMod]; + } + } + return false; + } + + /// Return whether input matches regex of email. + static bool isEmail(String input) { + return matches(regexEmail, input); + } + + /// Return whether input matches regex of url. + static bool isURL(String input) { + return matches(regexUrl, input); + } + + /// Return whether input matches regex of Chinese character. + static bool isZh(String input) { + return '〇' == input || matches(regexZh, input); + } + + /// Return whether input matches regex of date which pattern is 'yyyy-MM-dd'. + static bool isDate(String input) { + return matches(regexDate, input); + } + + /// Return whether input matches regex of ip address. + static bool isIP(String input) { + return matches(regexIp, input); + } + + /// Return whether input matches regex of username. + static bool isUserName(String input, {String regex = regexUsername}) { + return matches(regex, input); + } + + /// Return whether input matches regex of QQ. + static bool isQQ(String input) { + return matches(regexQQ, input); + } + + ///Return whether input matches regex of Passport. + static bool isPassport(String input) { + return matches(regexPassport, input); + } + + static bool matches(String regex, String input) { + if (input.isEmpty) return false; + return RegExp(regex).hasMatch(input); + } +} diff --git a/flutter_helper/lib/utils/util_text.dart b/flutter_helper/lib/utils/util_text.dart new file mode 100644 index 00000000..3d0c1983 --- /dev/null +++ b/flutter_helper/lib/utils/util_text.dart @@ -0,0 +1,73 @@ +class TextUtil { + /// isEmpty + static bool isEmpty(String text) => text?.isEmpty ?? true; + + /// 每隔x位 加pattern + static String formatDigitPattern(String text, + {int digit = 4, String pattern = ' '}) { + text = text.replaceAllMapped(RegExp('(.{$digit})'), (Match match) { + return '${match.group(0)}$pattern'; + }); + if (text.endsWith(pattern)) { + text = text.substring(0, text.length - 1); + } + return text; + } + + /// 每隔 x位 加 pattern, 从末尾开始 + static String formatDigitPatternEnd(String text, + {int digit = 4, String pattern = ' '}) { + String temp = reverse(text); + temp = formatDigitPattern(temp, digit: digit, pattern: pattern); + temp = reverse(temp); + return temp; + } + + /// 每隔4位加空格 + static String formatSpace4(String text) { + return formatDigitPattern(text); + } + + /// 每隔3三位加逗号 + /// num 数字或数字字符串。int型。 + static String formatComma3(Object num) { + return formatDigitPatternEnd(num.toString(), digit: 3, pattern: ','); + } + + /// 每隔3三位加逗号 + /// num 数字或数字字符串。double型。 + static String formatDoubleComma3(Object num, + {int digit = 3, String pattern = ','}) { + List list = num.toString().split('.'); + String left = + formatDigitPatternEnd(list[0], digit: digit, pattern: pattern); + String right = list[1]; + return '$left.$right'; + } + + /// hideNumber + static String hideNumber(String phoneNo, + {int start = 3, int end = 7, String replacement = '****'}) { + return phoneNo.replaceRange(start, end, replacement); + } + + /// replace + static String replace(String text, Pattern from, String replace) { + return text.replaceAll(from, replace); + } + + /// split + static List split(String text, Pattern pattern) { + return text.split(pattern); + } + + /// reverse + static String reverse(String text) { + if (isEmpty(text)) return ''; + StringBuffer sb = StringBuffer(); + for (int i = text.length - 1; i >= 0; i--) { + sb.writeCharCode(text.codeUnitAt(i)); + } + return sb.toString(); + } +} diff --git a/flutter_helper/lib/utils/util_timeline.dart b/flutter_helper/lib/utils/util_timeline.dart new file mode 100644 index 00000000..b1b57bea --- /dev/null +++ b/flutter_helper/lib/utils/util_timeline.dart @@ -0,0 +1,374 @@ +/** + * @Author: Sky24n + * @GitHub: https://github.com/Sky24n + * @Description: Timeline Util. + * @Date: 2018/10/3 + */ + +import 'package:flutter_helper/utils/util_date.dart'; + +/// (xx)Configurable output. +/// (xx)为可配置输出. +enum DayFormat { + /// (less than 10s->just now)、x minutes、x hours、(Yesterday)、x days. + /// (小于10s->刚刚)、x分钟、x小时、(昨天)、x天. + Simple, + + /// (less than 10s->just now)、x minutes、x hours、[This year:(Yesterday/a day ago)、(two days age)、MM-dd ]、[past years: yyyy-MM-dd] + /// (小于10s->刚刚)、x分钟、x小时、[今年: (昨天/1天前)、(2天前)、MM-dd],[往年: yyyy-MM-dd]. + Common, + + /// 日期 + HH:mm + /// (less than 10s->just now)、x minutes、x hours、[This year:(Yesterday HH:mm/a day ago)、(two days age)、MM-dd HH:mm]、[past years: yyyy-MM-dd HH:mm] + /// 小于10s->刚刚)、x分钟、x小时、[今年: (昨天 HH:mm/1天前)、(2天前)、MM-dd HH:mm],[往年: yyyy-MM-dd HH:mm]. + Full, +} + +/// Timeline information configuration. +/// Timeline信息配置. +abstract class TimelineInfo { + String suffixAgo(); //suffix ago(后缀 后). + + String suffixAfter(); //suffix after(后缀 前). + + int maxJustNowSecond() => 30; // max just now second. + + String lessThanOneMinute() => ''; //just now(刚刚). + + String customYesterday() => ''; //Yesterday(昨天).优先级高于keepOneDay + + bool keepOneDay(); //保持1天,example: true -> 1天前, false -> MM-dd. + + bool keepTwoDays(); //保持2天,example: true -> 2天前, false -> MM-dd. + + String oneMinute(int minutes); //a minute(1分钟). + + String minutes(int minutes); //x minutes(x分钟). + + String anHour(int hours); //an hour(1小时). + + String hours(int hours); //x hours(x小时). + + String oneDay(int days); //a day(1天). + + String weeks(int week) => ''; //x week(星期x). + + String days(int days); //x days(x天). + +} + +class ZhInfo implements TimelineInfo { + String suffixAgo() => '前'; + + String suffixAfter() => '后'; + + int maxJustNowSecond() => 30; + + String lessThanOneMinute() => '刚刚'; + + String customYesterday() => '昨天'; + + bool keepOneDay() => true; + + bool keepTwoDays() => true; + + String oneMinute(int minutes) => '$minutes分钟'; + + String minutes(int minutes) => '$minutes分钟'; + + String anHour(int hours) => '$hours小时'; + + String hours(int hours) => '$hours小时'; + + String oneDay(int days) => '$days天'; + + String weeks(int week) => ''; //x week(星期x). + + String days(int days) => '$days天'; +} + +class EnInfo implements TimelineInfo { + String suffixAgo() => ' ago'; + + String suffixAfter() => ' after'; + + int maxJustNowSecond() => 30; + + String lessThanOneMinute() => 'just now'; + + String customYesterday() => 'Yesterday'; + + bool keepOneDay() => true; + + bool keepTwoDays() => true; + + String oneMinute(int minutes) => 'a minute'; + + String minutes(int minutes) => '$minutes minutes'; + + String anHour(int hours) => 'an hour'; + + String hours(int hours) => '$hours hours'; + + String oneDay(int days) => 'a day'; + + String weeks(int week) => ''; //x week(星期x). + + String days(int days) => '$days days'; +} + +class ZhNormalInfo implements TimelineInfo { + String suffixAgo() => '前'; + + String suffixAfter() => '后'; + + int maxJustNowSecond() => 30; + + String lessThanOneMinute() => '刚刚'; + + String customYesterday() => '昨天'; + + bool keepOneDay() => true; + + bool keepTwoDays() => false; + + String oneMinute(int minutes) => '$minutes分钟'; + + String minutes(int minutes) => '$minutes分钟'; + + String anHour(int hours) => '$hours小时'; + + String hours(int hours) => '$hours小时'; + + String oneDay(int days) => '$days天'; + + String weeks(int week) => ''; //x week(星期x). + + String days(int days) => '$days天'; +} + +class EnNormalInfo implements TimelineInfo { + String suffixAgo() => ' ago'; + + String suffixAfter() => ' after'; + + int maxJustNowSecond() => 30; + + String lessThanOneMinute() => 'just now'; + + String customYesterday() => 'Yesterday'; + + bool keepOneDay() => true; + + bool keepTwoDays() => false; + + String oneMinute(int minutes) => 'a minute'; + + String minutes(int minutes) => '$minutes minutes'; + + String anHour(int hours) => 'an hour'; + + String hours(int hours) => '$hours hours'; + + String oneDay(int days) => 'a day'; + + String weeks(int week) => ''; //x week(星期x). + + String days(int days) => '$days days'; +} + +Map _timelineInfoMap = { + 'zh': ZhInfo(), + 'en': EnInfo(), + 'zh_normal': ZhNormalInfo(), //keepTwoDays() => false + 'en_normal': EnNormalInfo(), //keepTwoDays() => false +}; + +/// add custom configuration. +void setLocaleInfo(String locale, TimelineInfo timelineInfo) { + ArgumentError.checkNotNull(locale, '[locale] must not be null'); + ArgumentError.checkNotNull(timelineInfo, '[timelineInfo] must not be null'); + _timelineInfoMap[locale] = timelineInfo; +} + +/// TimelineUtil +class TimelineUtil { + /// format time by DateTime. + /// dateTime + /// locDateTime: current time or schedule time. + /// locale: output key. + static String formatByDateTime( + DateTime dateTime, { + DateTime locDateTime, + String locale, + DayFormat dayFormat, + }) { + return format( + dateTime.millisecondsSinceEpoch, + locTimeMs: locDateTime?.millisecondsSinceEpoch, + locale: locale, + dayFormat: dayFormat, + ); + } + + /// format time by millis. + /// dateTime : millis. + /// locDateTime: current time or schedule time. millis. + /// locale: output key. + static String format( + int ms, { + int locTimeMs, + String locale, + DayFormat dayFormat, + }) { + int _locTimeMs = locTimeMs ?? DateTime.now().millisecondsSinceEpoch; + String _locale = locale ?? 'en'; + TimelineInfo _info = _timelineInfoMap[_locale] ?? EnInfo(); + DayFormat _dayFormat = dayFormat ?? DayFormat.Common; + + int elapsed = _locTimeMs - ms; + String suffix; + if (elapsed < 0) { + suffix = _info.suffixAfter(); + // suffix after is empty. user just now. + if (suffix.isNotEmpty) { + elapsed = elapsed.abs(); + _dayFormat = DayFormat.Simple; + } else { + return _info.lessThanOneMinute(); + } + } else { + suffix = _info.suffixAgo(); + } + + String timeline; + if (_info.customYesterday().isNotEmpty && + DateUtil.isYesterdayByMs(ms, _locTimeMs)) { + return _getYesterday(ms, _info, _dayFormat); + } + + if (!DateUtil.yearIsEqualByMs(ms, _locTimeMs)) { + timeline = _getYear(ms, _dayFormat); + if (timeline.isNotEmpty) return timeline; + } + + final num seconds = elapsed / 1000; + final num minutes = seconds / 60; + final num hours = minutes / 60; + final num days = hours / 24; + + if (seconds < 90) { + timeline = _info.oneMinute(1); + if (suffix != _info.suffixAfter() && + _info.lessThanOneMinute().isNotEmpty && + seconds < _info.maxJustNowSecond()) { + timeline = _info.lessThanOneMinute(); + suffix = ''; + } + } else if (minutes < 60) { + timeline = _info.minutes(minutes.round()); + } else if (minutes < 90) { + timeline = _info.anHour(1); + } else if (hours < 24) { + timeline = _info.hours(hours.round()); + } else { + if ((days.round() == 1 && _info.keepOneDay() == true) || + (days.round() == 2 && _info.keepTwoDays() == true)) { + _dayFormat = DayFormat.Simple; + } + timeline = _formatDays(ms, days.round(), _info, _dayFormat); + suffix = (_dayFormat == DayFormat.Simple ? suffix : ''); + } + return timeline + suffix; + } + + /// Timeline like QQ. + /// + /// today (HH:mm) + /// yesterday (昨天;Yesterday) + /// this week (星期一,周一;Monday,Mon) + /// others (yyyy-MM-dd) + static String formatA( + int ms, { + int locMs, + String formatToday = 'HH:mm', + String format = 'yyyy-MM-dd', + String languageCode = 'en', + bool short = false, + }) { + int _locTimeMs = locMs ?? DateTime.now().millisecondsSinceEpoch; + int elapsed = _locTimeMs - ms; + if (elapsed < 0) { + return DateUtil.formatDateMs(ms, format: formatToday); + } + + if (DateUtil.isToday(ms, locMs: _locTimeMs)) { + return DateUtil.formatDateMs(ms, format: formatToday); + } + + if (DateUtil.isYesterdayByMs(ms, _locTimeMs)) { + return languageCode == 'zh' ? '昨天' : 'Yesterday'; + } + + if (DateUtil.isWeek(ms, locMs: _locTimeMs)) { + return DateUtil.getWeekdayByMs(ms, + languageCode: languageCode, short: short); + } + + return DateUtil.formatDateMs(ms, format: format); + } + + /// get Yesterday. + /// 获取昨天. + static String _getYesterday( + int ms, + TimelineInfo info, + DayFormat dayFormat, + ) { + return info.customYesterday() + + (dayFormat == DayFormat.Full + ? (' ' + DateUtil.formatDateMs(ms, format: 'HH:mm')) + : ''); + } + + /// get is not year info. + /// 获取非今年信息. + static String _getYear( + int ms, + DayFormat dayFormat, + ) { + if (dayFormat != DayFormat.Simple) { + return DateUtil.formatDateMs(ms, + format: (dayFormat == DayFormat.Common + ? 'yyyy-MM-dd' + : 'yyyy-MM-dd HH:mm')); + } + return ''; + } + + /// format Days. + static String _formatDays( + int ms, + num days, + TimelineInfo info, + DayFormat dayFormat, + ) { + String timeline; + switch (dayFormat) { + case DayFormat.Simple: + timeline = (days == 1 + ? info.customYesterday().isEmpty + ? info.oneDay(days.round()) + : info.days(2) + : info.days(days.round())); + break; + case DayFormat.Common: + timeline = DateUtil.formatDateMs(ms, format: 'MM-dd'); + break; + case DayFormat.Full: + timeline = DateUtil.formatDateMs(ms, format: 'MM-dd HH:mm'); + break; + } + return timeline; + } +} diff --git a/flutter_helper/lib/utils/util_timer.dart b/flutter_helper/lib/utils/util_timer.dart new file mode 100644 index 00000000..d5a1ebe6 --- /dev/null +++ b/flutter_helper/lib/utils/util_timer.dart @@ -0,0 +1,119 @@ +import 'dart:async'; + +///timer callback.(millisUntilFinished 毫秒). +typedef void OnTimerTickCallback(int millisUntilFinished); + +/** + * @Author: Sky24n + * @GitHub: https://github.com/Sky24n + * @Description: Timer Util. + * @Date: 2018/9/28 + */ + +/// TimerUtil. +class TimerUtil { + TimerUtil( + {this.mInterval = Duration.millisecondsPerSecond, this.mTotalTime = 0}); + + /// Timer. + Timer _mTimer; + + /// Is Timer active. + /// Timer是否启动. + bool _isActive = false; + + /// Timer interval (unit millisecond,def: 1000 millisecond). + /// Timer间隔 单位毫秒,默认1000毫秒(1秒). + int mInterval; + + /// countdown totalTime. + /// 倒计时总时间 + int mTotalTime; //单位毫秒 + + OnTimerTickCallback _onTimerTickCallback; + + /// set Timer interval. (unit millisecond). + /// 设置Timer间隔. + void setInterval(int interval) { + if (interval <= 0) interval = Duration.millisecondsPerSecond; + mInterval = interval; + } + + /// set countdown totalTime. (unit millisecond). + /// 设置倒计时总时间. + void setTotalTime(int totalTime) { + if (totalTime <= 0) return; + mTotalTime = totalTime; + } + + /// start Timer. + /// 启动定时Timer. + void startTimer() { + if (_isActive || mInterval <= 0) return; + _isActive = true; + Duration duration = Duration(milliseconds: mInterval); + _doCallback(0); + _mTimer = Timer.periodic(duration, (Timer timer) { + _doCallback(timer.tick); + }); + } + + /// start countdown Timer. + /// 启动倒计时Timer. + void startCountDown() { + if (_isActive || mInterval <= 0 || mTotalTime <= 0) return; + _isActive = true; + Duration duration = Duration(milliseconds: mInterval); + _doCallback(mTotalTime); + _mTimer = Timer.periodic(duration, (Timer timer) { + int time = mTotalTime - mInterval; + mTotalTime = time; + if (time >= mInterval) { + _doCallback(time); + } else if (time == 0) { + _doCallback(time); + cancel(); + } else { + timer.cancel(); + Future.delayed(Duration(milliseconds: time), () { + mTotalTime = 0; + _doCallback(0); + cancel(); + }); + } + }); + } + + void _doCallback(int time) { + if (_onTimerTickCallback != null) { + _onTimerTickCallback(time); + } + } + + /// update countdown totalTime. + /// 重设倒计时总时间. + void updateTotalTime(int totalTime) { + cancel(); + mTotalTime = totalTime; + startCountDown(); + } + + /// timer is Active. + /// Timer是否启动. + bool isActive() { + return _isActive; + } + + /// Cancels the timer. + /// 取消计时器. + void cancel() { + _mTimer?.cancel(); + _mTimer = null; + _isActive = false; + } + + /// set timer callback. + void setOnTimerTickCallback(OnTimerTickCallback callback) { + _onTimerTickCallback = callback; + } +} diff --git a/flutter_helper/lib/widgets/a001_about_dialog.dart b/flutter_helper/lib/widgets/a001_about_dialog.dart new file mode 100644 index 00000000..4761d041 --- /dev/null +++ b/flutter_helper/lib/widgets/a001_about_dialog.dart @@ -0,0 +1,247 @@ +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; + +class DialogHomeApp extends StatelessWidget { + @override + Widget build(BuildContext context) { + return MaterialApp( + title: 'Flutter Demo', + theme: ThemeData( + primarySwatch: Colors.blue, + visualDensity: VisualDensity.adaptivePlatformDensity, + ), + home: DialogHomePage(title: 'Flutter Demo Home Page'), + ); + } +} + +class DialogHomePage extends StatefulWidget { + DialogHomePage({Key key, this.title}) : super(key: key); + + final String title; + + @override + _DialogHomePageState createState() => _DialogHomePageState(); +} + +class _DialogHomePageState extends State { + int _counter = 0; + + void _incrementCounter() { + setState(() { + showSimpleDialog(); + _counter++; + }); + } + + // 显示第一个Dialog + void showAlertDialog() { + showDialog( + context: context, + barrierDismissible: false, + builder: (BuildContext context) { + return new AlertDialog( + title: Text("标题"), + //可滑动 + content: SingleChildScrollView( + child: ListBody( + children: [ + Text("内容1"), + Text("内容2"), + Text("内容1"), + Text("内容2"), + Text("内容2"), + ], + ), + ), + actions: [ + FlatButton( + onPressed: () { + Navigator.of(context).pop(); + }, + child: Text("确定")), + FlatButton( + onPressed: () { + Navigator.of(context).pop(); + }, + child: Text("取消")) + ], + ); + }); + } + + void showCupertinoAlertDialog() { + showDialog( + context: context, + // false = user must tap button, true = tap outside dialog + builder: (BuildContext dialogContext) { + return CupertinoAlertDialog( + title: Text('这是一个iOS风格的对话框'), + content: Column( + children: [ + SizedBox( + height: 10, + ), + Align( + child: Text('这是消息'), + ) + ], + ), + actions: [ + CupertinoDialogAction( + child: Text('取消'), + onPressed: () { + Navigator.pop(context); + print('取消'); + }, + ), + CupertinoDialogAction( + child: Text('确定'), + onPressed: () { + //Navigator.pop(context); + print('确定'); + }, + ), + ], + ); + }, + ); + } + + //属性说明如下: + // applicationIcon:应用程序的图标。 + // applicationName:应用程序名称。 + // applicationVersion:应用程序版本。 + // applicationLegalese:著作权(copyright)的提示。 + // children:位置如上图的红蓝绿色的位置。 + // http://laomengit.com/flutter/widgets/AboutDialog.html + void showAboutDialog2() { + showAboutDialog( + context: context, + applicationIcon: + Image.asset('images/bird.png', height: 100, width: 100), + applicationName: '应用程序', + applicationVersion: '1.0.0', + applicationLegalese: 'copyrith 老孟,一枚有态度的程序员', + children: [ + Container( + height: 30, + color: Colors.red, + ), + Container( + height: 30, + color: Colors.blue, + ), + Container( + height: 30, + color: Colors.green, + ), + ]); + } + + void showAboutDialog3() { + final TextStyle textStyle = Theme.of(context).textTheme.body1; + final List aboutBoxChildren = [ + SizedBox( + height: 24, + ), + RichText( + text: TextSpan(children: [ + TextSpan( + style: textStyle, + text: 'Flutter is Google’s UI toolkit for building beautiful, ' + 'natively compiled applications for mobile, web, and desktop ' + 'from a single codebase. Learn more about Flutter at '), + TextSpan( + style: textStyle.copyWith(color: Theme.of(context).accentColor), + text: 'https://flutter.dev'), + TextSpan(style: textStyle, text: '.'), + ]), + ) + ]; + var aboutListTile = AboutListTile( + icon: FlutterLogo(), + child: Text('About 老孟程序员'), + applicationName: '老孟程序员', + applicationVersion: 'V1.0.0', + applicationIcon: FlutterLogo(), + applicationLegalese: '专注分享Flutter相关内容', + aboutBoxChildren: aboutBoxChildren, + dense: false, + ); + showDialog( + context: context, + builder: (BuildContext context) { + return Scaffold(); + }); + } + + // SimpleDialog + void showSimpleDialog() { + showDialog( + context: context, + builder: (BuildContext context) { + return SimpleDialog( + title: Text('选择'), + children: [ + SimpleDialogOption( + child: Text('showAlertDialog'), + onPressed: () { + Navigator.of(context).pop(); + showAlertDialog(); + }, + ), + SimpleDialogOption( + child: Text('showCupertinoAlertDialog'), + onPressed: () { + Navigator.of(context).pop(); + showCupertinoAlertDialog(); + }, + ), + SimpleDialogOption( + child: Text('showAboutDialog2()'), + onPressed: () { + Navigator.of(context).pop(); + showAboutDialog2(); + }, + ), + SimpleDialogOption( + child: Text('showAboutDialog3()'), + onPressed: () { + Navigator.of(context).pop(); + showAboutDialog3(); + }, + ), + ], + ); + }); + } + + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: AppBar( + title: Text(widget.title), + ), + body: Center( + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Text( + 'You have pushed the button this many times:', + ), + Text( + '$_counter', + style: Theme.of(context).textTheme.headline4, + ), + ], + ), + ), + floatingActionButton: FloatingActionButton( + onPressed: _incrementCounter, + tooltip: 'Increment', + child: Icon(Icons.add), + ), // This trailing comma makes auto-formatting nicer for build methods. + ); + } +} diff --git a/flutter_helper/lib/widgets/a002_about_list_tile.dart b/flutter_helper/lib/widgets/a002_about_list_tile.dart new file mode 100644 index 00000000..e764ef92 --- /dev/null +++ b/flutter_helper/lib/widgets/a002_about_list_tile.dart @@ -0,0 +1,87 @@ +/// Flutter code sample for AboutListTile + +// This sample shows two ways to open [AboutDialog]. The first one +// uses an [AboutListTile], and the second uses the [showAboutDialog] function. + +import 'package:flutter/material.dart'; + +// void main() => runApp(const MyApp()); + +/// This is the main application widget. +class AboutListTileApp extends StatelessWidget { + const AboutListTileApp({key}) : super(key: key); + + static const String _title = 'Flutter Code Sample'; + + @override + Widget build(BuildContext context) { + return const MaterialApp( + title: _title, + home: MyStatelessWidget(), + ); + } +} + +/// This is the stateless widget that the main application instantiates. +class MyStatelessWidget extends StatelessWidget { + const MyStatelessWidget({key}) : super(key: key); + + @override + Widget build(BuildContext context) { + final ThemeData theme = Theme.of(context); + final TextStyle textStyle = theme.textTheme.bodyText2; + final List aboutBoxChildren = [ + const SizedBox(height: 24), + RichText( + text: TextSpan( + children: [ + TextSpan( + style: textStyle, + text: "Flutter is Google's UI toolkit for building beautiful, " + 'natively compiled applications for mobile, web, and desktop ' + 'from a single codebase. Learn more about Flutter at '), + TextSpan( + style: textStyle.copyWith(color: theme.colorScheme.primary), + text: 'https://flutter.dev'), + TextSpan(style: textStyle, text: '.'), + ], + ), + ), + ]; + + return Scaffold( + appBar: AppBar( + title: const Text('Show About Example'), + ), + drawer: Drawer( + child: SingleChildScrollView( + child: SafeArea( + child: AboutListTile( + icon: const Icon(Icons.info), + applicationIcon: const FlutterLogo(), + applicationName: 'Show About Example', + applicationVersion: 'August 2019', + applicationLegalese: '\u{a9} 2014 The Flutter Authors', + aboutBoxChildren: aboutBoxChildren, + ), + ), + ), + ), + body: Center( + child: ElevatedButton( + child: const Text('Show About Example'), + onPressed: () { + showAboutDialog( + context: context, + applicationIcon: const FlutterLogo(), + applicationName: 'Show About Example', + applicationVersion: 'August 2019', + applicationLegalese: '\u{a9} 2014 The Flutter Authors', + children: aboutBoxChildren, + ); + }, + ), + ), + ); + } +} diff --git a/flutter_helper/lib/widgets/a003_absorbpointer.dart b/flutter_helper/lib/widgets/a003_absorbpointer.dart new file mode 100644 index 00000000..02c00e30 --- /dev/null +++ b/flutter_helper/lib/widgets/a003_absorbpointer.dart @@ -0,0 +1,58 @@ +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; + +/// This is them application widgets +class AbsorbPointerApp extends StatelessWidget { + AbsorbPointerApp({key}) : super(key: key) {} + + @override + Widget build(BuildContext context) { + String _title = 'Flutter Code Sample'; + return MaterialApp( + title: _title, + home: Scaffold( + appBar: AppBar( + title: Text(_title), + ), + body: const Center( + child: MyStatelessWidget(), + ), + ), + ); + } +} + +class MyStatelessWidget extends StatelessWidget { + const MyStatelessWidget({key}) : super(key: key); + + @override + Widget build(BuildContext context) { + return Stack( + alignment: AlignmentDirectional.center, + children: [ + SizedBox( + width: 200.0, + height: 100.0, + child: ElevatedButton( + onPressed: () {}, + child: null, + ), + ), + SizedBox( + width: 100.0, + height: 200.0, + child: AbsorbPointer( + absorbing: true, + child: ElevatedButton( + style: ElevatedButton.styleFrom( + primary: Colors.blue.shade200, + ), + onPressed: () {}, + child: null, + ), + ), + ), + ], + ); + } +} diff --git a/flutter_helper/lib/widgets/a004_actionchip.dart b/flutter_helper/lib/widgets/a004_actionchip.dart new file mode 100644 index 00000000..d1a0ce63 --- /dev/null +++ b/flutter_helper/lib/widgets/a004_actionchip.dart @@ -0,0 +1,142 @@ +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; + +/// http://laomengit.com/flutter/widgets/Chip.html#actionchip +/// This is them application widgets +class ActionChipApp extends StatelessWidget { + ActionChipApp({key}) : super(key: key) {} + + @override + Widget build(BuildContext context) { + String _title = 'Flutter Code Sample'; + return MaterialApp( + title: _title, + home: Scaffold( + appBar: AppBar( + title: Text(_title), + ), + body: const Center( + child: MyStatelessWidget(), + ), + ), + ); + } +} + +class MyStatelessWidget extends StatelessWidget { + const MyStatelessWidget({key}) : super(key: key); + + @override + Widget build(BuildContext context) { + return Scrollbar( + child: SingleChildScrollView( + child: Column( + children: [ + RawChip( + label: Text('老孟'), + ), + RawChip( + label: Text('老孟禁用'), + isEnabled: false, + ), + RawChip( + avatar: CircleAvatar( + child: Text('孟'), + ), + label: Text('老孟'), + ), + RawChip( + label: Text('老孟'), + labelStyle: TextStyle(color: Colors.blue), + labelPadding: EdgeInsets.symmetric(horizontal: 100 /*左右间距*/), + ), + RawChip( + label: Text('老孟'), + onDeleted: () { + print('onDeleted'); + }, + deleteIcon: Icon(Icons.delete), + deleteIconColor: Colors.red, + deleteButtonTooltipMessage: '删除', + ), + RawChip( + label: Text('老孟'), + shape: + RoundedRectangleBorder(borderRadius: BorderRadius.circular(10)), + backgroundColor: Colors.blue, + padding: EdgeInsets.symmetric(vertical: 10), + ), + RawChip( + label: Text('老孟'), + elevation: 8, + shadowColor: Colors.blue, + ), +//bool _selected = false; +// RawChip( +// label: Text('老孟'), +// selected: _selected, +// onSelected: (v){ +// setState(() { +// _selected = v; +// }); +// }, +// selectedColor: Colors.blue, +// selectedShadowColor: Colors.red, +// ) +// + RawChip( + label: Text('老孟'), + selected: true, + showCheckmark: true, + checkmarkColor: Colors.red, + ), + RawChip( + label: Text('老孟'), + onPressed: () { + print('onPressed'); + }, + pressElevation: 12, + ), + Wrap( + spacing: 15, + children: [ + ChoiceChip(label: Text('老孟 0'), selected: false), + ChoiceChip(label: Text('老孟 1'), selected: false), + ChoiceChip(label: Text('老孟 2'), selected: false), + ChoiceChip(label: Text('老孟 3'), selected: false), + ChoiceChip(label: Text('老孟 4'), selected: false), + ChoiceChip(label: Text('老孟 5'), selected: false), + ChoiceChip(label: Text('老孟 6'), selected: false), + ChoiceChip(label: Text('老孟 7'), selected: false), + ], + ), + Column( + children: [ + Wrap( + children: [ + FilterChip(label: Text("zj 1"), onSelected: (v) {}), + FilterChip(label: Text("zj 1"), onSelected: (v) {}), + FilterChip(label: Text("zj 1"), onSelected: (v) {}), + FilterChip(label: Text("zj 1"), onSelected: (v) {}), + FilterChip(label: Text("zj 1"), onSelected: (v) {}), + FilterChip(label: Text("zj 1"), onSelected: (v) {}), + FilterChip(label: Text("zj 1"), onSelected: (v) {}), + ], + ), + Text('选中:1'), + ], + ), + ActionChip( + avatar: CircleAvatar( + backgroundColor: Colors.grey.shade800, + child: Text('孟'), + ), + label: Text('老孟'), + onPressed: () { + print("onPressed"); + }) + ], + ), + )); + } +} diff --git a/flutter_helper/lib/widgets/a005_alertdialog.dart b/flutter_helper/lib/widgets/a005_alertdialog.dart new file mode 100644 index 00000000..84303d22 --- /dev/null +++ b/flutter_helper/lib/widgets/a005_alertdialog.dart @@ -0,0 +1,250 @@ +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; + +class AlertDialogApp extends StatelessWidget { + @override + Widget build(BuildContext context) { + return MaterialApp( + title: 'Flutter Demo', + theme: ThemeData( + primarySwatch: Colors.blue, + visualDensity: VisualDensity.adaptivePlatformDensity, + ), + home: AlertDialogPage(title: 'Flutter Demo Home Page'), + ); + } +} + +class AlertDialogPage extends StatefulWidget { + AlertDialogPage({Key key, this.title}) : super(key: key); + + final String title; + + @override + _DialogHomePageState createState() => _DialogHomePageState(); +} + +class _DialogHomePageState extends State { + int _counter = 0; + + void _incrementCounter() { + setState(() { + showSimpleDialog(); + _counter++; + }); + } + + void showAlertDialog1() { + showDialog( + context: context, + builder: (context) { + return AlertDialog( + title: Text('显示'), + content: Text('确认删除吗?'), + actions: [ + FlatButton(onPressed: () {}, child: Text('取消')), + FlatButton(onPressed: () {}, child: Text('确认')), + ], + ); + }); + } + + void showAlertDialog2() { + showDialog( + context: context, + builder: (context) { + return AlertDialog( + title: Text('显示'), + content: Text('确认删除吗?'), + backgroundColor: Colors.lightBlueAccent, + elevation: 24, + shape: + RoundedRectangleBorder(borderRadius: BorderRadius.circular(50)), + actions: [ + FlatButton(onPressed: () {}, child: Text('取消')), + FlatButton(onPressed: () {}, child: Text('确认')), + ], + ); + }); + } + + void showAlertDialog3() async { + var result = await showDialog( + context: context, + builder: (context) { + return AlertDialog( + title: Text('显示'), + content: Text('确认删除吗?'), + backgroundColor: Colors.lightBlueAccent, + elevation: 24, + shape: + RoundedRectangleBorder(borderRadius: BorderRadius.circular(50)), + actions: [ + FlatButton( + onPressed: () { + Navigator.of(context).pop('cancel'); + }, + child: Text('取消')), + FlatButton( + onPressed: () { + Navigator.of(context).pop('ok'); + }, + child: Text('确认')), + ], + ); + }); + print("the result is $result"); + } + + void showCupertinoAlertDialog() { + showCupertinoDialog( + context: context, + builder: (context) { + return CupertinoAlertDialog( + title: Text('显示'), + content: Text('确认删除吗?'), + actions: [ + CupertinoDialogAction( + child: Text('取消'), + onPressed: () {}, + ), + CupertinoDialogAction( + child: Text('确认'), + onPressed: () {}, + ), + ], + ); + }); + } + + // http://laomengit.com/flutter/widgets/Dialog.html + void showSimpleDialog___() { + SimpleDialog( + title: Text('提示'), + children: [ + Container( + height: 80, + alignment: Alignment.center, + + child: Text('确认删除吗?'), + ), + Divider(height: 1,), + FlatButton( + child: Text('取消'), + onPressed: () { + Navigator.of(context).pop('cancel'); + }, + ), + Divider(height: 1,), + FlatButton( + child: Text('确认'), + onPressed: () { + Navigator.of(context).pop('ok'); + }, + ), + ], + ); + + // SimpleDialog( + // title: Text('提示'), + // children: [ + // Container( + // height: 80, + // alignment: Alignment.center, + // child: Text('确认删除吗?'), + // ), + // Divider( + // height: 1, + // ), + // FlatButton( + // onPressed: () { + // Navigator.of(context).pop('cancel'); + // }, + // child: Text('取消')), + // Divider( + // height: 1, + // ), + // FlatButton(onPressed: () {}, child: Text('确认')), + // ], + // ); + } + + // SimpleDialog + void showSimpleDialog() { + showDialog( + context: context, + builder: (BuildContext context) { + return SimpleDialog( + title: Text('选择'), + children: [ + SimpleDialogOption( + child: Text('showAlertDialog1'), + onPressed: () { + Navigator.of(context).pop(); + showAlertDialog1(); + }, + ), + SimpleDialogOption( + child: Text('showAlertDialog2'), + onPressed: () { + Navigator.of(context).pop(); + showAlertDialog2(); + }, + ), + SimpleDialogOption( + child: Text('showAlertDialog3'), + onPressed: () async { + // 等待结果 + //Navigator.of(context).pop(); + showAlertDialog3(); + }, + ), + SimpleDialogOption( + child: Text('showCupertinoAlertDialog'), + onPressed: () { + // 等待结果 + //Navigator.of(context).pop(); + showCupertinoAlertDialog(); + }, + ), + SimpleDialogOption( + child: Text('showSimpleDialog___'), + onPressed: () { + // 等待结果 + //Navigator.of(context).pop(); + showSimpleDialog___(); + }, + ), + ], + ); + }); + } + + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: AppBar( + title: Text(widget.title), + ), + body: Center( + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Text( + 'You have pushed the button this many times:', + ), + Text( + '$_counter', + style: Theme.of(context).textTheme.headline4, + ), + ], + ), + ), + floatingActionButton: FloatingActionButton( + onPressed: _incrementCounter, + tooltip: 'Increment', + child: Icon(Icons.add), + ), // This trailing comma makes auto-formatting nicer for build methods. + ); + } +} diff --git a/flutter_helper/lib/widgets/a006_align.dart b/flutter_helper/lib/widgets/a006_align.dart new file mode 100644 index 00000000..b158ac83 --- /dev/null +++ b/flutter_helper/lib/widgets/a006_align.dart @@ -0,0 +1,244 @@ +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; + +class AlignApp extends StatelessWidget { + @override + Widget build(BuildContext context) { + return MaterialApp( + title: 'Flutter Demo', + theme: ThemeData( + primarySwatch: Colors.blue, + visualDensity: VisualDensity.adaptivePlatformDensity, + ), + home: AlignPage(), + ); + } +} + +class AlignPage extends StatefulWidget { + @override + State createState() => AlignPageState(); +} + +class AlignPageState extends State + with SingleTickerProviderStateMixin { + AnimationController _animationController; + Animation _animation; + + var _alignment = Alignment.topLeft; + + @override + void initState() { + _animationController = + AnimationController(duration: Duration(seconds: 10), vsync: this); + _animation = Tween( + begin: Alignment.topLeft, end: Alignment.bottomRight) + .animate(_animationController); + //开始动画 + _animationController.forward(); + super.initState(); + } + + @override + Widget build(BuildContext context) { + print("$_animation"); + return Scaffold( + appBar: AppBar( + title: Text("Zhaojian"), + ), + body: Center( + child: Scrollbar( + child: SingleChildScrollView( + //physics: ClampingScrollPhysics(), + physics: AlwaysScrollableScrollPhysics(), + child: Column( + children: [ + Container( + width: 200, + height: 200, + color: Colors.black12, + // http://laomengit.com/flutter/widgets/AnimatedAlign.html + child: AnimatedAlign( + onEnd: () { + print('onEnd'); + }, + curve: Curves.bounceInOut, + alignment: _alignment, + duration: Duration(seconds: 10), + child: IconButton( + icon: Icon( + Icons.print, + color: Colors.red, + size: 30, + ), + onPressed: () { + setState(() { + _alignment = Alignment.bottomRight; + }); + }), + ), + ), + Divider( + height: 1, + ), + Container( + height: 200, + width: 200, + color: Colors.blue, + child: AlignTransition( + alignment: _animation, + child: Container( + height: 30, + width: 30, + color: Colors.red, + ), + ), + ), + Divider( + height: 1, + ), + Container( + color: Colors.lightBlue, + child: Align( + alignment: Alignment.topLeft, + widthFactor: 2, + heightFactor: 2, + child: Container( + height: 50, + width: 50, + color: Colors.red, + ), + )), + Divider( + height: 1, + ), + Container( + color: Colors.lightBlue, + width: 100, + height: 100, + child: Align( + alignment: Alignment.topLeft, + child: Text( + 'AA', + style: TextStyle(color: Colors.white, fontSize: 20), + ), + )), + Divider( + height: 1, + ), + Container( + color: Colors.lightBlue, + width: 100, + height: 100, + child: Align( + alignment: Alignment.topCenter, + child: Text( + 'AA', + style: TextStyle(color: Colors.white, fontSize: 20), + ), + )), + Divider( + height: 1, + ), + Container( + color: Colors.lightBlue, + width: 100, + height: 100, + child: Align( + alignment: Alignment.topRight, + child: Text( + 'AA', + style: TextStyle(color: Colors.white, fontSize: 20), + ), + )), + Divider( + height: 1, + ), + Container( + color: Colors.lightBlue, + width: 100, + height: 100, + child: Align( + alignment: Alignment.centerLeft, + child: Text( + 'AA', + style: TextStyle(color: Colors.white, fontSize: 20), + ), + )), + Divider( + height: 1, + ), + Container( + color: Colors.lightBlue, + width: 100, + height: 100, + child: Align( + alignment: Alignment.center, + child: Text( + 'AA', + style: TextStyle(color: Colors.white, fontSize: 20), + ), + )), + Divider( + height: 1, + ), + Container( + color: Colors.lightBlue, + width: 100, + height: 100, + child: Align( + alignment: Alignment.centerRight, + child: Text( + 'AA', + style: TextStyle(color: Colors.white, fontSize: 20), + ), + )), + Divider( + height: 1, + ), + Container( + color: Colors.lightBlue, + width: 100, + height: 100, + child: Align( + alignment: Alignment.bottomLeft, + child: Text( + 'AA', + style: TextStyle(color: Colors.white, fontSize: 20), + ), + )), + Divider( + height: 1, + ), + Container( + color: Colors.lightBlue, + width: 100, + height: 100, + child: Align( + alignment: Alignment.bottomCenter, + child: Text( + 'AA', + style: TextStyle(color: Colors.white, fontSize: 20), + ), + )), + Divider( + height: 1, + ), + Container( + color: Colors.lightBlue, + width: 100, + height: 100, + child: Align( + alignment: Alignment.bottomRight, + child: Text( + 'AA', + style: TextStyle(color: Colors.white, fontSize: 20), + ), + )) + ], + ), + ), + )), + ); + } +} diff --git a/flutter_helper/lib/widgets/a007_aniatedbuilder.dart b/flutter_helper/lib/widgets/a007_aniatedbuilder.dart new file mode 100644 index 00000000..617a5ce7 --- /dev/null +++ b/flutter_helper/lib/widgets/a007_aniatedbuilder.dart @@ -0,0 +1,80 @@ +import 'dart:math'; + +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; + +class AnimatedBuilderApp extends StatelessWidget { + @override + Widget build(BuildContext context) { + //return Test(); + return MaterialApp( + title: 'Flutter Demo', + theme: ThemeData( + primarySwatch: Colors.blue, + visualDensity: VisualDensity.adaptivePlatformDensity, + ), + home: Test(), + ); + } +} + +class Test extends StatefulWidget { + @override + State createState() { + return _TestState(); + } +} + +class _TestState extends State with TickerProviderStateMixin { + AnimationController _animationController; + Animation _animation; + + @override + void initState() { + _animationController = AnimationController( + duration: Duration(seconds: 10), + vsync: this, + )..addStatusListener((status) { + if (status == AnimationStatus.completed) { + _animationController.reverse(); + } else if (status == AnimationStatus.dismissed) { + _animationController.forward(); + } + }); + _animation = Tween(begin: 0.0, end: 2.0 * pi).animate(_animationController); + // 开始动画 + _animationController.forward(); + super.initState(); + } + + @override + void dispose() { + _animationController.dispose(); + super.dispose(); + } + + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: AppBar( + title: Text("zhaojan"), + ), + body: AnimatedBuilder( + animation: _animation, + builder: (context, child) { + return Transform.rotate( + angle: _animation.value, + child: child, + ); + }, + child: FlutterLogo( + size: 60, + ), + ), + floatingActionButton: FloatingActionButton( + onPressed: () {}, + child: Text('h'), + ), + ); + } +} diff --git a/flutter_helper/lib/widgets/a008_animated_container.dart b/flutter_helper/lib/widgets/a008_animated_container.dart new file mode 100644 index 00000000..bdb710cb --- /dev/null +++ b/flutter_helper/lib/widgets/a008_animated_container.dart @@ -0,0 +1,49 @@ +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; +/// http://laomengit.com/flutter/widgets/AnimatedContainer.html +class AnimatedContainerApp extends StatelessWidget { + @override + Widget build(BuildContext context) { + return MaterialApp( + title: "Flutter APP", + theme: ThemeData( + primarySwatch: Colors.blue, + visualDensity: VisualDensity.adaptivePlatformDensity, + ), + home: _Test(), + ); + } +} + +class _Test extends StatefulWidget { + @override + State createState() { + return _TestState(); + } +} + +class _TestState extends State<_Test> { + bool click = false; + + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: AppBar(title: Text("zhaojian"),), + body: Center( + child: GestureDetector( + onTap: () { + setState(() { + click = !click; + }); + }, + child: AnimatedContainer( + height: click ? 200 : 100, + width: click ? 200 : 100, + color: Colors.green, + duration: Duration(seconds: 1), + ), + ), + ), + ); + } +} diff --git a/flutter_helper/lib/widgets/a009_animated_crossfade.dart b/flutter_helper/lib/widgets/a009_animated_crossfade.dart new file mode 100644 index 00000000..d801e84c --- /dev/null +++ b/flutter_helper/lib/widgets/a009_animated_crossfade.dart @@ -0,0 +1,76 @@ +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; + +/// http://laomengit.com/flutter/widgets/AnimatedContainer.html +class AnimatedCrossFadeApp extends StatelessWidget { + @override + Widget build(BuildContext context) { + return MaterialApp( + title: "Flutter APP", + theme: ThemeData( + primarySwatch: Colors.blue, + visualDensity: VisualDensity.adaptivePlatformDensity, + ), + home: _Test(), + ); + } +} + +class _Test extends StatefulWidget { + @override + State createState() { + return _TestState(); + } +} + +class _TestState extends State<_Test> { + bool _showFirst = false; + + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: AppBar( + title: Text("zhaojian"), + ), + body: Center( + child: AnimatedCrossFade( + firstChild: Container( + width: 150, + height: 150, + alignment: Alignment.center, + decoration: BoxDecoration( + shape: BoxShape.circle, + color: Colors.blue, + ), + child: Text( + 'first child', + style: TextStyle(color: Colors.white), + ), + ), + secondChild: Container( + width: 150, + height: 150, + alignment: Alignment.center, + decoration: BoxDecoration( + shape: BoxShape.rectangle, + color: Colors.orange, + borderRadius: BorderRadius.circular(20), + ), + child: Text( + 'second child', + style: TextStyle(color: Colors.white), + ), + ), + crossFadeState: _showFirst + ? CrossFadeState.showFirst + : CrossFadeState.showSecond, + duration: Duration(seconds: 1)), + ), + floatingActionButton: FloatingActionButton(onPressed: () { + setState(() { + _showFirst = !_showFirst; + }); + }), + ); + } +} diff --git a/flutter_helper/lib/widgets/a010_animate_default_textstyle.dart b/flutter_helper/lib/widgets/a010_animate_default_textstyle.dart new file mode 100644 index 00000000..a3268f3e --- /dev/null +++ b/flutter_helper/lib/widgets/a010_animate_default_textstyle.dart @@ -0,0 +1,68 @@ +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; + + +///http://laomengit.com/flutter/widgets/AnimatedDefaultTextStyle.html#animateddefaulttextstyle +class AnimatedDefaultTextStyleApp extends StatelessWidget { + @override + Widget build(BuildContext context) { + return MaterialApp( + title: "Flutter DEMO APP", + theme: ThemeData( + primarySwatch: Colors.orange, + visualDensity: VisualDensity.adaptivePlatformDensity, + ), + home: _Test(), + ); + } +} + +class _Test extends StatefulWidget { + @override + State createState() { + return _TestState(); + } +} + +class _TestState extends State<_Test> with SingleTickerProviderStateMixin { + TextStyle _style; + + @override + void initState() { + _style = TextStyle(color: Colors.blue, fontSize: 14); + super.initState(); + } + + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: AppBar( + title: Text("FFFFFF"), + ), + body: Column( + children: [ + SizedBox( + height: 200, + ), + AnimatedDefaultTextStyle( + child: Text('老孟'), + style: _style, + duration: Duration(seconds: 1), + ), + SizedBox( + height: 100, + ), + RaisedButton(onPressed: () { + setState(() { + if (_style.fontSize == 42) { + _style = TextStyle(color: Colors.red, fontSize: 14); + } else { + _style = TextStyle(color: Colors.red, fontSize: 42); + } + }); + }), + ], + ), + ); + } +} diff --git a/flutter_helper/lib/widgets/a011_animate_icon.dart b/flutter_helper/lib/widgets/a011_animate_icon.dart new file mode 100644 index 00000000..7e653c26 --- /dev/null +++ b/flutter_helper/lib/widgets/a011_animate_icon.dart @@ -0,0 +1,73 @@ +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; + + +///http://laomengit.com/flutter/widgets/AnimatedIcon.html +class AnimatedIconApp extends StatelessWidget { + @override + Widget build(BuildContext context) { + return MaterialApp( + title: "Flutter DEMO APP", + theme: ThemeData( + primarySwatch: Colors.orange, + visualDensity: VisualDensity.adaptivePlatformDensity, + ), + home: _Test(), + ); + } +} + +class _Test extends StatefulWidget { + @override + State createState() { + return _TestState(); + } +} + +class _TestState extends State<_Test> with TickerProviderStateMixin { + //TextStyle _style; + AnimationController _animationController; + + @override + void initState() { + //_style = TextStyle(color: Colors.blue, fontSize: 14); + _animationController = AnimationController( + duration: Duration(seconds: 1), + vsync: this, + ) + ..addStatusListener((status) { + if (status == AnimationStatus.completed) { + _animationController.reverse(); + } else if (status == AnimationStatus.dismissed) { + _animationController.forward(); + } + }); + _animationController.forward(); + super.initState(); + } + + @override + void dispose() { + // TODO: implement dispose + super.dispose(); + _animationController.dispose(); + } + + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: AppBar( + title: Text("FFFFFF"), + ), + body: Container( + height: 100, + width: 100, + alignment: Alignment.center, + child: AnimatedIcon( + icon: AnimatedIcons.view_list, + progress: _animationController, + ), + ), + ); + } +} diff --git a/flutter_helper/lib/widgets/a012_animate_list.dart b/flutter_helper/lib/widgets/a012_animate_list.dart new file mode 100644 index 00000000..e52aa670 --- /dev/null +++ b/flutter_helper/lib/widgets/a012_animate_list.dart @@ -0,0 +1,107 @@ +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; + +///http://laomengit.com/flutter/widgets/AnimatedIcon.html +class AnimatedListApp extends StatelessWidget { + @override + Widget build(BuildContext context) { + return MaterialApp( + title: "Flutter DEMO APP", + theme: ThemeData( + primarySwatch: Colors.orange, + visualDensity: VisualDensity.adaptivePlatformDensity, + ), + home: _Test(), + ); + } +} + +class _Test extends StatefulWidget { + @override + State createState() { + return _TestState(); + } +} + +class _TestState extends State<_Test> with SingleTickerProviderStateMixin { + List _list = []; + final GlobalKey _listKey = GlobalKey(); + + void _addItem() { + final int _index = _list.length; + _list.insert(_index, _index); + _listKey.currentState.insertItem(_index); + } + + void _removeItem() { + final int _index = _list.length - 1; + var item = _list[_index].toString(); + _listKey.currentState.removeItem( + _index, (context, animation) => _buildItem(item, animation)); + _list.removeAt(_index); + } + + Widget _buildItem(String _item, Animation _animation) { + if (true) + return _buildItem2(_item, _animation); + else + return SlideTransition( + position: _animation + .drive( + CurveTween(curve: Curves.easeIn), + ) + .drive(Tween(begin: Offset(1, 1), end: Offset(0, 1))), + child: Card( + child: ListTile( + title: Text(_item), + ), + ), + ); + } + + Widget _buildItem2(String _item, Animation _animation) { + return SizeTransition( + sizeFactor: _animation, + child: Card( + child: ListTile( + title: Text(_item), + ), + ), + ); + } + + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: AppBar( + title: Text("FFFFFF"), + ), + body: AnimatedList( + key: _listKey, + initialItemCount: _list.length, + itemBuilder: (context, index, animation) { + return _buildItem(_list[index].toString(), animation); + }, + ), + floatingActionButton: Row( + mainAxisAlignment: MainAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + FloatingActionButton( + onPressed: () { + _addItem(); + }, + child: Icon(Icons.add), + ), + SizedBox( + width: 60, + ), + FloatingActionButton( + onPressed: () => _removeItem(), + child: Icon(Icons.remove), + ), + ], + ), + ); + } +} diff --git a/flutter_helper/lib/widgets/a013_animate_modalbarrier.dart b/flutter_helper/lib/widgets/a013_animate_modalbarrier.dart new file mode 100644 index 00000000..c3798ee1 --- /dev/null +++ b/flutter_helper/lib/widgets/a013_animate_modalbarrier.dart @@ -0,0 +1,68 @@ +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; + +///http://laomengit.com/flutter/widgets/AnimatedModalBarrier.html#animatedmodalbarrier +class AnimatedModalBarrierApp extends StatelessWidget { + @override + Widget build(BuildContext context) { + return MaterialApp( + title: "Flutter DEMO APP", + theme: ThemeData( + primarySwatch: Colors.orange, + visualDensity: VisualDensity.adaptivePlatformDensity, + ), + home: _Test(), + ); + } +} + +class _Test extends StatefulWidget { + @override + State createState() { + return _TestState(); + } +} + +class _TestState extends State<_Test> with SingleTickerProviderStateMixin { + AnimationController _animationController; + Animation _animation; + + @override + void initState() { + _animationController = + AnimationController(duration: Duration(seconds: 2), vsync: this) + ..addStatusListener((status) { + if(status == AnimationStatus.completed) + _animationController.reverse(); + else if(status == AnimationStatus.dismissed) + _animationController.forward(); + }); + + _animation = ColorTween( + begin: Colors.red, + end: Colors.blue, + ).animate(_animationController); + + _animationController.forward(); + super.initState(); + } + + @override + void dispose() { + _animationController.dispose(); + super.dispose(); + } + + @override + Widget build(BuildContext context) { + return Center( + child: Container( + height: 100, + width: 100, + child: AnimatedModalBarrier( + color: _animation, + ), + ), + ); + } +} diff --git a/flutter_helper/lib/widgets/a014_animate_opacity.dart b/flutter_helper/lib/widgets/a014_animate_opacity.dart new file mode 100644 index 00000000..4f76d1b8 --- /dev/null +++ b/flutter_helper/lib/widgets/a014_animate_opacity.dart @@ -0,0 +1,71 @@ +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; + +///http://laomengit.com/flutter/widgets/AnimatedModalBarrier.html#animatedmodalbarrier +class AnimatedOpacityApp extends StatelessWidget { + @override + Widget build(BuildContext context) { + return MaterialApp( + title: "Flutter DEMO APP", + theme: ThemeData( + primarySwatch: Colors.orange, + visualDensity: VisualDensity.adaptivePlatformDensity, + ), + home: _Test(), + ); + } +} + +class _Test extends StatefulWidget { + @override + State createState() { + return _TestState(); + } +} + +class _TestState extends State<_Test> with SingleTickerProviderStateMixin { + @override + void initState() { + super.initState(); + } + + @override + void dispose() { + super.dispose(); + } + + var _opacity = 1.0; + + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: AppBar( + title: Text('zhaojan'), + ), + body: Center( + child: Container( + child: AnimatedOpacity( + opacity: _opacity, + duration: Duration(seconds: 2), + child: Container( + height: 60, + width: 150, + color: Colors.blue, + ), + ), + ), + ), + floatingActionButton: RaisedButton( + onPressed: () { + setState(() { + if (_opacity == 0) { + _opacity = 1.0; + } else { + _opacity = 0; + } + }); + }, + ), + ); + } +} diff --git a/flutter_helper/lib/widgets/a015_animate_padding.dart b/flutter_helper/lib/widgets/a015_animate_padding.dart new file mode 100644 index 00000000..3604e07f --- /dev/null +++ b/flutter_helper/lib/widgets/a015_animate_padding.dart @@ -0,0 +1,70 @@ +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; + +///http://laomengit.com/flutter/widgets/AnimatedModalBarrier.html#animatedmodalbarrier +class AnimatedPaddingApp extends StatelessWidget { + @override + Widget build(BuildContext context) { + return MaterialApp( + title: "Flutter DEMO APP", + theme: ThemeData( + primarySwatch: Colors.orange, + visualDensity: VisualDensity.adaptivePlatformDensity, + ), + home: _Test(), + ); + } +} + +class _Test extends StatefulWidget { + @override + State createState() { + return _TestState(); + } +} + +class _TestState extends State<_Test> with SingleTickerProviderStateMixin { + @override + void initState() { + super.initState(); + } + + @override + void dispose() { + super.dispose(); + } + + var _padding = 0.0; + + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: AppBar( + title: Text('zhaojan'), + ), + body: Center( + child: Container( + child: AnimatedPadding( + padding: EdgeInsets.symmetric(horizontal: _padding), + duration: Duration(milliseconds: 400), + child: Container( + height: 100, + color: Colors.red, + ), + ), + ), + ), + floatingActionButton: RaisedButton( + onPressed: () { + setState(() { + if (_padding == 0.0) { + _padding = 50.0; + } else { + _padding = 0.0; + } + }); + }, + ), + ); + } +} diff --git a/flutter_helper/lib/widgets/a016_animate_physicalmodel.dart b/flutter_helper/lib/widgets/a016_animate_physicalmodel.dart new file mode 100644 index 00000000..e6d78e2e --- /dev/null +++ b/flutter_helper/lib/widgets/a016_animate_physicalmodel.dart @@ -0,0 +1,91 @@ +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; + +///http://laomengit.com/flutter/widgets/AnimatedModalBarrier.html#animatedmodalbarrier +class AnimatedPhysicalModelApp extends StatelessWidget { + @override + Widget build(BuildContext context) { + return MaterialApp( + title: "Flutter DEMO APP", + theme: ThemeData( + primarySwatch: Colors.orange, + visualDensity: VisualDensity.adaptivePlatformDensity, + ), + home: _Test(), + ); + } +} + +class _Test extends StatefulWidget { + @override + State createState() { + return _TestState(); + } +} + +class _TestState extends State<_Test> with SingleTickerProviderStateMixin { + @override + void initState() { + super.initState(); + } + + @override + void dispose() { + super.dispose(); + } + + var _padding = 0.0; + + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: AppBar( + title: Text('zhaojan'), + ), + body: Center( + child: Column( + mainAxisSize: MainAxisSize.min, + children: [ + RaisedButton( + onPressed: () { + setState(() { + _animated = !_animated; + }); + }, + child: Text('dong hua'), + ), + _buildAnimatedPhysicalModel(), + ], + ), + ), + floatingActionButton: RaisedButton( + onPressed: () { + setState(() { + if (_padding == 0.0) { + _padding = 50.0; + } else { + _padding = 0.0; + } + }); + }, + ), + ); + } + + bool _animated = false; + + _buildAnimatedPhysicalModel() { + return AnimatedPhysicalModel( + child: Container( + height: 100, + width: 100, + ), + borderRadius: BorderRadius.circular(_animated ? 20 : 10), + shape: BoxShape.rectangle, + elevation: _animated ? 18 : 8, + color: _animated ? Colors.blue : Colors.red, + shadowColor: !_animated ? Colors.blue : Colors.red, + duration: Duration(seconds: 1), + ); + } +} diff --git a/flutter_helper/lib/widgets/a017_animate_positioned.dart b/flutter_helper/lib/widgets/a017_animate_positioned.dart new file mode 100644 index 00000000..81b67a0c --- /dev/null +++ b/flutter_helper/lib/widgets/a017_animate_positioned.dart @@ -0,0 +1,90 @@ +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; + +///http://laomengit.com/flutter/widgets/AnimatedModalBarrier.html#animatedmodalbarrier +class AnimatedPositionedApp extends StatelessWidget { + @override + Widget build(BuildContext context) { + return MaterialApp( + title: "Flutter DEMO APP", + theme: ThemeData( + primarySwatch: Colors.orange, + visualDensity: VisualDensity.adaptivePlatformDensity, + ), + home: _Test(), + ); + } +} + +class _Test extends StatefulWidget { + @override + State createState() { + return _TestState(); + } +} + +class _TestState extends State<_Test> with SingleTickerProviderStateMixin { + @override + void initState() { + super.initState(); + } + + @override + void dispose() { + super.dispose(); + } + + var _top = 30.0; + + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: AppBar( + title: Text('zhaojan'), + ), + body: Center( + child: Stack( + alignment: Alignment.center, + children: [ + AnimatedPositioned( + top: _top, + child: Container( + height: 50, + width: 50, + color: Colors.red, + ), + duration: Duration(seconds: 2)), + ], + ), + ), + floatingActionButton: RaisedButton( + onPressed: () { + setState(() { + if (_top == 400.0) { + _top = 0.0; + } else { + _top = 400.0; + } + }); + }, + ), + ); + } + + bool _animated = false; + + _buildAnimatedPhysicalModel() { + return AnimatedPhysicalModel( + child: Container( + height: 100, + width: 100, + ), + borderRadius: BorderRadius.circular(_animated ? 20 : 10), + shape: BoxShape.rectangle, + elevation: _animated ? 18 : 8, + color: _animated ? Colors.blue : Colors.red, + shadowColor: !_animated ? Colors.blue : Colors.red, + duration: Duration(milliseconds: 100), + ); + } +} diff --git a/flutter_helper/lib/widgets/a018_animate_positioned_directional.dart b/flutter_helper/lib/widgets/a018_animate_positioned_directional.dart new file mode 100644 index 00000000..fe8beea2 --- /dev/null +++ b/flutter_helper/lib/widgets/a018_animate_positioned_directional.dart @@ -0,0 +1,73 @@ +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; + +///http://laomengit.com/flutter/widgets/AnimatedModalBarrier.html#animatedmodalbarrier +class AnimatedPositionedDirectionalApp extends StatelessWidget { + @override + Widget build(BuildContext context) { + return MaterialApp( + title: "Flutter DEMO APP", + theme: ThemeData( + primarySwatch: Colors.orange, + visualDensity: VisualDensity.adaptivePlatformDensity, + ), + home: _Test(), + ); + } +} + +class _Test extends StatefulWidget { + @override + State createState() { + return _TestState(); + } +} + +class _TestState extends State<_Test> with SingleTickerProviderStateMixin { + @override + void initState() { + super.initState(); + } + + @override + void dispose() { + super.dispose(); + } + + var _start = 0.0; + + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: AppBar( + title: Text('zhaojan'), + ), + body: Center( + child: Stack( + alignment: Alignment.center, + children: [ + AnimatedPositionedDirectional( + start: _start, + child: Container( + height: 50, + width: 50, + color: Colors.red, + ), + duration: Duration(seconds: 2)), + ], + ), + ), + floatingActionButton: RaisedButton( + onPressed: () { + setState(() { + if (_start == 180.0) { + _start = 0.0; + } else { + _start = 180.0; + } + }); + }, + ), + ); + } +} diff --git a/flutter_helper/lib/widgets/a019_animate_size.dart b/flutter_helper/lib/widgets/a019_animate_size.dart new file mode 100644 index 00000000..318b379e --- /dev/null +++ b/flutter_helper/lib/widgets/a019_animate_size.dart @@ -0,0 +1,83 @@ +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; + +///http://laomengit.com/flutter/widgets/AnimatedModalBarrier.html#animatedmodalbarrier +class AnimatedSizeApp extends StatelessWidget { + @override + Widget build(BuildContext context) { + return MaterialApp( + title: "Flutter DEMO APP", + theme: ThemeData( + primarySwatch: Colors.orange, + visualDensity: VisualDensity.adaptivePlatformDensity, + ), + home: _Test(), + ); + } +} + +class _Test extends StatefulWidget { + @override + State createState() { + return _TestState(); + } +} + +class _TestState extends State<_Test> with SingleTickerProviderStateMixin { + @override + void initState() { + super.initState(); + } + + @override + void dispose() { + super.dispose(); + } + + var _height = 100.0; + var _width = 100.0; + var _color = Colors.red; + + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: AppBar( + title: Text('zhaojan'), + ), + body: Center( + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + RaisedButton(onPressed: () { + setState(() { + if(_height == 100.0) { + _height = 200.0; + _width = 200.0; + _color = Colors.blue; + } else { + _height = 100.0; + _width = 100.0; + _color = Colors.green; + } + }); + }), + AnimatedSize( + duration: Duration(seconds: 1), + vsync: this, + child: Container( + height: _height, + width: _width, + color: _color, + ), + ) + ], + ), + ), + floatingActionButton: RaisedButton( + onPressed: () { + setState(() {}); + }, + ), + ); + } +} diff --git a/flutter_helper/lib/widgets/a020_animate_switcher.dart b/flutter_helper/lib/widgets/a020_animate_switcher.dart new file mode 100644 index 00000000..80bdd275 --- /dev/null +++ b/flutter_helper/lib/widgets/a020_animate_switcher.dart @@ -0,0 +1,83 @@ +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; + +///http://laomengit.com/flutter/widgets/AnimatedModalBarrier.html#animatedmodalbarrier +class AnimatedSwitcherApp extends StatelessWidget { + @override + Widget build(BuildContext context) { + return MaterialApp( + title: "Flutter DEMO APP", + theme: ThemeData( + primarySwatch: Colors.orange, + visualDensity: VisualDensity.adaptivePlatformDensity, + ), + home: _Test(), + ); + } +} + +class _Test extends StatefulWidget { + @override + State createState() { + return _TestState(); + } +} + +class _TestState extends State<_Test> with SingleTickerProviderStateMixin { + var _firstChild = Container( + key: ValueKey("1"), + height: 300, + width: 300, + color: Colors.red, + ); + + var _secondChild = Container( + key: ValueKey("2"), + height: 100, + width: 100, + color: Colors.green, + ); + + var _displayChild; + + @override + void initState() { + _displayChild = _firstChild; + super.initState(); + } + + @override + void dispose() { + super.dispose(); + } + + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: AppBar( + title: Text('zhaojan'), + ), + body: Center( + child: AnimatedSwitcher( + duration: Duration(seconds: 1), + child: _displayChild, + switchInCurve: Curves.bounceInOut, + transitionBuilder: (Widget child, Animation value) { + return ScaleTransition(scale: value, child: child,); + }, + ), + ), + floatingActionButton: RaisedButton( + onPressed: () { + setState(() { + if (_displayChild == _firstChild) { + _displayChild = _secondChild; + } else { + _displayChild = _firstChild; + } + }); + }, + ), + ); + } +} diff --git a/flutter_helper/lib/widgets/a021_appbar.dart b/flutter_helper/lib/widgets/a021_appbar.dart new file mode 100644 index 00000000..8a4fb91b --- /dev/null +++ b/flutter_helper/lib/widgets/a021_appbar.dart @@ -0,0 +1,148 @@ +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; + +///http://laomengit.com/flutter/widgets/AnimatedModalBarrier.html#animatedmodalbarrier +class AppbarApp extends StatelessWidget { + @override + Widget build(BuildContext context) { + return MaterialApp( + title: "Flutter DEMO APP", + theme: ThemeData( + primarySwatch: Colors.orange, + visualDensity: VisualDensity.adaptivePlatformDensity, + ), + home: _Test(), + ); + } +} + +class _Test extends StatefulWidget { + @override + State createState() { + return _TestState(); + } +} + +class _TestState extends State<_Test> with SingleTickerProviderStateMixin { + var _firstChild = Container( + key: ValueKey("1"), + height: 300, + width: 300, + color: Colors.red, + ); + + var _secondChild = Container( + key: ValueKey("2"), + height: 100, + width: 100, + color: Colors.green, + ); + + var _displayChild; + + @override + void initState() { + _displayChild = _firstChild; + super.initState(); + } + + @override + void dispose() { + super.dispose(); + } + + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: AppBar( + title: Text('zhaojan'), + ), + drawer: Drawer( + child: Column( + children: [ + SizedBox( + height: 100, + ), + Text(".....", textAlign: TextAlign.left,), + Text(".....", textAlign: TextAlign.left,), + Text(".....", textAlign: TextAlign.left,), + Text(".....", textAlign: TextAlign.left,), + Text(".....", textAlign: TextAlign.left,), + ], + ), + ), + body: Center( + child: Column( + children: [ + AppBar( + leading: BackButton(), + title: Text('老孟'), + ), + RaisedButton(onPressed: () { + Navigator.push(context, MaterialPageRoute(builder: (context) { + return Scaffold( + appBar: AppBar( + automaticallyImplyLeading: false, + centerTitle: true, + title: Text('zhaojian'), + ), + ); + })); + }), + AppBar( + title: Text('laomeng'), + actions: [ + IconButton( + icon: Icon(Icons.menu), + onPressed: () { + Navigator.push(context, + MaterialPageRoute(builder: (context) { + return Scaffold( + appBar: AppBar( + title: Text('zj'), + bottom: TabBar( + tabs: [ + Text('语文'), + Text('数学'), + Text('英语'), + Text('体育'), + Text('音乐'), + ], + controller: TabController(length: 5, vsync: this), + ), + ), + ); + })); + }), + IconButton(icon: Icon(Icons.add), onPressed: () {}), + ], + ), + AppBar( + elevation: 10, + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(20)), + backgroundColor: Colors.red, + ), + AppBar( + iconTheme: IconThemeData(size: 74), + actionsIconTheme: IconThemeData(size: 24), + textTheme: TextTheme(title: TextStyle(color: Colors.red)), + title: Text('zzzjjj'), + ), + ], + ), + ), + floatingActionButton: RaisedButton( + onPressed: () { + setState(() { + if (_displayChild == _firstChild) { + _displayChild = _secondChild; + } else { + _displayChild = _firstChild; + } + }); + }, + ), + ); + } +} diff --git a/flutter_helper/lib/widgets/a022_aspectratio.dart b/flutter_helper/lib/widgets/a022_aspectratio.dart new file mode 100644 index 00000000..37f1bf4a --- /dev/null +++ b/flutter_helper/lib/widgets/a022_aspectratio.dart @@ -0,0 +1,173 @@ +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; + + +/// 1. ConstrainedBox、 +/// ConstrainedBox组件约束子组件的最大宽高和最小宽高,假如一个组件宽高都是300,包裹在ConstrainedBox中,并给ConstrainedBox添加最大宽高约束 +/// 2. UnconstrainedBox、 +/// UnconstrainedBox组件不对子组件做任何约束,比如有一个父组件大小是200x200,子组件是UnconstrainedBox,UnconstrainedBox包裹一个300x300的组件 +/// 3. SizedBox、 +/// SizedBox是具有固定宽高的组件,直接指定具体的宽高, +/// 4. AspectRatio、 +/// AspectRatio组件是固定宽高比的组件,如果组件的宽度固定,希望高是宽的1/2,可以用AspectRatio实现此效果, +/// 5. FractionallySizedBox、 +/// 当我们需要一个控件的尺寸是相对尺寸时,比如当前按钮的宽度占父组件的70%,可以使用FractionallySizedBox来实现此效果。 +/// 使用FractionallySizedBox包裹子控件,设置widthFactor宽度系数或者heightFactor高度系数,系数值的范围是0-1,0.7表示占父组件的70%, +/// 6. LimitedBox +/// LimitedBox组件是当不受父组件约束时限制它的尺寸,什么叫不受父组件约束? +/// 就像这篇文章介绍的其他组件,它们都会对子组件约束,没有约束的父组件有ListView、Row、Column等,如果LimitedBox的父组件受到约束,此时LimitedBox将会不做任何操作,我们可以认为没有这个组件,代码如下: +/// 7. Container +/// 总结 +/// 这么多约束类的容器组件,到底要使用哪一个组件呢?总结如下: +/// +/// ConstrainedBox:适用于需要设置最大/小宽高,组件大小以来子组件大小,但不能超过设置的界限。 +/// UnconstrainedBox:用到情况不多,当作ConstrainedBox的子组件可以“突破”ConstrainedBox的限制,超出界限的部分会被截取。 +/// SizedBox:适用于固定宽高的情况,常用于当作2个组件之间间隙组件。 +/// AspectRatio:适用于固定宽高比的情况。 +/// FractionallySizedBox:适用于占父组件百分比的情况。 +/// LimitedBox:适用于没有父组件约束的情况。 +/// Container:适用于不仅有尺寸的约束,还有装饰(颜色、边框、等)、内外边距等需求的情况。 +class AppbarApp extends StatelessWidget { + @override + Widget build(BuildContext context) { + return MaterialApp( + title: "Flutter DEMO APP", + theme: ThemeData( + primarySwatch: Colors.orange, + visualDensity: VisualDensity.adaptivePlatformDensity, + ), + home: _Test(), + ); + } +} + +class _Test extends StatefulWidget { + @override + State createState() { + return _TestState(); + } +} + +class _TestState extends State<_Test> with SingleTickerProviderStateMixin { + var _firstChild = Container( + key: ValueKey("1"), + height: 300, + width: 300, + color: Colors.red, + ); + + var _secondChild = Container( + key: ValueKey("2"), + height: 100, + width: 100, + color: Colors.green, + ); + + var _displayChild; + + @override + void initState() { + _displayChild = _firstChild; + super.initState(); + } + + @override + void dispose() { + super.dispose(); + } + + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: AppBar( + title: Text('zhaojan'), + ), + drawer: Drawer( + child: Column( + children: [ + SizedBox( + height: 100, + ), + Text(".....", textAlign: TextAlign.left,), + Text(".....", textAlign: TextAlign.left,), + Text(".....", textAlign: TextAlign.left,), + Text(".....", textAlign: TextAlign.left,), + Text(".....", textAlign: TextAlign.left,), + ], + ), + ), + body: Center( + child: Column( + children: [ + AppBar( + leading: BackButton(), + title: Text('老孟'), + ), + RaisedButton(onPressed: () { + Navigator.push(context, MaterialPageRoute(builder: (context) { + return Scaffold( + appBar: AppBar( + automaticallyImplyLeading: false, + centerTitle: true, + title: Text('zhaojian'), + ), + ); + })); + }), + AppBar( + title: Text('laomeng'), + actions: [ + IconButton( + icon: Icon(Icons.menu), + onPressed: () { + Navigator.push(context, + MaterialPageRoute(builder: (context) { + return Scaffold( + appBar: AppBar( + title: Text('zj'), + bottom: TabBar( + tabs: [ + Text('语文'), + Text('数学'), + Text('英语'), + Text('体育'), + Text('音乐'), + ], + controller: TabController(length: 5, vsync: this), + ), + ), + ); + })); + }), + IconButton(icon: Icon(Icons.add), onPressed: () {}), + ], + ), + AppBar( + elevation: 10, + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(20)), + backgroundColor: Colors.red, + ), + AppBar( + iconTheme: IconThemeData(size: 74), + actionsIconTheme: IconThemeData(size: 24), + textTheme: TextTheme(title: TextStyle(color: Colors.red)), + title: Text('zzzjjj'), + ), + ], + ), + ), + floatingActionButton: RaisedButton( + onPressed: () { + setState(() { + if (_displayChild == _firstChild) { + _displayChild = _secondChild; + } else { + _displayChild = _firstChild; + } + }); + }, + ), + ); + } +} diff --git a/flutter_helper/lib/widgets/a023_buttons.dart b/flutter_helper/lib/widgets/a023_buttons.dart new file mode 100644 index 00000000..5f512412 --- /dev/null +++ b/flutter_helper/lib/widgets/a023_buttons.dart @@ -0,0 +1,209 @@ +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; + +class ButtonsApp extends StatelessWidget { + @override + Widget build(BuildContext context) { + return MaterialApp( + title: "Flutter DEMO APP", + theme: ThemeData( + primarySwatch: Colors.orange, + visualDensity: VisualDensity.adaptivePlatformDensity, + ), + home: _Test(), + ); + } +} + +class _Test extends StatefulWidget { + @override + State createState() { + return _TestState(); + } +} + +class _TestState extends State<_Test> with SingleTickerProviderStateMixin { + @override + void initState() { + super.initState(); + } + + @override + void dispose() { + super.dispose(); + } + + var _dropValue = null; + var _popValue = Text('学科'); + + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: AppBar( + title: Text('zhaojan'), + ), + drawer: Drawer( + child: Scrollbar( + child: SingleChildScrollView( + child: Column( + children: [ + RaisedButton( + textTheme: ButtonTextTheme.primary, + textColor: Colors.black, + disabledTextColor: Colors.grey, + color: Colors.green, + highlightColor: Colors.red, + splashColor: Colors.blue, + onHighlightChanged: (high) { + print('$high'); + }, + onPressed: () {}, + child: Text('Button'), + ), + RaisedButton( + shape: CircleBorder(), + textTheme: ButtonTextTheme.primary, + textColor: Colors.black, + disabledTextColor: Colors.grey, + color: Colors.green, + highlightColor: Colors.red, + splashColor: Colors.blue, + onHighlightChanged: (high) { + print('$high'); + }, + onPressed: () {}, + child: Text('Button'), + ), + FlatButton( + onPressed: () {}, + child: Text('Button'), + color: Colors.blue, + ), + OutlineButton( + borderSide: BorderSide(color: Colors.blue, width: 2), + disabledBorderColor: Colors.red, + onPressed: () {}, + child: Text('Button'), + ), + DropdownButton( + icon: Icon(Icons.add), + iconSize: 24, + iconDisabledColor: Colors.red, + iconEnabledColor: Colors.red, + selectedItemBuilder: (context) { + return [ + Text( + '111', + style: TextStyle(color: Colors.red), + ), + Text( + '222', + style: TextStyle(color: Colors.red), + ), + Text( + '333', + style: TextStyle(color: Colors.red), + ), + ]; + }, + value: _dropValue, + hint: Text('请选择科目'), + items: [ + DropdownMenuItem( + child: Text('111'), + value: '111', + ), + DropdownMenuItem( + child: Text('222'), + value: '222', + ), + DropdownMenuItem( + child: Text('333'), + value: '333', + ), + ], + onChanged: (value) { + setState(() { + _dropValue = value; + print("dropValue=$value"); + }); + }, + ), + RawMaterialButton( + onPressed: () {}, + fillColor: Colors.blue, + child: Text('Button'), + ), + PopupMenuButton( + shape: RoundedRectangleBorder( + side: BorderSide(color: Colors.blue, width: 5), + borderRadius: BorderRadius.circular(10), + ), + icon: Icon(Icons.add), + //child: _popValue, + elevation: 5, + padding: EdgeInsets.all(5), + color: Colors.red, + tooltip: 'PopupMenuButton', + onSelected: (value) { + print("$value"); + setState(() { + _popValue = Text(value); + }); + }, + onCanceled: () { + print("onCancel!"); + }, + initialValue: "数学", + itemBuilder: (context) { + return >[ + PopupMenuItem(child: Text('语文'), value: '语文'), + PopupMenuItem(child: Text('语文'), value: '语文'), + PopupMenuItem(child: Text('语文'), value: '语文'), + PopupMenuItem(child: Text('语文'), value: '语文'), + PopupMenuItem(child: Text('语文'), value: '语文'), + PopupMenuItem(child: Text('语文'), value: '语文'), + PopupMenuItem(child: Text('数学'), value: '数学'), + PopupMenuItem(child: Text('语文'), value: '语文'), + PopupMenuItem(child: Text('语文'), value: '语文'), + ]; + }), + IconButton( + tooltip: '这是一个图标按钮', + icon: Icon(Icons.person), + onPressed: () {}, + iconSize: 30, + color: Colors.red, + ), + BackButton(), + CloseButton(), + ButtonBar( + alignment: MainAxisAlignment.start, + mainAxisSize: MainAxisSize.max, + children: [ + RaisedButton(), + RaisedButton(), + RaisedButton(), + RaisedButton(), + ], + ), + CupertinoButton( + child: Text('ios 风格按钮'), + onPressed: () {}, + color: Colors.blue, + pressedOpacity: .5, + borderRadius: BorderRadius.circular(40), + ), + ], + ), + )), + ), + body: SizedBox(), + floatingActionButton: RaisedButton( + onPressed: () { + setState(() {}); + }, + ), + ); + } +} diff --git a/flutter_helper/lib/widgets/a024_backdropfilter.dart b/flutter_helper/lib/widgets/a024_backdropfilter.dart new file mode 100644 index 00000000..66a4ffba --- /dev/null +++ b/flutter_helper/lib/widgets/a024_backdropfilter.dart @@ -0,0 +1,73 @@ +import 'dart:ui'; + +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; + +class BackdropFilterApp extends StatelessWidget { + @override + Widget build(BuildContext context) { + return MaterialApp( + title: "Flutter DEMO APP", + theme: ThemeData( + primarySwatch: Colors.orange, + visualDensity: VisualDensity.adaptivePlatformDensity, + ), + home: _Test(), + ); + } +} + +class _Test extends StatefulWidget { + @override + State createState() { + return _TestState(); + } +} + +class _TestState extends State<_Test> with SingleTickerProviderStateMixin { + @override + void initState() { + super.initState(); + } + + @override + void dispose() { + super.dispose(); + } + + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: AppBar( + title: Text('zhaojan'), + ), + body: Stack( + alignment: Alignment.center, + children: [ + Container( + width: 300, + height: 400, + child: Image.asset('images/beatiful_lady.jpeg'), + ), + BackdropFilter( + filter: ImageFilter.blur(sigmaX: 5.0, sigmaY: 5.0), + child: Center( + child: Container( + color: Colors.red.withOpacity(0), + child: Text( + '一个有态度的程序员', + style: TextStyle(color: Colors.blue), + ), + ), + ), + ), + ], + ), + floatingActionButton: RaisedButton( + onPressed: () { + setState(() {}); + }, + ), + ); + } +} diff --git a/flutter_helper/lib/widgets/a025_banner.dart b/flutter_helper/lib/widgets/a025_banner.dart new file mode 100644 index 00000000..d84c7c55 --- /dev/null +++ b/flutter_helper/lib/widgets/a025_banner.dart @@ -0,0 +1,57 @@ +import 'dart:ui'; + +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; + +class BannerApp extends StatelessWidget { + @override + Widget build(BuildContext context) { + return MaterialApp( + title: "Flutter DEMO APP", + theme: ThemeData( + primarySwatch: Colors.orange, + visualDensity: VisualDensity.adaptivePlatformDensity, + ), + home: _Test(), + ); + } +} + +class _Test extends StatefulWidget { + @override + State createState() { + return _TestState(); + } +} + +class _TestState extends State<_Test> with SingleTickerProviderStateMixin { + @override + void initState() { + super.initState(); + } + + @override + void dispose() { + super.dispose(); + } + + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: AppBar( + title: Text('zhaojan'), + ), + body: Banner( + message: 'zhaojian', + location: BannerLocation.topStart, + color: Colors.blue, + textStyle: TextStyle(color: Colors.red), + ), + floatingActionButton: RaisedButton( + onPressed: () { + setState(() {}); + }, + ), + ); + } +} diff --git a/flutter_helper/lib/widgets/a026_baseline.dart b/flutter_helper/lib/widgets/a026_baseline.dart new file mode 100644 index 00000000..62c2574f --- /dev/null +++ b/flutter_helper/lib/widgets/a026_baseline.dart @@ -0,0 +1,85 @@ +import 'dart:ui'; + +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; + +class BaselineApp extends StatelessWidget { + @override + Widget build(BuildContext context) { + return MaterialApp( + title: "Flutter DEMO APP", + theme: ThemeData( + primarySwatch: Colors.orange, + visualDensity: VisualDensity.adaptivePlatformDensity, + ), + home: _Test(), + ); + } +} + +class _Test extends StatefulWidget { + @override + State createState() { + return _TestState(); + } +} + +class _TestState extends State<_Test> with SingleTickerProviderStateMixin { + @override + void initState() { + super.initState(); + } + + @override + void dispose() { + super.dispose(); + } + + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: AppBar( + title: Text('zhaojan'), + ), + body: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Baseline( + baseline: 50.0, + baselineType: TextBaseline.alphabetic, + child: Text( + 'TjTjTj', + style: TextStyle( + fontSize: 20.0, + textBaseline: TextBaseline.alphabetic, + ), + ), + ), + Baseline( + baseline: 50.0, + baselineType: TextBaseline.alphabetic, + child: Container( + width: 30.0, + height: 30.0, + color: Colors.red, + ), + ), + Baseline( + baseline: 50.0, + baselineType: TextBaseline.alphabetic, + child: Text( + 'RyRyRy', + style: TextStyle( + fontSize: 35.0, textBaseline: TextBaseline.alphabetic), + ), + ) + ], + ), + floatingActionButton: RaisedButton( + onPressed: () { + setState(() {}); + }, + ), + ); + } +} diff --git a/flutter_helper/lib/widgets/a027_border.dart b/flutter_helper/lib/widgets/a027_border.dart new file mode 100644 index 00000000..224c6d3c --- /dev/null +++ b/flutter_helper/lib/widgets/a027_border.dart @@ -0,0 +1,148 @@ +import 'dart:ui'; + +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; + +class BorderApp extends StatelessWidget { + @override + Widget build(BuildContext context) { + return MaterialApp( + title: "Flutter DEMO APP", + theme: ThemeData( + primarySwatch: Colors.orange, + visualDensity: VisualDensity.adaptivePlatformDensity, + ), + home: _Test(), + ); + } +} + +class _Test extends StatefulWidget { + @override + State createState() { + return _TestState(); + } +} + +class _TestState extends State<_Test> with SingleTickerProviderStateMixin { + @override + void initState() { + super.initState(); + } + + @override + void dispose() { + super.dispose(); + } + + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: AppBar( + title: Text('zhaojan'), + ), + body: Column( + mainAxisAlignment: MainAxisAlignment.start, + children: [ + RaisedButton( + shape: BeveledRectangleBorder( + side: BorderSide(width: 1, color: Colors.red), + borderRadius: BorderRadius.circular(10), + ), + onPressed: () {}, + child: Text('zhojian'), + ), + RaisedButton( + shape: BeveledRectangleBorder( + side: BorderSide(width: 1, color: Colors.red), + borderRadius: BorderRadius.circular(100), + ), + onPressed: () {}, + child: Text('zhojian'), + ), + RaisedButton( + shape: BeveledRectangleBorder( + side: BorderSide(width: 1, color: Colors.red), + borderRadius: BorderRadius.circular(0), + ), + onPressed: () {}, + child: Text('zhojian'), + ), + RaisedButton( + shape: Border( + top: BorderSide(color: Colors.red, width: 2), + ), + onPressed: () {}, + child: Text('zhojian'), + ), + RaisedButton( + shape: Border( + top: BorderSide(color: Colors.red, width: 10), + right: BorderSide(color: Colors.green, width: 10), + bottom: BorderSide(color: Colors.blue, width: 10), + left: BorderSide(color: Colors.grey, width: 10), + ), + onPressed: () {}, + child: Text('zhojian'), + ), + RaisedButton( + shape: BorderDirectional( + start: BorderSide(color: Colors.red, width: 2), + end: BorderSide(color: Colors.blue, width: 2), + ), + child: Text('ZHAOJIAN'), + onPressed: () {}, + ), + RaisedButton( + shape: CircleBorder(side: BorderSide(color: Colors.red)), + child: Text('ZHA'), + onPressed: () {}, + ), + RaisedButton( + shape: ContinuousRectangleBorder( + side: BorderSide(color: Colors.red), + borderRadius: BorderRadius.circular(20), + ), + child: Text('ZHA'), + onPressed: () {}, + ), + RaisedButton( + shape: RoundedRectangleBorder( + side: BorderSide(color: Colors.red), + borderRadius: BorderRadius.circular(10), + ), + child: Text('ZHA'), + onPressed: () {}, + ), + RaisedButton( + shape: StadiumBorder( + side: BorderSide(color: Colors.red), + ), + child: Text('ZHA'), + onPressed: () {}, + ), + RaisedButton( + shape: OutlineInputBorder( + borderSide: BorderSide(color: Colors.greenAccent), + borderRadius: BorderRadius.circular(20), + ), + child: Text('ZHA'), + onPressed: () {}, + ), + RaisedButton( + shape: UnderlineInputBorder( + borderSide: BorderSide(color: Colors.red), + ), + child: Text('ZHAOJIAN'), + onPressed: () {}, + ), + ], + ), + floatingActionButton: RaisedButton( + onPressed: () { + setState(() {}); + }, + ), + ); + } +} diff --git a/flutter_helper/lib/widgets/a028_bottomappbar.dart b/flutter_helper/lib/widgets/a028_bottomappbar.dart new file mode 100644 index 00000000..7ca02161 --- /dev/null +++ b/flutter_helper/lib/widgets/a028_bottomappbar.dart @@ -0,0 +1,78 @@ +import 'dart:ui'; + +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; + +class BottomAppBarApp extends StatelessWidget { + @override + Widget build(BuildContext context) { + return MaterialApp( + title: "Flutter DEMO APP", + theme: ThemeData( + primarySwatch: Colors.orange, + visualDensity: VisualDensity.adaptivePlatformDensity, + ), + home: _Test(), + ); + } +} + +class _Test extends StatefulWidget { + @override + State createState() { + return _TestState(); + } +} + +class _TestState extends State<_Test> with SingleTickerProviderStateMixin { + @override + void initState() { + super.initState(); + } + + @override + void dispose() { + super.dispose(); + } + + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: AppBar( + title: Text('zhaojan'), + ), + body: Container(), + // floatingActionButton: RaisedButton( + // shape: CircleBorder(), + // color: Colors.red, + // onPressed: () { + // setState(() {}); + // }, + // ), + floatingActionButton: FloatingActionButton.extended( + shape: BeveledRectangleBorder(borderRadius: BorderRadius.circular(100)), + onPressed: () {}, + label: Text('label'), + icon: Icon(Icons.add), + ), + floatingActionButtonLocation: FloatingActionButtonLocation.centerDocked, + bottomNavigationBar: BottomAppBar( + // notchMargin: -10, + elevation: 8.0, + // shape: CircularNotchedRectangle(), + shape: AutomaticNotchedShape( + RoundedRectangleBorder(), + // StadiumBorder(side: BorderSide()), + BeveledRectangleBorder(borderRadius: BorderRadius.circular(100)), + ), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceAround, + children: [ + IconButton(icon: Icon(Icons.home), onPressed: () {}), + IconButton(icon: Icon(Icons.people), onPressed: () {}), + ], + ), + ), + ); + } +} diff --git a/flutter_helper/lib/widgets/a029_bottomnavigationbar.dart b/flutter_helper/lib/widgets/a029_bottomnavigationbar.dart new file mode 100644 index 00000000..f5b7fa02 --- /dev/null +++ b/flutter_helper/lib/widgets/a029_bottomnavigationbar.dart @@ -0,0 +1,115 @@ +import 'dart:ui'; + +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; + +class BottomNavigationBarApp extends StatelessWidget { + @override + Widget build(BuildContext context) { + return MaterialApp( + title: "Flutter DEMO APP", + theme: ThemeData( + primarySwatch: Colors.orange, + visualDensity: VisualDensity.adaptivePlatformDensity, + ), + home: _Test(), + ); + } +} + +class HomePage extends StatelessWidget { + @override + Widget build(BuildContext context) { + return Container( + color: Colors.red, + ); + } +} + +class BookPage extends StatelessWidget { + @override + Widget build(BuildContext context) { + return Container( + color: Colors.green, + ); + } +} + +class MyPage extends StatelessWidget { + @override + Widget build(BuildContext context) { + return Container( + color: Colors.blue, + ); + } +} + +Widget _curBody = HomePage(); + +class _Test extends StatefulWidget { + @override + State createState() { + return _TestState(); + } +} + +class _TestState extends State<_Test> with SingleTickerProviderStateMixin { + @override + void initState() { + super.initState(); + } + + @override + void dispose() { + super.dispose(); + } + + var _currentIndex = 0; + + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: AppBar( + title: Text('zhaojan'), + ), + body: _curBody, + bottomNavigationBar: BottomNavigationBar( + // type: BottomNavigationBarType.fixed, + type: BottomNavigationBarType.shifting, + selectedItemColor: Theme.of(context).primaryColor, + unselectedItemColor: Colors.black, + currentIndex: _currentIndex, + onTap: (index) { + switch (index) { + case 0: + _curBody = HomePage(); + break; + case 1: + _curBody = BookPage(); + break; + case 2: + _curBody = MyPage(); + break; + } + setState(() { + _currentIndex = index; + }); + }, + items: [ + BottomNavigationBarItem( + icon: Icon(Icons.home), + title: Text('首页'), + ), + BottomNavigationBarItem( + icon: Icon(Icons.book), + title: Text('书籍'), + ), + BottomNavigationBarItem( + icon: Icon(Icons.perm_identity), + title: Text('我的'), + ), + ], + ), + ); + } +} diff --git a/flutter_helper/lib/widgets/a030_scrollpysics.dart b/flutter_helper/lib/widgets/a030_scrollpysics.dart new file mode 100644 index 00000000..26dc45af --- /dev/null +++ b/flutter_helper/lib/widgets/a030_scrollpysics.dart @@ -0,0 +1,77 @@ +import 'dart:ui'; + +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; + +class BottomNavigationBarApp extends StatelessWidget { + @override + Widget build(BuildContext context) { + return MaterialApp( + title: "Flutter DEMO APP", + theme: ThemeData( + primarySwatch: Colors.orange, + visualDensity: VisualDensity.adaptivePlatformDensity, + ), + home: _Test(), + ); + } +} + +class _Test extends StatefulWidget { + @override + State createState() { + return _TestState(); + } +} + +class _TestState extends State<_Test> with SingleTickerProviderStateMixin { + @override + void initState() { + super.initState(); + } + + @override + void dispose() { + super.dispose(); + } + + var _currentIndex = 0; + + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: AppBar( + title: Text('zhaojan'), + ), + body: CustomScrollView( + physics: NeverScrollableScrollPhysics(), + ), + bottomNavigationBar: BottomNavigationBar( + // type: BottomNavigationBarType.fixed, + type: BottomNavigationBarType.shifting, + selectedItemColor: Theme.of(context).primaryColor, + unselectedItemColor: Colors.black, + currentIndex: _currentIndex, + onTap: (index) { + setState(() { + _currentIndex = index; + }); + }, + items: [ + BottomNavigationBarItem( + icon: Icon(Icons.home), + title: Text('首页'), + ), + BottomNavigationBarItem( + icon: Icon(Icons.book), + title: Text('书籍'), + ), + BottomNavigationBarItem( + icon: Icon(Icons.perm_identity), + title: Text('我的'), + ), + ], + ), + ); + } +} diff --git a/flutter_helper/lib/widgets/a031_builder.dart b/flutter_helper/lib/widgets/a031_builder.dart new file mode 100644 index 00000000..1a95fe60 --- /dev/null +++ b/flutter_helper/lib/widgets/a031_builder.dart @@ -0,0 +1,116 @@ +import 'dart:ui'; + +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; + +///http://laomengit.com/flutter/widgets/Builder.html#%E4%BD%BF%E7%94%A8%E5%9C%BA%E6%99%AF%E4%BA%8C +class BuildApp extends StatelessWidget { + @override + Widget build(BuildContext context) { + return MaterialApp( + title: "Flutter DEMO APP", + theme: ThemeData( + primarySwatch: Colors.orange, + visualDensity: VisualDensity.adaptivePlatformDensity, + ), + home: _HomePage(), + ); + } +} + +class _HomePage extends StatelessWidget { + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: AppBar( + title: Text('老慢'), + ), + // body: Center( + // child: RaisedButton( + // color: Colors.pink, + // textColor: Colors.white, + // onPressed: _displaySnackBar(context), + // child: Text('show snakbar!'), + // ), + // ), + body: Builder( + builder: (context) => Center( + child: RaisedButton( + onPressed: () { + _displaySnackBar(context); + }, + color: Colors.pink, + textColor: Colors.white, + child: Text('Hello'), + ), + ), + ), + ); + } + + _displaySnackBar(BuildContext context) { + // final snackbar = SnackBar(content: Text("hello")); + // Scaffold.of(context).showSnackBar(snackbar); + + + } +} + +class _Test extends StatefulWidget { + @override + State createState() { + return _TestState(); + } +} + +class _TestState extends State<_Test> with SingleTickerProviderStateMixin { + @override + void initState() { + super.initState(); + } + + @override + void dispose() { + super.dispose(); + } + + var _currentIndex = 0; + + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: AppBar( + title: Text('zhaojan'), + ), + body: CustomScrollView( + physics: NeverScrollableScrollPhysics(), + ), + bottomNavigationBar: BottomNavigationBar( + // type: BottomNavigationBarType.fixed, + type: BottomNavigationBarType.shifting, + selectedItemColor: Theme.of(context).primaryColor, + unselectedItemColor: Colors.black, + currentIndex: _currentIndex, + onTap: (index) { + setState(() { + _currentIndex = index; + }); + }, + items: [ + BottomNavigationBarItem( + icon: Icon(Icons.home), + title: Text('首页'), + ), + BottomNavigationBarItem( + icon: Icon(Icons.book), + title: Text('书籍'), + ), + BottomNavigationBarItem( + icon: Icon(Icons.perm_identity), + title: Text('我的'), + ), + ], + ), + ); + } +} diff --git a/flutter_helper/lib/widgets/a032_card.dart b/flutter_helper/lib/widgets/a032_card.dart new file mode 100644 index 00000000..a2dad282 --- /dev/null +++ b/flutter_helper/lib/widgets/a032_card.dart @@ -0,0 +1,170 @@ +import 'dart:ui'; + +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; + +///http://laomengit.com/flutter/widgets/Builder.html#%E4%BD%BF%E7%94%A8%E5%9C%BA%E6%99%AF%E4%BA%8C +class CardApp extends StatelessWidget { + @override + Widget build(BuildContext context) { + return MaterialApp( + title: "Flutter DEMO APP", + theme: ThemeData( + primarySwatch: Colors.orange, + visualDensity: VisualDensity.adaptivePlatformDensity, + ), + home: _HomePage(), + ); + } +} + +class _HomePage extends StatelessWidget { + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: AppBar( + title: Text('老慢'), + ), + body: Column( + children: [ + Card( + child: Column( + mainAxisSize: MainAxisSize.min, + children: [ + ListTile( + leading: Icon(Icons.album), + title: Text('laomeng'), + subtitle: Text('一枚有态度的程序员'), + ), + ButtonBar( + children: [ + FlatButton( + child: Text('OK'), + onPressed: () {}, + ), + FlatButton( + child: Text('Right'), + onPressed: () {}, + ) + ], + ), + ], + ), + ), + Card( + color: Colors.blue, + child: Column( + mainAxisSize: MainAxisSize.min, + children: [ + ListTile( + leading: Icon(Icons.album), + title: Text('laomeng'), + subtitle: Text('一枚有态度的程序员'), + ), + ButtonBar( + children: [ + FlatButton( + child: Text('OK'), + onPressed: () {}, + ), + FlatButton( + child: Text('Right'), + onPressed: () {}, + ) + ], + ), + ], + ), + ), + Card( + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(15), + ), + color: Colors.blue, + child: Column( + mainAxisSize: MainAxisSize.min, + children: [ + ListTile( + leading: Icon(Icons.album), + title: Text('laomeng'), + subtitle: Text('一枚有态度的程序员'), + ), + ButtonBar( + children: [ + FlatButton( + child: Text('OK'), + onPressed: () {}, + ), + FlatButton( + child: Text('Right'), + onPressed: () {}, + ) + ], + ), + ], + ), + ), + ], + ), + ); + } +} + +class _Test extends StatefulWidget { + @override + State createState() { + return _TestState(); + } +} + +class _TestState extends State<_Test> with SingleTickerProviderStateMixin { + @override + void initState() { + super.initState(); + } + + @override + void dispose() { + super.dispose(); + } + + var _currentIndex = 0; + + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: AppBar( + title: Text('zhaojan'), + ), + body: CustomScrollView( + physics: NeverScrollableScrollPhysics(), + ), + bottomNavigationBar: BottomNavigationBar( + // type: BottomNavigationBarType.fixed, + type: BottomNavigationBarType.shifting, + selectedItemColor: Theme.of(context).primaryColor, + unselectedItemColor: Colors.black, + currentIndex: _currentIndex, + onTap: (index) { + setState(() { + _currentIndex = index; + }); + }, + items: [ + BottomNavigationBarItem( + icon: Icon(Icons.home), + title: Text('首页'), + ), + BottomNavigationBarItem( + icon: Icon(Icons.book), + title: Text('书籍'), + ), + BottomNavigationBarItem( + icon: Icon(Icons.perm_identity), + title: Text('我的'), + ), + ], + ), + ); + } +} diff --git a/flutter_helper/lib/widgets/a033_circleavator.dart b/flutter_helper/lib/widgets/a033_circleavator.dart new file mode 100644 index 00000000..f2175299 --- /dev/null +++ b/flutter_helper/lib/widgets/a033_circleavator.dart @@ -0,0 +1,112 @@ +import 'dart:ui'; + +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; + +class CircleAvatorApp extends StatelessWidget { + @override + Widget build(BuildContext context) { + return MaterialApp( + title: "Flutter DEMO APP", + theme: ThemeData( + primarySwatch: Colors.orange, + visualDensity: VisualDensity.adaptivePlatformDensity, + ), + home: _HomePage(), + ); + } +} + +class _HomePage extends StatelessWidget { + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: AppBar( + title: Text('老慢'), + ), + body: Column( + children: [ + CircleAvatar( + child: Text('梦'), + ), + CircleAvatar( + backgroundColor: Colors.blue, + child: Text('梦'), + ), + CircleAvatar( + backgroundColor: Colors.red, + child: Text('梦'), + ), + CircleAvatar( + backgroundImage: AssetImage('images/beatiful_lady.jpeg'), + child: Text('梦'), + ), + CircleAvatar( + radius: 40, + backgroundImage: AssetImage('images/beatiful_lady.jpeg'), + child: Text('梦'), + ) + ], + ), + ); + } +} + +class _Test extends StatefulWidget { + @override + State createState() { + return _TestState(); + } +} + +class _TestState extends State<_Test> with SingleTickerProviderStateMixin { + @override + void initState() { + super.initState(); + } + + @override + void dispose() { + super.dispose(); + } + + var _currentIndex = 0; + + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: AppBar( + title: Text('zhaojan'), + ), + body: CustomScrollView( + physics: NeverScrollableScrollPhysics(), + ), + bottomNavigationBar: BottomNavigationBar( + // type: BottomNavigationBarType.fixed, + type: BottomNavigationBarType.shifting, + selectedItemColor: Theme.of(context).primaryColor, + unselectedItemColor: Colors.black, + currentIndex: _currentIndex, + onTap: (index) { + setState(() { + _currentIndex = index; + }); + }, + items: [ + BottomNavigationBarItem( + icon: Icon(Icons.home), + title: Text('首页'), + ), + BottomNavigationBarItem( + icon: Icon(Icons.book), + title: Text('书籍'), + ), + BottomNavigationBarItem( + icon: Icon(Icons.perm_identity), + title: Text('我的'), + ), + ], + ), + ); + } +} diff --git a/flutter_helper/lib/widgets/a034_cpertinoactionsheet.dart b/flutter_helper/lib/widgets/a034_cpertinoactionsheet.dart new file mode 100644 index 00000000..81131633 --- /dev/null +++ b/flutter_helper/lib/widgets/a034_cpertinoactionsheet.dart @@ -0,0 +1,153 @@ +import 'dart:ui'; + +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; + +class CupertinoActionSheetApp extends StatelessWidget { + @override + Widget build(BuildContext context) { + return MaterialApp( + title: "Flutter DEMO APP", + theme: ThemeData( + primarySwatch: Colors.orange, + visualDensity: VisualDensity.adaptivePlatformDensity, + ), + home: _HomePage(), + ); + } +} + +class _HomePage extends StatelessWidget { + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: AppBar( + title: Text('老慢'), + ), + body: Column( + children: [ + CircleAvatar( + child: Text('梦'), + ), + CircleAvatar( + backgroundColor: Colors.blue, + child: Text('梦'), + ), + CircleAvatar( + backgroundColor: Colors.red, + child: Text('梦'), + ), + CircleAvatar( + backgroundImage: AssetImage('images/beatiful_lady.jpeg'), + child: Text('梦'), + ), + CircleAvatar( + radius: 40, + backgroundImage: AssetImage('images/beatiful_lady.jpeg'), + child: Text('梦'), + ) + ], + ), + floatingActionButton: RaisedButton( + child: CircleAvatar( + radius: 40, + backgroundImage: AssetImage('images/beatiful_lady.jpeg'), + child: Text('梦'), + ), + onPressed: () async { + print("print"); + var result = await showCupertinoModalPopup( + context: context, + builder: (context) { + return CupertinoActionSheet( + title: Text('tips'), + message: Text('can u sure delete it?'), + cancelButton: CupertinoActionSheetAction( + child: Text('cancel'), + onPressed: () { + print("cancel button"); + }, + ), + actions: [ + CupertinoActionSheetAction( + onPressed: () { + print("DEL button"); + Navigator.of(context).pop('delete'); + }, + child: Text('DEL'), + isDefaultAction: true, + ), + CupertinoActionSheetAction( + onPressed: () { + print("OK button"); + }, + child: Text('OK'), + isDefaultAction: true, + ), + ], + ); + }); + print("result=$result"); + }, + )); + } +} + +class _Test extends StatefulWidget { + @override + State createState() { + return _TestState(); + } +} + +class _TestState extends State<_Test> with SingleTickerProviderStateMixin { + @override + void initState() { + super.initState(); + } + + @override + void dispose() { + super.dispose(); + } + + var _currentIndex = 0; + + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: AppBar( + title: Text('zhaojan'), + ), + body: CustomScrollView( + physics: NeverScrollableScrollPhysics(), + ), + bottomNavigationBar: BottomNavigationBar( + // type: BottomNavigationBarType.fixed, + type: BottomNavigationBarType.shifting, + selectedItemColor: Theme.of(context).primaryColor, + unselectedItemColor: Colors.black, + currentIndex: _currentIndex, + onTap: (index) { + setState(() { + _currentIndex = index; + }); + }, + items: [ + BottomNavigationBarItem( + icon: Icon(Icons.home), + title: Text('首页'), + ), + BottomNavigationBarItem( + icon: Icon(Icons.book), + title: Text('书籍'), + ), + BottomNavigationBarItem( + icon: Icon(Icons.perm_identity), + title: Text('我的'), + ), + ], + ), + ); + } +} diff --git a/flutter_helper/lib/widgets/a035_indicator.dart b/flutter_helper/lib/widgets/a035_indicator.dart new file mode 100644 index 00000000..543dba2c --- /dev/null +++ b/flutter_helper/lib/widgets/a035_indicator.dart @@ -0,0 +1,215 @@ +import 'dart:ui'; + +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_helper/widgets/a029_bottomnavigationbar.dart'; + +class IndicatorApp extends StatelessWidget { + @override + Widget build(BuildContext context) { + return MaterialApp( + title: "Flutter DEMO APP", + theme: ThemeData( + primarySwatch: Colors.orange, + visualDensity: VisualDensity.adaptivePlatformDensity, + ), + home: _HomePage(), + ); + } +} + +void test() { + MaterialApp( + routes: { + 'container': (context) => _HomePage(), + 'fitted': (context) => _HomePage(), + 'icon': (context) => _HomePage(), + }, + initialRoute: '/', + home: Scaffold( + appBar: AppBar( + title: Text('LLLL'), + ), + ), + onGenerateRoute: (RouteSettings routeSettings) { + print('onGenerateRouter:$routeSettings'); + if (routeSettings.name == 'icon') { + return MaterialPageRoute(builder: (context) { + return _HomePage(); + }); + } + return null; + }, + onUnknownRoute: (RouteSettings routeSettings) { + print('onUnkonwRoute$routeSettings'); + return MaterialPageRoute(builder: (context) { + return HomePage(); + }); + }, + ); +} + +class _HomePage extends StatelessWidget { + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: AppBar( + title: Text('老慢'), + ), + body: Column( + children: [ + SizedBox( + height: 20, + ), + LinearProgressIndicator(), + SizedBox( + height: 20, + ), + LinearProgressIndicator( + value: 0.3, + ), + SizedBox( + height: 20, + ), + LinearProgressIndicator( + value: 0.3, + backgroundColor: Colors.greenAccent, + valueColor: AlwaysStoppedAnimation(Colors.red), + ), + SizedBox( + height: 20, + ), + CircularProgressIndicator(), + SizedBox( + height: 20, + ), + CircularProgressIndicator( + value: .3, + backgroundColor: Colors.greenAccent, + valueColor: AlwaysStoppedAnimation(Colors.red), + ), + SizedBox( + height: 20, + ), + CupertinoActivityIndicator( + radius: 10, + ), + SizedBox( + height: 20, + ), + RefreshProgressIndicator(), + SizedBox( + height: 20, + ), + RefreshProgressIndicator( + backgroundColor: Colors.greenAccent, + valueColor: AlwaysStoppedAnimation(Colors.red), + strokeWidth: 5.0, + ), + ], + ), + floatingActionButton: RaisedButton( + child: CircleAvatar( + radius: 40, + backgroundImage: AssetImage('images/beatiful_lady.jpeg'), + child: Text('梦'), + ), + onPressed: () async { + print("print"); + var result = await showCupertinoModalPopup( + context: context, + builder: (context) { + return CupertinoActionSheet( + title: Text('tips'), + message: Text('can u sure delete it?'), + cancelButton: CupertinoActionSheetAction( + child: Text('cancel'), + onPressed: () { + print("cancel button"); + }, + ), + actions: [ + CupertinoActionSheetAction( + onPressed: () { + print("DEL button"); + Navigator.of(context).pop('delete'); + }, + child: Text('DEL'), + isDefaultAction: true, + ), + CupertinoActionSheetAction( + onPressed: () { + print("OK button"); + }, + child: Text('OK'), + isDefaultAction: true, + ), + ], + ); + }); + print("result=$result"); + }, + )); + } +} + +class _Test extends StatefulWidget { + @override + State createState() { + return _TestState(); + } +} + +class _TestState extends State<_Test> with SingleTickerProviderStateMixin { + @override + void initState() { + super.initState(); + } + + @override + void dispose() { + super.dispose(); + } + + var _currentIndex = 0; + + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: AppBar( + title: Text('zhaojan'), + ), + body: CustomScrollView( + physics: NeverScrollableScrollPhysics(), + ), + bottomNavigationBar: BottomNavigationBar( + // type: BottomNavigationBarType.fixed, + type: BottomNavigationBarType.shifting, + selectedItemColor: Theme + .of(context) + .primaryColor, + unselectedItemColor: Colors.black, + currentIndex: _currentIndex, + onTap: (index) { + setState(() { + _currentIndex = index; + }); + }, + items: [ + BottomNavigationBarItem( + icon: Icon(Icons.home), + title: Text('首页'), + ), + BottomNavigationBarItem( + icon: Icon(Icons.book), + title: Text('书籍'), + ), + BottomNavigationBarItem( + icon: Icon(Icons.perm_identity), + title: Text('我的'), + ), + ], + ), + ); + } +} diff --git a/flutter_helper/lib/widgets/a036_cupertinocontextmenu.dart b/flutter_helper/lib/widgets/a036_cupertinocontextmenu.dart new file mode 100644 index 00000000..a185512a --- /dev/null +++ b/flutter_helper/lib/widgets/a036_cupertinocontextmenu.dart @@ -0,0 +1,215 @@ +import 'dart:ui'; + +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_helper/widgets/a029_bottomnavigationbar.dart'; + +class CupertinoContextMenuApp extends StatelessWidget { + @override + Widget build(BuildContext context) { + return MaterialApp( + title: "Flutter DEMO APP", + theme: ThemeData( + primarySwatch: Colors.orange, + visualDensity: VisualDensity.adaptivePlatformDensity, + ), + home: _HomePage(), + ); + } +} + +void test() { + MaterialApp( + routes: { + 'container': (context) => _HomePage(), + 'fitted': (context) => _HomePage(), + 'icon': (context) => _HomePage(), + }, + initialRoute: '/', + home: Scaffold( + appBar: AppBar( + title: Text('LLLL'), + ), + ), + onGenerateRoute: (RouteSettings routeSettings) { + print('onGenerateRouter:$routeSettings'); + if (routeSettings.name == 'icon') { + return MaterialPageRoute(builder: (context) { + return _HomePage(); + }); + } + return null; + }, + onUnknownRoute: (RouteSettings routeSettings) { + print('onUnkonwRoute$routeSettings'); + return MaterialPageRoute(builder: (context) { + return HomePage(); + }); + }, + ); +} + +class _HomePage extends StatelessWidget { + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: AppBar( + title: Text('老慢'), + ), + body: Column(children: [ + CupertinoContextMenu( + actions: [ + CupertinoContextMenuAction( + child: Text('Action one'), + onPressed: () { + Navigator.pop(context); + }, + ), + CupertinoContextMenuAction( + child: Text('Action two'), + onPressed: () { + Navigator.pop(context); + }, + ) + ], + child: Container( + color: Colors.red, + height: 60, + width: 100, + )), + CupertinoContextMenu( + previewBuilder: (context, animation, child) { + return Container( + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(10 * animation.value), + color: Colors.red, + ), + height: 60, + width: 100, + ); + }, + actions: [ + CupertinoContextMenuAction( + isDefaultAction: true, //字体变粗 + child: Text('Action one'), + onPressed: () { + Navigator.pop(context); + }, + ), + CupertinoContextMenuAction( + isDestructiveAction: true, //变为红色字体了 + child: Text('Action two'), + onPressed: () { + Navigator.pop(context); + }, + ) + ], + child: Container( + color: Colors.red, + height: 60, + width: 100, + )), + ]), + floatingActionButton: RaisedButton( + child: CircleAvatar( + radius: 40, + backgroundImage: AssetImage('images/beatiful_lady.jpeg'), + child: Text('梦'), + ), + onPressed: () async { + print("print"); + var result = await showCupertinoModalPopup( + context: context, + builder: (context) { + return CupertinoActionSheet( + title: Text('tips'), + message: Text('can u sure delete it?'), + cancelButton: CupertinoActionSheetAction( + child: Text('cancel'), + onPressed: () { + print("cancel button"); + }, + ), + actions: [ + CupertinoActionSheetAction( + onPressed: () { + print("DEL button"); + Navigator.of(context).pop('delete'); + }, + child: Text('DEL'), + isDefaultAction: true, + ), + CupertinoActionSheetAction( + onPressed: () { + print("OK button"); + }, + child: Text('OK'), + isDefaultAction: true, + ), + ], + ); + }); + print("result=$result"); + }, + )); + } +} + +class _Test extends StatefulWidget { + @override + State createState() { + return _TestState(); + } +} + +class _TestState extends State<_Test> with SingleTickerProviderStateMixin { + @override + void initState() { + super.initState(); + } + + @override + void dispose() { + super.dispose(); + } + + var _currentIndex = 0; + + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: AppBar( + title: Text('zhaojan'), + ), + body: CustomScrollView( + physics: NeverScrollableScrollPhysics(), + ), + bottomNavigationBar: BottomNavigationBar( + // type: BottomNavigationBarType.fixed, + type: BottomNavigationBarType.shifting, + selectedItemColor: Theme.of(context).primaryColor, + unselectedItemColor: Colors.black, + currentIndex: _currentIndex, + onTap: (index) { + setState(() { + _currentIndex = index; + }); + }, + items: [ + BottomNavigationBarItem( + icon: Icon(Icons.home), + title: Text('首页'), + ), + BottomNavigationBarItem( + icon: Icon(Icons.book), + title: Text('书籍'), + ), + BottomNavigationBarItem( + icon: Icon(Icons.perm_identity), + title: Text('我的'), + ), + ], + ), + ); + } +} diff --git a/flutter_helper/lib/widgets/a037_cupertinodatepicker.dart b/flutter_helper/lib/widgets/a037_cupertinodatepicker.dart new file mode 100644 index 00000000..8f984ccd --- /dev/null +++ b/flutter_helper/lib/widgets/a037_cupertinodatepicker.dart @@ -0,0 +1,182 @@ + +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_helper/widgets/a029_bottomnavigationbar.dart'; + +class CupertinoDatePickeruApp extends StatelessWidget { + @override + Widget build(BuildContext context) { + return MaterialApp( + title: "Flutter DEMO APP", + theme: ThemeData( + primarySwatch: Colors.orange, + visualDensity: VisualDensity.adaptivePlatformDensity, + ), + home: _HomePage(), + ); + } +} + +void test() { + MaterialApp( + routes: { + 'container': (context) => _HomePage(), + 'fitted': (context) => _HomePage(), + 'icon': (context) => _HomePage(), + }, + initialRoute: '/', + home: Scaffold( + appBar: AppBar( + title: Text('LLLL'), + ), + ), + onGenerateRoute: (RouteSettings routeSettings) { + print('onGenerateRouter:$routeSettings'); + if (routeSettings.name == 'icon') { + return MaterialPageRoute(builder: (context) { + return _HomePage(); + }); + } + return null; + }, + onUnknownRoute: (RouteSettings routeSettings) { + print('onUnkonwRoute$routeSettings'); + return MaterialPageRoute(builder: (context) { + return HomePage(); + }); + }, + ); +} +//cupertinofullscreendialogtransition +DateTime _selectedDate = DateTime.now(); + +class _HomePage extends StatelessWidget { + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: AppBar( + title: Text('老慢'), + ), + body: Scrollbar( + child: SingleChildScrollView( + child: Column( + children: [ + // container( + // child: CupertinoDatePicker( + // onDateTimeChanged: (date) {}, + // initialDateTime: DateTime.now(), + // )), + // YearPicker( + // selectedDate: _selectedDate, + // onChanged: (date) { + // print("$date"); + // // setState(() { + // // _selectedDate = date; + // // }); + // }, + // firstDate: DateTime(2000, 1), + // lastDate: DateTime(2020, 12), + // ), + MonthPicker( + selectedDate: DateTime.now(), + onChanged: (date) { + print("$date"); + // setState(() { + // _selectedDate = date; + // }); + }, + firstDate: DateTime(2020, 1), + lastDate: DateTime(2020, 12), + ), + + // DayPicker( + // selectedDate: _selectedDate, + // currentDate: DateTime.now(), + // onChanged: (date) { + // // setState(() { + // // _selectedDate = date; + // // }); + // }, + // firstDate: DateTime(2020, 5, 1), + // lastDate: DateTime(2020, 5, 31), + // displayedMonth: DateTime(2020, 5), + // ), + ], + ), + ), + ), + floatingActionButton: RaisedButton(onPressed: () async { + var result = await showDatePicker( + context: context, + initialDate: DateTime.now(), + firstDate: DateTime(2020), + lastDate: DateTime(2030), + builder: (context, child) { + return Theme( + data: ThemeData.dark(), + child: child, + ); + }); + print("$result"); + })); + } +} + +class _Test extends StatefulWidget { + @override + State createState() { + return _TestState(); + } +} + +class _TestState extends State<_Test> with SingleTickerProviderStateMixin { + @override + void initState() { + super.initState(); + } + + @override + void dispose() { + super.dispose(); + } + + var _currentIndex = 0; + + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: AppBar( + title: Text('zhaojan'), + ), + body: CustomScrollView( + physics: NeverScrollableScrollPhysics(), + ), + bottomNavigationBar: BottomNavigationBar( + // type: BottomNavigationBarType.fixed, + type: BottomNavigationBarType.shifting, + selectedItemColor: Theme.of(context).primaryColor, + unselectedItemColor: Colors.black, + currentIndex: _currentIndex, + onTap: (index) { + setState(() { + _currentIndex = index; + }); + }, + items: [ + BottomNavigationBarItem( + icon: Icon(Icons.home), + title: Text('首页'), + ), + BottomNavigationBarItem( + icon: Icon(Icons.book), + title: Text('书籍'), + ), + BottomNavigationBarItem( + icon: Icon(Icons.perm_identity), + title: Text('我的'), + ), + ], + ), + ); + } +} diff --git a/flutter_helper/lib/widgets/a038_cupertinofullscrendialogtransitionr.dart b/flutter_helper/lib/widgets/a038_cupertinofullscrendialogtransitionr.dart new file mode 100644 index 00000000..5503af91 --- /dev/null +++ b/flutter_helper/lib/widgets/a038_cupertinofullscrendialogtransitionr.dart @@ -0,0 +1,78 @@ +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_helper/widgets/a029_bottomnavigationbar.dart'; + +class CupertinoFullscreenDialogTransitionApp extends StatelessWidget { + @override + Widget build(BuildContext context) { + return MaterialApp( + title: "Flutter DEMO APP", + theme: ThemeData( + primarySwatch: Colors.orange, + visualDensity: VisualDensity.adaptivePlatformDensity, + ), + home: _Test(), + ); + } +} + +class _Test extends StatefulWidget { + @override + State createState() { + return _TestState(); + } +} + +class _TestState extends State<_Test> with SingleTickerProviderStateMixin { + AnimationController _animationController; + + @override + void initState() { + _animationController = AnimationController( + vsync: this, + duration: Duration(milliseconds: 500), + ); + super.initState(); + } + + @override + void dispose() { + super.dispose(); + } + + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: AppBar( + title: Text('zhaojan'), + ), + body: Column( + children: [ + Expanded(child: Container()), + Row( + mainAxisAlignment: MainAxisAlignment.spaceAround, + children: [ + RaisedButton( + onPressed: () => _animationController.forward(), + child: Text('Forward'), + ), + RaisedButton( + onPressed: () => _animationController.reverse(), + child: Text('Reverse'), + ), + ], + ), + CupertinoFullscreenDialogTransition( + primaryRouteAnimation: _animationController, + secondaryRouteAnimation: _animationController, + child: Container( + color: Colors.blueGrey, + height: 300, + ), + linearTransition: true) + ], + ), + + ); + } +} diff --git a/flutter_helper/lib/widgets/a039_cupertinonavigationnar.dart b/flutter_helper/lib/widgets/a039_cupertinonavigationnar.dart new file mode 100644 index 00000000..d69fe914 --- /dev/null +++ b/flutter_helper/lib/widgets/a039_cupertinonavigationnar.dart @@ -0,0 +1,84 @@ +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_helper/widgets/a029_bottomnavigationbar.dart'; + +class CupertinoPageScaffoldApp extends StatelessWidget { + @override + Widget build(BuildContext context) { + return MaterialApp( + title: "Flutter DEMO APP", + theme: ThemeData( + primarySwatch: Colors.orange, + visualDensity: VisualDensity.adaptivePlatformDensity, + ), + home: _Test(), + ); + } +} + +class _Test extends StatefulWidget { + @override + State createState() { + return _TestState(); + } +} + +class _TestState extends State<_Test> with SingleTickerProviderStateMixin { + AnimationController _animationController; + + @override + void initState() { + _animationController = AnimationController( + vsync: this, + duration: Duration(milliseconds: 500), + ); + super.initState(); + } + + @override + void dispose() { + super.dispose(); + } + + @override + Widget build(BuildContext context) { + return CupertinoPageScaffold( + navigationBar: CupertinoNavigationBar( + leading: Icon(Icons.arrow_back), + middle: Text('老孟'), + ), + child: Center( + child: RaisedButton( + child: Text('goto'), + color: Colors.red, + onPressed: () { + Navigator.of(context).push(CupertinoPageRoute(builder: (context) { + return SecondPage(); + })); + }, + ), + )); + } +} + +class SecondPage extends StatelessWidget { + @override + Widget build(BuildContext context) { + return CupertinoPageScaffold( + navigationBar: CupertinoNavigationBar( + previousPageTitle: '返回', + middle: Text('老孟'), + ), + child: Center( + child: RaisedButton( + child: Text('to third'), + onPressed: () { + // Navigator.of(context).push(CupertinoPageRoute(builder: (context) { + // return ThirdPage(); + // })); + }, + ), + ), + ); + } +} diff --git a/flutter_helper/lib/widgets/a040_cupertinopicker.dart b/flutter_helper/lib/widgets/a040_cupertinopicker.dart new file mode 100644 index 00000000..753c0a36 --- /dev/null +++ b/flutter_helper/lib/widgets/a040_cupertinopicker.dart @@ -0,0 +1,88 @@ +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_helper/widgets/a029_bottomnavigationbar.dart'; + +class CupertinoPickerApp extends StatelessWidget { + @override + Widget build(BuildContext context) { + return MaterialApp( + title: "Flutter DEMO APP", + theme: ThemeData( + primarySwatch: Colors.orange, + visualDensity: VisualDensity.adaptivePlatformDensity, + ), + home: _Test(), + ); + } +} + +class _Test extends StatefulWidget { + @override + State createState() { + return _TestState(); + } +} + +class _TestState extends State<_Test> with SingleTickerProviderStateMixin { + AnimationController _animationController; + + @override + void initState() { + _animationController = AnimationController( + vsync: this, + duration: Duration(milliseconds: 500), + ); + super.initState(); + } + + @override + void dispose() { + super.dispose(); + } + + @override + Widget build(BuildContext context) { + return CupertinoPageScaffold( + navigationBar: CupertinoNavigationBar( + leading: Icon(Icons.arrow_back), + middle: Text('老孟'), + ), + child: Center( + child: Column( + children: [ + SizedBox( + height: 500, + child: CupertinoPicker( + backgroundColor: Colors.red, + itemExtent: 45, + onSelectedItemChanged: (index) { + print('$index'); + }, + children: [ + Container( + color: Colors.primaries[1], + ), + Container( + color: Colors.primaries[2], + ), + Container( + color: Colors.primaries[3], + ), + Container( + color: Colors.primaries[4], + ), + Container( + color: Colors.primaries[5], + ), + Container( + color: Colors.primaries[6], + ), + ], + ), + ), + + ], + ), + )); + } +} diff --git a/flutter_helper/lib/widgets/a041_scrollbar.dart b/flutter_helper/lib/widgets/a041_scrollbar.dart new file mode 100644 index 00000000..baa586a8 --- /dev/null +++ b/flutter_helper/lib/widgets/a041_scrollbar.dart @@ -0,0 +1,61 @@ +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_helper/widgets/a029_bottomnavigationbar.dart'; + +class ScrollbarApp extends StatelessWidget { + @override + Widget build(BuildContext context) { + return MaterialApp( + title: "Flutter DEMO APP", + theme: ThemeData( + primarySwatch: Colors.orange, + visualDensity: VisualDensity.adaptivePlatformDensity, + ), + home: _Test(), + ); + } +} + +class _Test extends StatefulWidget { + @override + State createState() { + return _TestState(); + } +} + +class _TestState extends State<_Test> with SingleTickerProviderStateMixin { + AnimationController _animationController; + + @override + void initState() { + _animationController = AnimationController( + vsync: this, + duration: Duration(milliseconds: 500), + ); + super.initState(); + } + + @override + void dispose() { + super.dispose(); + } + + @override + Widget build(BuildContext context) { + return CupertinoPageScaffold( + navigationBar: CupertinoNavigationBar( + leading: Icon(Icons.arrow_back), + middle: Text('老孟'), + ), + child: Scrollbar( + child: ListView.builder( + itemBuilder: (BuildContext context, int index) { + return Text('Item $index'); + }, + itemExtent: 50, + itemCount: 50, + ), + ), + ); + } +} diff --git a/flutter_helper/lib/widgets/a042_slider.dart b/flutter_helper/lib/widgets/a042_slider.dart new file mode 100644 index 00000000..350c2614 --- /dev/null +++ b/flutter_helper/lib/widgets/a042_slider.dart @@ -0,0 +1,149 @@ +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_helper/widgets/a029_bottomnavigationbar.dart'; + +class SliderApp extends StatelessWidget { + @override + Widget build(BuildContext context) { + return MaterialApp( + title: "Flutter DEMO APP", + theme: ThemeData( + primarySwatch: Colors.orange, + visualDensity: VisualDensity.adaptivePlatformDensity, + ), + home: _Test(), + ); + } +} + +class _Test extends StatefulWidget { + @override + State createState() { + return _TestState(); + } +} + +class _TestState extends State<_Test> with SingleTickerProviderStateMixin { + @override + void initState() { + super.initState(); + } + + @override + void dispose() { + super.dispose(); + } + + double _sliderValue = 0; + double _sliderValue2 = 0; + double _sliderValue3 = 0; + RangeValues _rangeValues = RangeValues(0, 1); + double _sliderValue4 = 0; + double _sliderValue5 = 0; + String _value = '语文'; + + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: AppBar( + title: Text('APPBAR'), + ), + body: Scrollbar( + child: Column( + children: [ + Slider( + value: _sliderValue, + onChanged: (v) { + setState(() { + _sliderValue = v; + }); + }, + ), + Slider( + min: 0, + max: 100, + value: _sliderValue2, + onChanged: (v) { + setState(() { + _sliderValue2 = v; + }); + }, + ), + Slider( + label: '$_sliderValue3', + min: 0, + max: 100, + divisions: 5, + value: _sliderValue3, + onChanged: (v) { + setState(() { + _sliderValue3 = v; + }); + }, + ), + Slider( + activeColor: Colors.red, + inactiveColor: Colors.blue, + label: '$_sliderValue3', + min: 0, + max: 100, + divisions: 5, + value: _sliderValue3, + onChanged: (v) { + setState(() { + _sliderValue3 = v; + }); + }, + ), + RangeSlider( + values: _rangeValues, + onChanged: (v) { + setState(() { + _rangeValues = v; + }); + }, + ), + CupertinoSlider( + value: _sliderValue4, + onChanged: (v) { + setState(() { + _sliderValue4 = v; + }); + }, + ), + Slider.adaptive( + value: _sliderValue5, + onChanged: (v) { + setState(() { + _sliderValue5 = v; + }); + }, + ), + CupertinoSlidingSegmentedControl( + children: { + '语文': Container( + child: Text('语文'), + padding: EdgeInsets.symmetric(vertical: 5, horizontal: 10), + ), + '数学': Container( + child: Text('数学'), + padding: EdgeInsets.symmetric(vertical: 5, horizontal: 10), + ), + '体育': Container( + child: Text('体育'), + padding: EdgeInsets.symmetric(vertical: 5, horizontal: 10), + ), + }, + groupValue: _value, + onValueChanged: (value) { + setState(() { + _value = value; + }); + }, + ), + ], + ), + ), + ); + } +} diff --git a/flutter_helper/lib/widgets/a043_refreshindicator.dart b/flutter_helper/lib/widgets/a043_refreshindicator.dart new file mode 100644 index 00000000..2f1ffa86 --- /dev/null +++ b/flutter_helper/lib/widgets/a043_refreshindicator.dart @@ -0,0 +1,94 @@ +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_helper/widgets/a029_bottomnavigationbar.dart'; + +class RefreshIndicatorApp extends StatelessWidget { + @override + Widget build(BuildContext context) { + return MaterialApp( + title: "Flutter DEMO APP", + theme: ThemeData( + primarySwatch: Colors.orange, + visualDensity: VisualDensity.adaptivePlatformDensity, + ), + home: _Test(), + ); + } +} + +class _Test extends StatefulWidget { + @override + State createState() { + return _TestState(); + } +} + +class _TestState extends State<_Test> with SingleTickerProviderStateMixin { + @override + void initState() { + super.initState(); + } + + @override + void dispose() { + super.dispose(); + } + + var _list = [1, 2, 3, 4, 5]; + + @override + Widget build2(BuildContext context) { + return Scaffold( + appBar: AppBar( + title: Text('APPBAR'), + ), + body: RefreshIndicator( + color: Colors.red, + backgroundColor: Colors.lightBlue, + displacement: 10, + onRefresh: () async { + _list.add(_list.length + 1); + }, + child: ListView.builder( + itemBuilder: (context, index) { + return ListTile( + title: Text('老孟${_list[index]}'), + ); + }, + itemExtent: 50, + itemCount: _list.length, + ), + ), + ); + } + + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: AppBar( + title: Text('ZHAOJIAN'), + ), + body: CustomScrollView( + slivers: [ + CupertinoSliverRefreshControl( + onRefresh: () async { + setState(() { + _list.add(_list.length + 1); + }); + }, + ), + SliverList( + delegate: SliverChildBuilderDelegate( + (context, index) { + return ListTile( + title: Text('老孟${_list[index]}'), + ); + }, + childCount: _list.length, + ), + ), + ], + ), + ); + } +} diff --git a/flutter_helper/lib/widgets/a044_switch.dart b/flutter_helper/lib/widgets/a044_switch.dart new file mode 100644 index 00000000..a4fa5cea --- /dev/null +++ b/flutter_helper/lib/widgets/a044_switch.dart @@ -0,0 +1,115 @@ +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_helper/widgets/a029_bottomnavigationbar.dart'; + +class SwitchApp extends StatelessWidget { + @override + Widget build(BuildContext context) { + return MaterialApp( + title: "Flutter DEMO APP", + theme: ThemeData( + primarySwatch: Colors.orange, + visualDensity: VisualDensity.adaptivePlatformDensity, + ), + home: _Test(), + ); + } +} + +class _Test extends StatefulWidget { + @override + State createState() { + return _TestState(); + } +} + +class _TestState extends State<_Test> with SingleTickerProviderStateMixin { + @override + void initState() { + super.initState(); + } + + @override + void dispose() { + super.dispose(); + } + + var _switchValue = false; + + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: AppBar( + title: Text('ZHAOJIAN'), + ), + body: Column( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Switch( + value: _switchValue, + onChanged: (value) { + setState(() { + _switchValue = value; + }); + }, + ), + Switch( + activeColor: Colors.red, + activeTrackColor: Colors.blue, + inactiveTrackColor: Colors.green, + value: _switchValue, + onChanged: (value) { + setState(() { + _switchValue = value; + }); + }, + ), + Switch( + activeThumbImage: AssetImage('images/beatiful_lady.jpeg'), + inactiveThumbImage: AssetImage('images/bird.png'), + activeColor: Colors.red, + activeTrackColor: Colors.blue, + inactiveTrackColor: Colors.green, + value: _switchValue, + onChanged: (value) { + setState(() { + _switchValue = value; + }); + }, + ), + Switch( + inactiveThumbColor: Colors.black54, + inactiveThumbImage: AssetImage('images/bird.png'), + activeColor: Colors.red, + activeTrackColor: Colors.blue, + inactiveTrackColor: Colors.green, + value: _switchValue, + onChanged: (value) { + setState(() { + _switchValue = value; + }); + }, + ), + SwitchListTile( + value: _switchValue, + title: Text('是否允许4G下载'), + onChanged: (value) { + setState(() { + _switchValue = value; + }); + }, + ), + CupertinoSwitch( + value: _switchValue, + onChanged: (value) { + setState(() { + _switchValue = value; + }); + }, + ), + ], + ), + ); + } +} diff --git a/flutter_helper/lib/widgets/a045_cupertinotab.dart b/flutter_helper/lib/widgets/a045_cupertinotab.dart new file mode 100644 index 00000000..1540b7e2 --- /dev/null +++ b/flutter_helper/lib/widgets/a045_cupertinotab.dart @@ -0,0 +1,66 @@ +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_helper/widgets/a029_bottomnavigationbar.dart'; + +class CupertinoTabBarApp extends StatelessWidget { + @override + Widget build(BuildContext context) { + return MaterialApp( + title: "Flutter DEMO APP", + theme: ThemeData( + primarySwatch: Colors.orange, + visualDensity: VisualDensity.adaptivePlatformDensity, + ), + home: _Test(), + ); + } +} + +class _Test extends StatefulWidget { + @override + State createState() { + return _TestState(); + } +} + +class _TestState extends State<_Test> with SingleTickerProviderStateMixin { + @override + void initState() { + super.initState(); + } + + @override + void dispose() { + super.dispose(); + } + + var _switchValue = false; + + @override + Widget build(BuildContext context) { + return CupertinoTabScaffold( + tabBar: CupertinoTabBar( + items: [ + BottomNavigationBarItem(icon: Icon(Icons.home), title: Text('tab1')), + BottomNavigationBarItem(icon: Icon(Icons.home), title: Text('tab2')), + ], + onTap: (index) { + print('$index'); + }, + currentIndex: 1, + backgroundColor: Colors.blue, + activeColor: Colors.red, + ), + tabBuilder: (BuildContext context, int index) { + return CupertinoTabView( + defaultTitle: '老孟', + builder: (context) { + return Center( + child: Text('$index'), + ); + }, + ); + }, + ); + } +} diff --git a/flutter_helper/lib/widgets/a046_textfield.dart b/flutter_helper/lib/widgets/a046_textfield.dart new file mode 100644 index 00000000..69835bea --- /dev/null +++ b/flutter_helper/lib/widgets/a046_textfield.dart @@ -0,0 +1,233 @@ +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter/services.dart'; +import 'package:flutter_helper/widgets/a029_bottomnavigationbar.dart'; + +class TextFieldApp extends StatelessWidget { + @override + Widget build(BuildContext context) { + return MaterialApp( + title: "Flutter DEMO APP", + theme: ThemeData( + primarySwatch: Colors.orange, + visualDensity: VisualDensity.adaptivePlatformDensity, + ), + home: _Test(), + ); + } +} + +class _Test extends StatefulWidget { + @override + State createState() { + return _TestState(); + } +} + +class TextFieldPage extends StatefulWidget { + String title; + + TextFieldPage({Key key, this.title}) : super(key: key); + + @override + _TextFieldPageState createState() => _TextFieldPageState(); +} + +class _TextFieldPageState extends State { + var _textFieldValue = ''; + TextEditingController _controller; + + @override + void initState() { + _controller = TextEditingController() + ..addListener(() { + //获取输入框的内容,变为大写 + _controller.text = _controller.text.toUpperCase(); + }); + super.initState(); + } + + @override + void dispose() { + _controller.dispose(); + super.dispose(); + } + + void test() { + var _focusNode = FocusNode(); + _focusNode.unfocus(); + // FocusScope.of(context).requestFocus(_focusNode); + } + + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: AppBar( + title: Text(widget.title), + ), + body: SingleChildScrollView( + child: Column( + children: [ + TextField( + maxLength: 100, + buildCounter: ( + BuildContext context, { + int currentLength, + int maxLength, + bool isFocused, + }) { + return Text( + '$currentLength/$maxLength', + ); + }, + ), + TextField( + decoration: InputDecoration(hintText: 'hello'), + onChanged: (value) { + print('onChanged:$value'); + }, + onEditingComplete: () { + print('onEditingComplete'); + }, + onTap: () { + print('onTap'); + }, + textInputAction: TextInputAction.go, + ), + TextField( + inputFormatters: [ + WhitelistingTextInputFormatter(RegExp("[a-zA-Z]")), + ], + decoration: InputDecoration(hintText: 'go'), + textInputAction: TextInputAction.go, + ), + TextField( + obscureText: true, + decoration: InputDecoration(hintText: 'go'), + textInputAction: TextInputAction.go, + ), + TextField( + decoration: InputDecoration(hintText: 'done'), + textInputAction: TextInputAction.done, + ), + TextField( + keyboardType: TextInputType.phone, + controller: _controller, + ), + Container( + height: 60, + width: 250, + child: TextField( + decoration: InputDecoration( + fillColor: Color(0x30cccccc), + filled: true, + enabledBorder: OutlineInputBorder( + borderSide: BorderSide(color: Color(0x00FF0000)), + borderRadius: BorderRadius.all(Radius.circular(100)), + ), + hintText: 'QQ👌/手机号/邮箱', + focusedBorder: OutlineInputBorder( + borderSide: BorderSide(color: Color(0x00000000)), + borderRadius: BorderRadius.all(Radius.circular(100)), + ), + ), + ), + ), + TextField( + onChanged: (value) { + print(value); + setState(() { + _textFieldValue = value; + }); + }, + decoration: + InputDecoration(counterText: '${_textFieldValue.length}/32'), + ), + TextField( + decoration: InputDecoration( + prefixIcon: Icon(Icons.person), + suffixIcon: Icon(Icons.person)), + ), + TextField( + decoration: InputDecoration( + errorText: '用户名输入错误', + errorStyle: TextStyle(fontSize: 12), + errorMaxLines: 1, + errorBorder: OutlineInputBorder( + borderSide: BorderSide(color: Colors.red)), + ), + ), + TextField(), + TextField( + decoration: InputDecoration( + icon: Icon(Icons.person), + ), + ), + TextField( + decoration: InputDecoration( + labelText: '姓名:', + labelStyle: TextStyle(color: Colors.red), + ), + ), + TextField( + decoration: InputDecoration( + helperText: '用户长度为6-10个字符', + helperStyle: TextStyle(color: Colors.blue), + helperMaxLines: 1, + ), + ), + TextField( + decoration: InputDecoration( + hintText: '请输入用户名', + hintStyle: TextStyle(color: Colors.grey), + hintMaxLines: 1, + ), + ), + ], + ), + ), + ); + } +} + +class _TestState extends State<_Test> with SingleTickerProviderStateMixin { + @override + void initState() { + super.initState(); + } + + @override + void dispose() { + super.dispose(); + } + + var _switchValue = false; + + @override + Widget build(BuildContext context) { + return CupertinoTabScaffold( + tabBar: CupertinoTabBar( + items: [ + BottomNavigationBarItem(icon: Icon(Icons.home), title: Text('tab1')), + BottomNavigationBarItem(icon: Icon(Icons.home), title: Text('tab2')), + ], + onTap: (index) { + print('$index'); + }, + currentIndex: 0, + backgroundColor: Colors.blue, + activeColor: Colors.red, + ), + tabBuilder: (BuildContext context, int index) { + return CupertinoTabView( + defaultTitle: '老孟', + builder: (context) { + var page = TextFieldPage(); + page.title = '$index'; + return page; + }, + ); + }, + ); + } +} diff --git a/flutter_helper/lib/widgets/a047_cliprect.dart b/flutter_helper/lib/widgets/a047_cliprect.dart new file mode 100644 index 00000000..c9d70419 --- /dev/null +++ b/flutter_helper/lib/widgets/a047_cliprect.dart @@ -0,0 +1,343 @@ +import 'dart:math'; + +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter/services.dart'; +import 'package:flutter_helper/widgets/a029_bottomnavigationbar.dart'; + +class ClipRectApp extends StatelessWidget { + @override + Widget build(BuildContext context) { + return MaterialApp( + title: "Flutter DEMO APP", + theme: ThemeData( + primarySwatch: Colors.orange, + visualDensity: VisualDensity.adaptivePlatformDensity, + ), + home: _Test(), + ); + } +} + +class _Test extends StatefulWidget { + @override + State createState() { + return _TestState(); + } +} + +class TextFieldPage extends StatefulWidget { + String title; + + TextFieldPage({Key key, this.title}) : super(key: key); + + @override + _TextFieldPageState createState() => _TextFieldPageState(); +} + +class _TextFieldPageState extends State { + @override + void initState() { + super.initState(); + } + + @override + void dispose() { + super.dispose(); + } + + void test() { + var _focusNode = FocusNode(); + _focusNode.unfocus(); + // FocusScope.of(context).requestFocus(_focusNode); + } + + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: AppBar( + title: Text(widget.title), + ), + body: SingleChildScrollView( + child: Column( + children: [ + Builder(builder: (context) { + return StartClip(); + }), + Builder(builder: (context) { + return Center( + child: ClipPath( + clipper: StarPath(), + child: Container( + height: 150, + width: 250, + child: Image.asset( + 'images/beatiful_lady.jpeg', + fit: BoxFit.cover, + ), + ), + ), + ); + }), + Builder(builder: (context) { + return Center( + child: ClipPath( + clipper: TrianglePath(), + child: Container( + height: 150, + width: 250, + child: Image.asset( + 'images/beatiful_lady.jpeg', + fit: BoxFit.cover, + ), + ), + ), + ); + }), + ClipPath.shape( + shape: BeveledRectangleBorder(), + child: Container( + height: 150, + width: 250, + child: Image.asset( + 'images/beatiful_lady.jpeg', + fit: BoxFit.cover, + ), + ), + ), + ClipPath.shape( + shape: ContinuousRectangleBorder(), + child: Container( + height: 150, + width: 150, + child: Image.asset( + 'images/beatiful_lady.jpeg', + fit: BoxFit.cover, + ), + ), + ), + ClipPath.shape( + shape: RoundedRectangleBorder(), + child: Container( + height: 150, + width: 150, + child: Image.asset( + 'images/beatiful_lady.jpeg', + fit: BoxFit.cover, + ), + ), + ), + ClipPath.shape( + shape: StadiumBorder(), + child: Container( + height: 150, + width: 250, + child: Image.asset( + 'images/beatiful_lady.jpeg', + fit: BoxFit.cover, + ), + ), + ), + ClipOval( + child: Container( + height: 150, + width: 250, + child: Image.asset( + 'images/beatiful_lady.jpeg', + fit: BoxFit.cover, + ), + ), + ), + ClipOval( + child: Container( + height: 150, + width: 150, + child: Image.asset( + 'images/beatiful_lady.jpeg', + fit: BoxFit.cover, + ), + ), + ), + ClipRRect( + borderRadius: BorderRadius.circular(20), + child: Container( + height: 150, + width: 150, + child: + Image.asset('images/beatiful_lady.jpeg', fit: BoxFit.cover), + ), + ), + ClipRect( + child: Align( + alignment: Alignment.topCenter, + heightFactor: 0.5, + child: Container( + height: 150, + width: 150, + child: Image.asset( + 'images/beatiful_lady.jpeg', + fit: BoxFit.cover, + ), + ), + ), + ), + ], + ), + ), + ); + } +} + +class StartClip extends StatefulWidget { + @override + State createState() => _StartClipState(); +} + +class _StartClipState extends State + with SingleTickerProviderStateMixin { + AnimationController _controller; + Animation _animation; + + @override + void initState() { + _controller = + AnimationController(duration: Duration(seconds: 2), vsync: this) + ..addStatusListener((status) { + if (status == AnimationStatus.completed) { + _controller.reverse(); + } else if (status == AnimationStatus.dismissed) { + _controller.forward(); + } + }); + _animation = Tween(begin: 1.0, end: 4.0).animate(_controller); + _controller.forward(); + super.initState(); + } + + @override + Widget build(BuildContext context) { + return Center( + child: AnimatedBuilder( + animation: _animation, + builder: (context, child) { + return ClipPath( + clipper: StarPath(scale: _animation.value), + child: Container( + height: 150, + width: 150, + color: Colors.red, + ), + ); + }), + ); + } +} + + +class StarPath extends CustomClipper { + StarPath({this.scale = 2.5}); + + final double scale; + + double perDegree = 36; + + /// 角度转弧度公式 + double degree2Radian(double degree) { + return (pi * degree / 180); + } + + @override + Path getClip(Size size) { + var R = min(size.width / 2, size.height / 2); + var r = R / scale; + var x = size.width / 2; + var y = size.height / 2; + + var path = Path(); + path.moveTo(x, y - R); + path.lineTo(x - sin(degree2Radian(perDegree)) * r, + y - cos(degree2Radian(perDegree)) * r); + path.lineTo(x - sin(degree2Radian(perDegree * 2)) * R, + y - cos(degree2Radian(perDegree * 2)) * R); + path.lineTo(x - sin(degree2Radian(perDegree * 3)) * r, + y - cos(degree2Radian(perDegree * 3)) * r); + path.lineTo(x - sin(degree2Radian(perDegree * 4)) * R, + y - cos(degree2Radian(perDegree * 4)) * R); + path.lineTo(x - sin(degree2Radian(perDegree * 5)) * r, + y - cos(degree2Radian(perDegree * 5)) * r); + path.lineTo(x - sin(degree2Radian(perDegree * 6)) * R, + y - cos(degree2Radian(perDegree * 6)) * R); + path.lineTo(x - sin(degree2Radian(perDegree * 7)) * r, + y - cos(degree2Radian(perDegree * 7)) * r); + path.lineTo(x - sin(degree2Radian(perDegree * 8)) * R, + y - cos(degree2Radian(perDegree * 8)) * R); + path.lineTo(x - sin(degree2Radian(perDegree * 9)) * r, + y - cos(degree2Radian(perDegree * 9)) * r); + path.lineTo(x - sin(degree2Radian(perDegree * 10)) * R, + y - cos(degree2Radian(perDegree * 10)) * R); + return path; + } + + @override + bool shouldReclip(StarPath oldClipper) { + return oldClipper.scale != this.scale; + } +} + +class TrianglePath extends CustomClipper { + @override + Path getClip(Size size) { + var path = Path(); + path.moveTo(size.width / 2, 0); + path.lineTo(0, size.height); + path.lineTo(size.width, size.height); + return path; + } + + @override + bool shouldReclip(CustomClipper oldClipper) { + return true; + } +} + +class _TestState extends State<_Test> with SingleTickerProviderStateMixin { + @override + void initState() { + super.initState(); + } + + @override + void dispose() { + super.dispose(); + } + + var _switchValue = false; + + @override + Widget build(BuildContext context) { + return CupertinoTabScaffold( + tabBar: CupertinoTabBar( + items: [ + BottomNavigationBarItem(icon: Icon(Icons.home), title: Text('tab1')), + BottomNavigationBarItem(icon: Icon(Icons.home), title: Text('tab2')), + ], + onTap: (index) { + print('$index'); + }, + currentIndex: 0, + backgroundColor: Colors.blue, + activeColor: Colors.red, + ), + tabBuilder: (BuildContext context, int index) { + return CupertinoTabView( + defaultTitle: '老孟', + builder: (context) { + var page = TextFieldPage(); + page.title = '$index'; + return page; + }, + ); + }, + ); + } +} diff --git a/flutter_helper/lib/widgets/a048_custommultichildlayout.dart b/flutter_helper/lib/widgets/a048_custommultichildlayout.dart new file mode 100644 index 00000000..7af2add8 --- /dev/null +++ b/flutter_helper/lib/widgets/a048_custommultichildlayout.dart @@ -0,0 +1,94 @@ +import 'dart:math'; +import 'dart:ui'; + +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter/services.dart'; +import 'package:flutter_helper/widgets/a029_bottomnavigationbar.dart'; + +class CustomMultiChildLayoutApp extends StatelessWidget { + @override + Widget build(BuildContext context) { + return MaterialApp( + title: "Flutter DEMO APP", + theme: ThemeData( + primarySwatch: Colors.orange, + visualDensity: VisualDensity.adaptivePlatformDensity, + ), + home: _Test(), + ); + } +} + +class _Test extends StatefulWidget { + @override + State createState() { + return _TestState(); + } +} + +class _TestState extends State<_Test> with SingleTickerProviderStateMixin { + @override + void initState() { + super.initState(); + } + + @override + void dispose() { + super.dispose(); + } + + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: AppBar( + title: Text('ZhaoJian'), + ), + body: Container( + width: 200, + height: 200, + color: Colors.red, + child: CustomMultiChildLayout( + delegate: FollowTheLeader(), + children: [ + LayoutId( + id: FollowTheLeaderId.leader, + child: Text('老孟'), + ), + LayoutId( + id: FollowTheLeaderId.follower, + child: Text('专注分享Flutter'), + ), + ], + ), + ), + ); + } +} + +enum FollowTheLeaderId { leader, follower } + +class FollowTheLeader extends MultiChildLayoutDelegate { + @override + void performLayout(Size size) { + Size leaderSize = Size.zero; + if (hasChild(FollowTheLeaderId.leader)) { + leaderSize = + layoutChild(FollowTheLeaderId.leader, BoxConstraints.loose(size)); + positionChild(FollowTheLeaderId.leader, Offset.zero); + } + if (hasChild(FollowTheLeaderId.follower)) { + Size followerSize = + layoutChild(FollowTheLeaderId.follower, BoxConstraints.loose(size)); + positionChild( + FollowTheLeaderId.follower, + Offset(size.width - followerSize.width, + size.height - followerSize.height)); + } + } + + @override + bool shouldRelayout(covariant MultiChildLayoutDelegate oldDelegate) { + return false; + } +} diff --git a/flutter_helper/lib/widgets/a050_custompaint.dart b/flutter_helper/lib/widgets/a050_custompaint.dart new file mode 100644 index 00000000..4c71bdfb --- /dev/null +++ b/flutter_helper/lib/widgets/a050_custompaint.dart @@ -0,0 +1,146 @@ +import 'dart:math'; +import 'dart:ui'; + +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter/services.dart'; +import 'package:flutter_helper/widgets/a029_bottomnavigationbar.dart'; + +class CustomPaintApp extends StatelessWidget { + @override + Widget build(BuildContext context) { + return MaterialApp( + title: "Flutter DEMO APP", + theme: ThemeData( + primarySwatch: Colors.orange, + visualDensity: VisualDensity.adaptivePlatformDensity, + ), + home: _Test(), + ); + } +} + +class _Test extends StatefulWidget { + @override + State createState() { + return _TestState(); + } +} + +class _TestState extends State<_Test> with SingleTickerProviderStateMixin { + @override + void initState() { + super.initState(); + } + + @override + void dispose() { + super.dispose(); + } + + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: AppBar( + title: Text('ZhaoJian'), + ), + body: SingleChildScrollView( + child: Container( + color: Colors.red, + child: Column( + children: [ + Container( + width: 200, + height: 200, + color: Colors.blue, + child: CustomPaint( + painter: MyCustomPainter(), + ), + ), + ], + ), + ), + ), + ); + } +} + +class MyCustomPainter extends CustomPainter { + Paint _paint = Paint() + ..color = Colors.red + ..strokeWidth = 10; + + @override + void paint(Canvas canvas, Size size) { + var points = [ + Offset(20, 20), + Offset(size.width / 2, size.height / 2), + Offset(size.width - 20, size.height - 20), + ]; + canvas.drawPoints(PointMode.points, points, _paint); + _paint.strokeWidth = 5; + canvas.drawLine(Offset(0,0), Offset(size.width, size.height), _paint); + + _paint.strokeWidth = 3; + _paint.style = PaintingStyle.stroke; + print('size:$size'); + var _path = Path() + ..moveTo(20, 10) + ..lineTo(size.width-10, 10) + ..lineTo(size.width-10, size.height-20) + ..close(); + canvas.drawPath(_path, _paint); + + + _path = Path() + ..moveTo(60, 20) + ..lineTo(size.width-20, 20) + ..lineTo(size.width-20, size.height-60) + ..close(); + _paint.style = PaintingStyle.fill; + canvas.drawPath(_path, _paint); + + canvas.drawCircle(Offset(size.width/2, size.height/2), 20, _paint); + canvas.drawOval(Rect.fromLTRB(40, 0, size.width/2, size.height/2), _paint); + + _paint.style = PaintingStyle.stroke; + canvas.drawArc(Rect.fromLTRB(70,70, size.width-20, size.height-20), 0, + pi/2, + true, _paint); + + _paint.color = Colors.yellow; + _paint.strokeWidth = 10; + canvas.drawRRect(RRect.fromLTRBR(0, 0, size.width, size.height, Radius + .circular(10)), _paint); + } + + /// + /// 绘制花骨朵 + /// + // _drawFlower(Canvas canvas, Size size) { + // //将花变为红色 + // if (flowerPaths.length >= RoseData.flowerPoints.length) { + // var path = Path(); + // for (int i = 0; i < flowerPaths.length; i++) { + // if (i == 0) { + // path.moveTo(flowerPaths[i].dx, flowerPaths[i].dy); + // } else { + // path.lineTo(flowerPaths[i].dx, flowerPaths[i].dy); + // } + // } + // _paint.style = PaintingStyle.fill; + // _paint.color = _flowerColor; + // canvas.drawPath(path, _paint); + // } + // //绘制线 + // _paint.style = PaintingStyle.stroke; + // _paint.color = _strokeColor; + // //去掉最后2个点,最后2个点为了绘制红色 + // var points = flowerPaths.sublist(0, max(0, flowerPaths.length - 2)); + // canvas.drawPoints(PointMode.polygon, points, _paint); + // } + @override + bool shouldRepaint(covariant CustomPainter oldDelegate) { + return this != oldDelegate; + } +} diff --git a/flutter_helper/lib/widgets/a051_customscrollview.dart b/flutter_helper/lib/widgets/a051_customscrollview.dart new file mode 100644 index 00000000..c60a76c7 --- /dev/null +++ b/flutter_helper/lib/widgets/a051_customscrollview.dart @@ -0,0 +1,138 @@ +import 'dart:math'; +import 'dart:ui'; + +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter/services.dart'; +import 'package:flutter_helper/widgets/a029_bottomnavigationbar.dart'; + +class CustomScrollViewApp extends StatelessWidget { + @override + Widget build(BuildContext context) { + return MaterialApp( + title: "Flutter DEMO APP", + theme: ThemeData( + primarySwatch: Colors.orange, + visualDensity: VisualDensity.adaptivePlatformDensity, + ), + home: _Test(), + ); + } +} + +class _Test extends StatefulWidget { + @override + State createState() { + return _TestState(); + } +} + +class _TestState extends State<_Test> with SingleTickerProviderStateMixin { + + var _scrollController = ScrollController(); + + @override + void initState() { + // 监听滚动位置 + _scrollController.addListener(() { + print('${_scrollController.position}'); + }); + //滚动到指定位置 + _scrollController.animateTo(20.0, duration: Duration(seconds: 2), curve: + null); + super.initState(); + } + + @override + void dispose() { + super.dispose(); + } + + buildBody1() => + CustomScrollView( + slivers: [ + SliverGrid.count( + crossAxisCount: 4, + children: List.generate(8, (index) { + return Container( + color: Colors.primaries[index % Colors.primaries.length], + alignment: Alignment.center, + child: Text( + '$index', + style: TextStyle(color: Colors.white, fontSize: 20), + ), + ); + }).toList(), + ), + SliverList( + delegate: SliverChildBuilderDelegate((content, index) { + return Container( + height: 85, + alignment: Alignment.center, + color: Colors.primaries[index % Colors.primaries.length], + child: Text( + '$index', + style: TextStyle(color: Colors.white, fontSize: 20), + ), + ); + }, childCount: 25), + ) + ], + ); + + buildBody2() => + CustomScrollView( + controller: _scrollController, + scrollDirection: Axis.vertical, + reverse: false, + slivers: [ + SliverAppBar( + pinned: true, + expandedHeight: 230.0, + flexibleSpace: FlexibleSpaceBar( + title: Text('复仇者联盟'), + background: Image.network( + 'http://img.haote.com/upload/20180918/2018091815372344164.jpg', + fit: BoxFit.fitHeight, + ), + ), + ), + SliverGrid.count( + crossAxisCount: 4, + children: List.generate(8, (index) { + return Container( + color: Colors.primaries[index % Colors.primaries.length], + alignment: Alignment.center, + child: Text( + '$index', + style: TextStyle(color: Colors.white, fontSize: 20), + ), + ); + }).toList(), + ), + SliverList( + delegate: SliverChildBuilderDelegate((context, index) { + return Container( + height: 85, + alignment: Alignment.center, + color: Colors.primaries[index % Colors.primaries.length], + child: Text( + '$index', + style: TextStyle(color: Colors.white, fontSize: 24), + ), + ); + }, childCount: 25)), + ], + ); + + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: AppBar( + title: Text('ZhaoJian'), + ), + //body: buildBody1(), + body: buildBody2(), + ); + } +} diff --git a/flutter_helper/lib/widgets/a052_customsinglechildlayout.dart b/flutter_helper/lib/widgets/a052_customsinglechildlayout.dart new file mode 100644 index 00000000..dad5640b --- /dev/null +++ b/flutter_helper/lib/widgets/a052_customsinglechildlayout.dart @@ -0,0 +1,78 @@ +import 'dart:math'; +import 'dart:ui'; + +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter/services.dart'; +import 'package:flutter_helper/widgets/a029_bottomnavigationbar.dart'; + +class CustomSingleChildLayoutApp extends StatelessWidget { + @override + Widget build(BuildContext context) { + return MaterialApp( + title: "Flutter DEMO APP", + theme: ThemeData( + primarySwatch: Colors.orange, + visualDensity: VisualDensity.adaptivePlatformDensity, + ), + home: _Test(), + ); + } +} + +class _Test extends StatefulWidget { + @override + State createState() { + return _TestState(); + } +} + +class MySingleChildLayoutDelegate extends SingleChildLayoutDelegate { + final Offset position; + + MySingleChildLayoutDelegate(this.position); + + @override + Offset getPositionForChild(Size size, Size childSize) { + return Offset(position.dx, position.dy); + } + + @override + bool shouldRelayout(covariant MySingleChildLayoutDelegate oldDelegate) { + return oldDelegate.position != position; + } +} + +class _TestState extends State<_Test> with SingleTickerProviderStateMixin { + @override + void initState() { + super.initState(); + } + + @override + void dispose() { + super.dispose(); + } + + buildBody() => Container( + width: 200, + height: 200, + color: Colors.blue, + child: CustomSingleChildLayout( + delegate: MySingleChildLayoutDelegate(Offset(10, 10)), + child: Container( + color: Colors.red, + ), + ), + ); + + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: AppBar( + title: Text('ZhaoJian'), + ), + body: buildBody(), + ); + } +} diff --git a/flutter_helper/lib/widgets/a053_datatable.dart b/flutter_helper/lib/widgets/a053_datatable.dart new file mode 100644 index 00000000..d31a4acb --- /dev/null +++ b/flutter_helper/lib/widgets/a053_datatable.dart @@ -0,0 +1,240 @@ +import 'dart:math'; +import 'dart:ui'; + +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter/services.dart'; +import 'package:flutter_helper/widgets/a029_bottomnavigationbar.dart'; + +class DataTableApp extends StatelessWidget { + @override + Widget build(BuildContext context) { + return MaterialApp( + title: "Flutter DEMO APP", + theme: ThemeData( + primarySwatch: Colors.orange, + visualDensity: VisualDensity.adaptivePlatformDensity, + ), + home: _Test(), + ); + } +} + +class _Test extends StatefulWidget { + @override + State createState() { + return _TestState(); + } +} + +class MySingleChildLayoutDelegate extends SingleChildLayoutDelegate { + final Offset position; + + MySingleChildLayoutDelegate(this.position); + + @override + Offset getPositionForChild(Size size, Size childSize) { + return Offset(position.dx, position.dy); + } + + @override + bool shouldRelayout(covariant MySingleChildLayoutDelegate oldDelegate) { + return oldDelegate.position != position; + } +} + +class _TestState extends State<_Test> with SingleTickerProviderStateMixin { + @override + void initState() { + super.initState(); + } + + @override + void dispose() { + super.dispose(); + } + + buildBody() => SingleChildScrollView( + // child: buildChild(), + // child: buildDataTable(), + child: buildDataTable3(), + ); + + buildChild() => Column( + children: [ + DataTable( + // sortColumnIndex: 1, + // sortAscending: true, + columns: [ + DataColumn(label: Text('姓名')), + DataColumn(label: Text('年龄'), numeric: true), //右边对齐 + ], + rows: [ + DataRow( + cells: [DataCell(Text('老孟')), DataCell(Text('1'))], + onSelectChanged: (selected) {}), + DataRow(cells: [DataCell(Text('赵健')), DataCell(Text('2'))]), + DataRow(cells: [DataCell(Text('赵健')), DataCell(Text('3'))]), + DataRow(cells: [DataCell(Text('赵健')), DataCell(Text('8'))]), + DataRow(cells: [DataCell(Text('赵健')), DataCell(Text('5'))]), + DataRow(cells: [DataCell(Text('赵健')), DataCell(Text('6'))]), + DataRow(cells: [DataCell(Text('赵健')), DataCell(Text('7'))]), + DataRow(cells: [DataCell(Text('赵健')), DataCell(Text('2'))]), + DataRow(cells: [DataCell(Text('赵健')), DataCell(Text('3'))]), + DataRow(cells: [DataCell(Text('赵健')), DataCell(Text('8'))]), + DataRow(cells: [DataCell(Text('赵健')), DataCell(Text('5'))]), + DataRow(cells: [DataCell(Text('赵健')), DataCell(Text('6'))]), + DataRow(cells: [DataCell(Text('赵健')), DataCell(Text('7'))]), + DataRow(cells: [DataCell(Text('赵健')), DataCell(Text('2'))]), + DataRow(cells: [DataCell(Text('赵健')), DataCell(Text('3'))]), + DataRow(cells: [DataCell(Text('赵健')), DataCell(Text('8'))]), + DataRow(cells: [DataCell(Text('赵健')), DataCell(Text('5'))]), + DataRow(cells: [DataCell(Text('赵健')), DataCell(Text('6'))]), + DataRow(cells: [DataCell(Text('赵健')), DataCell(Text('7'))]), + ], + ), + ], + ); + + List data = [ + User('老孟', 1), + User('老孟', 2, selected: true), + User('老孟', 1), + User('老孟', 4), + User('老孟', 1), + User('老孟', 5), + User('老孟', 17), + User('老孟', 17), + User('老孟', 7), + User('老孟', 9), + User('老孟', 4), + User('老孟', 18), + User('老孟', 18), + User('老孟', 18), + User('老孟', 18), + User('老孟', 18), + User('老孟', 18), + User('老孟', 18), + User('老孟', 18), + User('老孟', 18), + User('老孟', 18), + User('老孟', 18), + User('老孟', 18), + User('老孟', 18), + User('老孟', 18), + User('老孟', 18), + User('老孟', 18), + User('老孟', 18), + User('老孟', 18), + User('老孟', 18), + User('老孟', 18), + User('老孟', 18), + User('老孟', 18), + User('老孟', 18), + User('老孟', 18), + ]; + + var _sortAscending = true; + + buildListDataRow() { + List dataRows = []; + for (int i = 0; i < data.length; i++) { + dataRows.add(DataRow( + selected: data[i].selected, + onSelectChanged: (selected) { + setState(() { + data[i].selected = selected; + }); + }, + cells: [ + DataCell(Text('${data[i].name}'), showEditIcon: true), + DataCell(Text('${data[i].age}'), placeholder: true) + ], + )); + } + return dataRows; + } + + buildDataTable() => DataTable(columns: [ + DataColumn(label: Text('姓名')), + DataColumn(label: Text('年龄')), + ], rows: buildListDataRow()); + + buildDataTable2() => DataTable( + sortColumnIndex: 1, + sortAscending: _sortAscending, + columns: [ + DataColumn(label: Text('姓名')), + DataColumn( + label: Text('年龄'), + onSort: (int columnIndex, bool ascending) { + setState(() { + _sortAscending = ascending; + if (ascending) { + data.sort((a, b) => a.age.compareTo(b.age)); + } else { + data.sort((a, b) => b.age.compareTo(a.age)); + } + }); + }), + ], + rows: data.map((user) { + return DataRow(cells: [ + DataCell(Text('${user.name}')), + DataCell(Text('${user.age}')), + ]); + }).toList(), + ); + + buildDataTable3() { + List dateRows = []; + for (int i = 0; i < data.length; i++) { + dateRows.add(DataRow( + cells: [ + DataCell(Text('${data[i].name}')), + DataCell(Text('${data[i].age}')), + DataCell(Text('男')), + DataCell(Text('2020')), + DataCell(Text('10')), + ], + )); + } + return SingleChildScrollView( + scrollDirection: Axis.horizontal, + child: DataTable(columns: [ + DataColumn(label: Text('姓名')), + DataColumn( + label: Text('年龄'), + ), + DataColumn( + label: Text('性别'), + ), + DataColumn( + label: Text('出生年份'), + ), + DataColumn( + label: Text('出生月份'), + ), + ], rows: dateRows), + ); + } + + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: AppBar( + title: Text('ZhaoJian'), + ), + body: buildBody(), + // body: buildDataTable(), + ); + } +} + +class User { + String name; + int age; + bool selected; + + User(this.name, this.age, {this.selected = false}); +} diff --git a/flutter_helper/lib/widgets/a054_decoratedbox.dart b/flutter_helper/lib/widgets/a054_decoratedbox.dart new file mode 100644 index 00000000..2981fcb4 --- /dev/null +++ b/flutter_helper/lib/widgets/a054_decoratedbox.dart @@ -0,0 +1,143 @@ +import 'dart:math'; +import 'dart:ui'; + +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter/services.dart'; +import 'package:flutter_helper/widgets/a029_bottomnavigationbar.dart'; + +class DecoratedBoxApp extends StatelessWidget { + @override + Widget build(BuildContext context) { + return MaterialApp( + title: "Flutter DEMO APP", + theme: ThemeData( + primarySwatch: Colors.orange, + visualDensity: VisualDensity.adaptivePlatformDensity, + ), + home: _Test(), + ); + } +} + +class _Test extends StatefulWidget { + @override + State createState() { + return _TestState(); + } +} + +class _TestState extends State<_Test> with SingleTickerProviderStateMixin { + @override + void initState() { + super.initState(); + } + + @override + void dispose() { + super.dispose(); + } + + buildBody() => SingleChildScrollView( + child: Column( + children: [ + DecoratedBox( + child: Container( + width: 200, + height: 200, + ), + decoration: BoxDecoration( + gradient: RadialGradient( + center: const Alignment(-0.5, -0.6), + radius: 0.15, + colors: [ + const Color(0xFFEEEEEE), + const Color(0xFF111133), + ], + stops: [0.9, 1.0] + ), + ), + ), + DecoratedBox( + decoration: BoxDecoration( + image: DecorationImage( + image: NetworkImage( + 'https://flutter.github.io/assets-for-api-docs/assets/widgets/owl-2.jpg'), + fit: BoxFit.cover, + ), + shape: BoxShape.circle, + color: Colors.blue, + // borderRadius: BorderRadius.circular(20), + border: Border.all( + color: Colors.red, + width: 2, + )), + child: Container( + height: 200, + width: 200, + ), + ), + DecoratedBox( + decoration: BoxDecoration( + image: DecorationImage( + image: NetworkImage( + 'https://flutter.github.io/assets-for-api-docs/assets/widgets/owl-2.jpg'), + fit: BoxFit.cover, + ), + shape: BoxShape.rectangle, + color: Colors.blue, + borderRadius: BorderRadius.circular(20), + border: Border.all( + color: Colors.red, + width: 2, + )), + child: Container( + height: 200, + width: 200, + ), + ), + DecoratedBox( + decoration: BoxDecoration( + shape: BoxShape.rectangle, + color: Colors.blue, + borderRadius: BorderRadius.circular(20), + border: Border.all( + color: Colors.red, + width: 2, + )), + child: Text('老孟,一个有态度的程序员'), + ), + SizedBox( + height: 10, + ), + DecoratedBox( + decoration: BoxDecoration( + shape: BoxShape.rectangle, + color: Colors.blue, + borderRadius: BorderRadius.circular(20), + ), + child: Text('老孟,一个有态度的程序员'), + ), + SizedBox( + height: 10, + ), + DecoratedBox( + decoration: + BoxDecoration(shape: BoxShape.rectangle, color: Colors.blue), + child: Text('老孟,一个有态度的程序员'), + ), + ], + ), + ); + + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: AppBar( + title: Text('ZhaoJian'), + ), + body: buildBody(), + // body: buildDataTable(), + ); + } +} diff --git a/flutter_helper/lib/widgets/a055decoratedboxtransition.dart b/flutter_helper/lib/widgets/a055decoratedboxtransition.dart new file mode 100644 index 00000000..b4bb9b43 --- /dev/null +++ b/flutter_helper/lib/widgets/a055decoratedboxtransition.dart @@ -0,0 +1,104 @@ +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; + +class DecoratedBoxTransitionApp extends StatelessWidget { + @override + Widget build(BuildContext context) { + return MaterialApp( + title: "Flutter DEMO APP", + theme: ThemeData( + primarySwatch: Colors.orange, + visualDensity: VisualDensity.adaptivePlatformDensity, + ), + home: _Test(), + ); + } +} + +class _Test extends StatefulWidget { + @override + State createState() { + return _TestState(); + } +} + +class _TestState extends State<_Test> with SingleTickerProviderStateMixin { + @override + void initState() { + super.initState(); + } + + @override + void dispose() { + super.dispose(); + } + + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: AppBar( + title: Text('ZhaoJian'), + ), + body: _AnimationDemo(), + // body: buildDataTable(), + ); + } +} + +class _AnimationDemo extends StatefulWidget { + @override + State createState() => _AnimationDemoState(); +} + +void test(BuildContext context) { + DefaultAssetBundle.of(context).loadString("images/beatiful_lady.jpeg"); +} + +class _AnimationDemoState extends State<_AnimationDemo> + with SingleTickerProviderStateMixin { + AnimationController _animationController; + Animation _animation; + + @override + void initState() { + _animationController = + AnimationController(duration: Duration(seconds: 2), vsync: this); + _animationController.addListener(() { + if (_animationController.status == AnimationStatus.completed) { + _animationController.reverse(); + } else if (_animationController.status == AnimationStatus.dismissed) { + _animationController.forward(); + } + }); + + _animation = DecorationTween( + begin: BoxDecoration( + color: Colors.red, + borderRadius: BorderRadius.circular(15), + ), + end: BoxDecoration( + color: Colors.blue, + borderRadius: BorderRadius.circular(55), + )).animate(_animationController); + + _animationController.forward(); + super.initState(); + } + + @override + void dispose() { + _animationController.dispose(); + super.dispose(); + } + + @override + Widget build(BuildContext context) { + return DecoratedBoxTransition( + decoration: _animation, + child: Container( + height: 100, + width: 100, + ), + ); + } +} diff --git a/flutter_helper/lib/widgets/a056_teststyle.dart b/flutter_helper/lib/widgets/a056_teststyle.dart new file mode 100644 index 00000000..6cc938db --- /dev/null +++ b/flutter_helper/lib/widgets/a056_teststyle.dart @@ -0,0 +1,146 @@ +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; + +class TextStyleApp extends StatelessWidget { + @override + Widget build(BuildContext context) { + return MaterialApp( + title: "Flutter DEMO APP", + theme: ThemeData( + primarySwatch: Colors.orange, + visualDensity: VisualDensity.adaptivePlatformDensity, + ), + home: _Test(), + ); + } +} + +class _Test extends StatefulWidget { + @override + State createState() { + return _TestState(); + } +} + +class _TestState extends State<_Test> with SingleTickerProviderStateMixin { + AnimationController _animationController; + Animation _animation; + + @override + void initState() { + _animationController = AnimationController( + duration: Duration(seconds: 2), + vsync: this, + )..addListener(() { + if (_animationController.status == AnimationStatus.completed) { + _animationController.reverse(); + } else if (_animationController.status == AnimationStatus.dismissed) { + _animationController.forward(); + } + }); + + _animation = TextStyleTween( + begin: TextStyle(color: Colors.blue, fontSize: 14), + end: TextStyle(color: Colors.red, fontSize: 24)) + .animate(_animationController); + + //开始动画 + _animationController.forward(); + super.initState(); + } + + @override + void dispose() { + _animationController.dispose(); + super.dispose(); + } + + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: AppBar( + title: Text('ZhaoJian'), + ), + body: Builder(builder: (context) { + return DefaultTextStyleTransition( + style: _animation, + child: + Text('赵健'), + ); + }), + // body: buildDataTable(), + ); + } + + buildBody() => Column( + children: [ + Builder(builder: (context) { + return DefaultTextStyleTransition( + style: _animation, + child: Text( + '11111111111111111111111111111111111111111111111111111111'), + ); + }), + Container( + width: 150, + color: Colors.red, + child: DefaultTextStyle( + style: TextStyle(fontSize: 18), + overflow: TextOverflow.clip, + child: Text( + '11111111111111111111111111111111111111111111111111111111'), + ), + ), + SizedBox( + height: 10, + ), + Container( + width: 150, + color: Colors.red, + child: DefaultTextStyle( + style: TextStyle(fontSize: 18), + overflow: TextOverflow.fade, + child: Text( + '11111111111111111111111111111111111111111111111111111111'), + ), + ), + SizedBox( + height: 10, + ), + Container( + width: 150, + color: Colors.red, + child: DefaultTextStyle( + style: TextStyle(fontSize: 18), + overflow: TextOverflow.visible, + child: Text( + '11111111111111111111111111111111111111111111111111111111'), + ), + ), + SizedBox( + height: 10, + ), + Container( + width: 150, + color: Colors.red, + child: DefaultTextStyle( + style: TextStyle(fontSize: 18), + overflow: TextOverflow.ellipsis, + child: Text( + '11111111111111111111111111111111111111111111111111111111'), + ), + ), + DefaultTextStyle( + style: TextStyle(color: Colors.red), + child: Text( + '老孟', + style: TextStyle(color: Colors.blue), + ), + ), + DefaultTextStyle( + style: TextStyle(color: Colors.red), + child: Text('老孟'), + ), + ], + ); +} diff --git a/flutter_helper/lib/widgets/a057_directionly.dart b/flutter_helper/lib/widgets/a057_directionly.dart new file mode 100644 index 00000000..5f86c496 --- /dev/null +++ b/flutter_helper/lib/widgets/a057_directionly.dart @@ -0,0 +1,150 @@ +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; + +class DirectionlyApp extends StatelessWidget { + @override + Widget build(BuildContext context) { + return MaterialApp( + title: "Flutter DEMO APP", + theme: ThemeData( + primarySwatch: Colors.orange, + visualDensity: VisualDensity.adaptivePlatformDensity, + ), + home: _Test(), + ); + } +} + +class _Test extends StatefulWidget { + @override + State createState() { + return _TestState(); + } +} + +class _TestState extends State<_Test> with SingleTickerProviderStateMixin { + AnimationController _animationController; + Animation _animation; + + @override + void initState() { + _animationController = AnimationController( + duration: Duration(seconds: 2), + vsync: this, + )..addListener(() { + if (_animationController.status == AnimationStatus.completed) { + _animationController.reverse(); + } else if (_animationController.status == AnimationStatus.dismissed) { + _animationController.forward(); + } + }); + + _animation = TextStyleTween( + begin: TextStyle(color: Colors.blue, fontSize: 14), + end: TextStyle(color: Colors.red, fontSize: 24)) + .animate(_animationController); + + //开始动画 + _animationController.forward(); + super.initState(); + } + + @override + void dispose() { + _animationController.dispose(); + super.dispose(); + } + + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: AppBar( + title: Text('ZhaoJian'), + ), + body: Builder(builder: (context) { + return Container( + height: 100, + width: 100, + color: Colors.red, + child: Directionality( + textDirection: TextDirection.rtl, + child: Text('老孟'), + ), + ); + }), + // body: buildDataTable(), + ); + } + + buildBody() => Column( + children: [ + Builder(builder: (context) { + return DefaultTextStyleTransition( + style: _animation, + child: Text( + '11111111111111111111111111111111111111111111111111111111'), + ); + }), + Container( + width: 150, + color: Colors.red, + child: DefaultTextStyle( + style: TextStyle(fontSize: 18), + overflow: TextOverflow.clip, + child: Text( + '11111111111111111111111111111111111111111111111111111111'), + ), + ), + SizedBox( + height: 10, + ), + Container( + width: 150, + color: Colors.red, + child: DefaultTextStyle( + style: TextStyle(fontSize: 18), + overflow: TextOverflow.fade, + child: Text( + '11111111111111111111111111111111111111111111111111111111'), + ), + ), + SizedBox( + height: 10, + ), + Container( + width: 150, + color: Colors.red, + child: DefaultTextStyle( + style: TextStyle(fontSize: 18), + overflow: TextOverflow.visible, + child: Text( + '11111111111111111111111111111111111111111111111111111111'), + ), + ), + SizedBox( + height: 10, + ), + Container( + width: 150, + color: Colors.red, + child: DefaultTextStyle( + style: TextStyle(fontSize: 18), + overflow: TextOverflow.ellipsis, + child: Text( + '11111111111111111111111111111111111111111111111111111111'), + ), + ), + DefaultTextStyle( + style: TextStyle(color: Colors.red), + child: Text( + '老孟', + style: TextStyle(color: Colors.blue), + ), + ), + DefaultTextStyle( + style: TextStyle(color: Colors.red), + child: Text('老孟'), + ), + ], + ); +} diff --git a/flutter_helper/lib/widgets/a058_widgets.dart b/flutter_helper/lib/widgets/a058_widgets.dart new file mode 100644 index 00000000..25753bdc --- /dev/null +++ b/flutter_helper/lib/widgets/a058_widgets.dart @@ -0,0 +1,258 @@ +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; + +class Widgets2App extends StatelessWidget { + @override + Widget build(BuildContext context) { + return MaterialApp( + title: "Flutter DEMO APP", + theme: ThemeData( + primarySwatch: Colors.orange, + visualDensity: VisualDensity.adaptivePlatformDensity, + ), + home: _Test(), + ); + } +} + +class _Test extends StatefulWidget { + @override + State createState() { + return _TestState(); + } +} + +class _TestState extends State<_Test> with SingleTickerProviderStateMixin { + @override + void initState() { + super.initState(); + } + + @override + void dispose() { + super.dispose(); + } + + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: AppBar( + title: Text('ZhaoJian'), + ), + body: Builder(builder: (context) { + return buildBody(); + }), + // body: buildDataTable(), + ); + } + + var _dragData; + + _buildDraggable() { + return Draggable( + data: Color(0x000000FF), + child: Container( + height: 100, + width: 100, + alignment: Alignment.center, + decoration: BoxDecoration( + color: Colors.red, + borderRadius: BorderRadius.circular(10), + ), + child: Text( + '梦', + style: TextStyle(color: Colors.white, fontSize: 18), + ), + ), + feedback: Container( + height: 100, + width: 100, + alignment: Alignment.center, + decoration: BoxDecoration( + color: Colors.blue, + borderRadius: BorderRadius.circular(10), + ), + child: DefaultTextStyle.merge( + child: Text('梦'), + style: TextStyle(color: Colors.white, fontSize: 18), + ), + ), + childWhenDragging: Container( + height: 100, + width: 100, + alignment: Alignment.center, + decoration: BoxDecoration( + color: Colors.grey, + borderRadius: BorderRadius.circular(10)), + child: Text( + '梦', + style: TextStyle(color: Colors.white, fontSize: 18), + ), + ), + ); + } + + buildBody() => SingleChildScrollView( + child: Column( + children: [ + _buildDraggable(), + SizedBox( + height: 100, + ), + DragTarget( + builder: (BuildContext context, List candidateData, + List rejectedData) { + print( + 'candidateData:$candidateData,rejectedData:$rejectedData'); + return _dragData == null + ? Container( + height: 100, + width: 100, + alignment: Alignment.center, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(10), + border: Border.all(color: Colors.red), + ), + ) + : Container( + height: 100, + width: 100, + alignment: Alignment.center, + decoration: BoxDecoration( + color: Colors.red, + borderRadius: BorderRadius.circular(10), + ), + child: Text('梦', + style: + TextStyle(color: Colors.white, fontSize: 18)), + ); + }, + onWillAccept: (Color color) { + print('onWillAccept:$color'); + return true; + }, + onAccept: (Color color) { + setState(() { + _dragData = color; + }); + print('onAccept:$color'); + }, + onLeave: (color) { + print('onLeave:$color'); + }, + ), + SizedBox( + height: 10, + ), + Draggable( + onDragStarted: () {}, + onDragEnd: (details) {}, + onDraggableCanceled: (velocity, offset) {}, + onDragCompleted: () {}, + // axis: Axis.vertical, //拖动的方向 + child: Container( + width: 100, + height: 100, + alignment: Alignment.center, + decoration: BoxDecoration( + color: Colors.red, + borderRadius: BorderRadius.circular(10), + ), + child: Text( + '梦', + style: TextStyle(color: Colors.white, fontSize: 18), + ), + ), + feedback: Container( + height: 100, + width: 100, + alignment: Alignment.center, + decoration: BoxDecoration( + color: Colors.blue, + borderRadius: BorderRadius.circular(10), + ), + child: Text( + '梦', + style: TextStyle(color: Colors.white, fontSize: 18), + ), + ), + childWhenDragging: Container( + height: 100, + width: 100, + alignment: Alignment.center, + decoration: BoxDecoration( + color: Colors.grey, + borderRadius: BorderRadius.circular(10)), + child: Text( + '梦', + style: TextStyle(color: Colors.white, fontSize: 18), + ), + ), + ), + SizedBox( + height: 10, + ), + Container( + height: 100, + color: Colors.green, + child: VerticalDivider( + width: 20, + thickness: 2, + color: Colors.blue, + indent: 10, + endIndent: 30, + ), + ), + SizedBox( + height: 10, + ), + SizedBox( + height: 10, + ), + Divider( + height: 10, + thickness: 5, + color: Colors.red, + indent: 10, + endIndent: 10, + ), + SizedBox( + height: 10, + ), + Dismissible( + crossAxisEndOffset: 0.5, + movementDuration: Duration(seconds: 3), + dismissThresholds: { + DismissDirection.endToStart: 0.8, + }, + resizeDuration: Duration(seconds: 2), + direction: DismissDirection.horizontal, + onResize: () { + print('onResize'); + }, + onDismissed: (direction) { + print('onDissed:$direction'); + }, + confirmDismiss: (DismissDirection direction) async { + return true; + }, + key: ValueKey('key2'), + child: Container( + height: 80, + color: Colors.red, + ), + ), + Dismissible( + confirmDismiss: (DismissDirection direction) async { + return false; + }, + key: ValueKey('key'), + child: Container( + height: 80, + color: Colors.red, + ), + ), + ], + ), + ); +} diff --git a/flutter_helper/lib/widgets/a059_draggablescrollableactuator.dart b/flutter_helper/lib/widgets/a059_draggablescrollableactuator.dart new file mode 100644 index 00000000..9c758f39 --- /dev/null +++ b/flutter_helper/lib/widgets/a059_draggablescrollableactuator.dart @@ -0,0 +1,76 @@ +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; + +class ScraaggableScrollableActuatorApp extends StatelessWidget { + @override + Widget build(BuildContext context) { + return MaterialApp( + title: "Flutter DEMO APP", + theme: ThemeData( + primarySwatch: Colors.orange, + visualDensity: VisualDensity.adaptivePlatformDensity, + ), + home: _Test(), + ); + } +} + +class _Test extends StatefulWidget { + @override + State createState() { + return _TestState(); + } +} + +class _TestState extends State<_Test> with SingleTickerProviderStateMixin { + @override + void initState() { + super.initState(); + } + + @override + void dispose() { + super.dispose(); + } + + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: AppBar( + title: Text('ZhaoJian'), + ), + body: Builder(builder: (context) { + return buildBody(); + }), + // body: buildDataTable(), + ); + } + + buildBody2() => SingleChildScrollView( + child: Column( + children: [], + ), + ); + + buildBody() => DraggableScrollableActuator( + child: DraggableScrollableSheet( + builder: (BuildContext context, ScrollController scrollController) { + return Container( + color: Colors.blue[100], + child: ListView.builder( + controller: scrollController, + itemCount: 100, + itemBuilder: (BuildContext context, int index) { + return ListTile( + title: Text('评论 $index'), + onTap: () { + DraggableScrollableActuator.reset(context); + }, + ); + }, + ), + ); + }, + ), + ); +} diff --git a/flutter_helper/lib/widgets/a059_draggablescrollablesheet.dart b/flutter_helper/lib/widgets/a059_draggablescrollablesheet.dart new file mode 100644 index 00000000..34d8e411 --- /dev/null +++ b/flutter_helper/lib/widgets/a059_draggablescrollablesheet.dart @@ -0,0 +1,172 @@ +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; + +class DraggableScrollableSheetApp extends StatelessWidget { + @override + Widget build(BuildContext context) { + print('${context.toString()}'); + return MaterialApp( + title: "Flutter DEMO APP", + theme: ThemeData( + primarySwatch: Colors.orange, + visualDensity: VisualDensity.adaptivePlatformDensity, + ), + home: _Test(), + ); + } +} + +class _Test extends StatefulWidget { + @override + State createState() { + return _TestState(); + } +} + +class _TestState extends State<_Test> with SingleTickerProviderStateMixin { + @override + void initState() { + super.initState(); + } + + @override + void dispose() { + super.dispose(); + } + + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: AppBar( + title: Text('ZhaoJian'), + ), + drawer: buildDrawer(), + body: Builder(builder: (context) { + return buildBody(); + }), + // body: buildDataTable(), + floatingActionButton: RaisedButton( + child: CircleAvatar( + child: Text('点'), + ), + onPressed: () { + Scaffold.of(context).openDrawer(); + }, + ), + ); + } + + var _color = Colors.blue.withOpacity(.1); + + buildDrawer() => Drawer( + child: ListView( + children: [ + DrawerHeader( + decoration: BoxDecoration(color: _color), + duration: Duration(seconds: 1), + child: Row( + children: [ + CircleAvatar( + child: Text('梦'), + ), + SizedBox( + width: 10, + ), + ActionChip( + label: Text('老孟33333'), + onPressed: () { + setState(() { + _color = Colors.red.withOpacity(.5); + }); + }, + ), + ], + ), + ), + // ListTile(), + // ListTile(), + // ListTile(), + // ListTile(), + // ListTile(), + ], + ), + ); + + buildBody() => DraggableScrollableSheet( + initialChildSize: 0.4, + minChildSize: 0.4, + maxChildSize: 1, + expand: true, + builder: (BuildContext context, ScrollController scrollController) { + return Container( + color: Colors.blue[100], + child: ListView.builder( + controller: scrollController, + itemCount: 100, + itemBuilder: (BuildContext context, int index) { + return ListTile( + title: Text('xx评论 $index'), + onTap: () { + Navigator.of(context) + .push(CupertinoPageRoute(builder: (context) { + return _SecondPage(); + })); + print('${this.toStringShort()}'); + }, + ); + }), + ); + }); +} + +class _SecondPage extends StatelessWidget { + @override + Widget build(BuildContext context) { + var stack = Stack( + children: [ + Column( + children: [ + Image.network( + 'https://flutter.github' + '.io/assets-for-api-docs/assets/widgets/owl-2.jpg', + height: 200, + ), + Container( + height: 200, + color: Colors.grey, + alignment: Alignment.center, + child: Text('电影介绍'), + ) + ], + ), + Positioned.fill( + child: DraggableScrollableSheet( + expand: false, + initialChildSize: 0.4, + minChildSize: 0.4, + maxChildSize: 1, + builder: (BuildContext context, ScrollController scrollController) { + return Container( + color: Colors.blue[100], + child: ListView.builder( + controller: scrollController, + itemCount: 100, + itemBuilder: (BuildContext context, int index) { + return ListTile( + title: Text('评评论 $index'), + ); + }), + ); + }, + )) + ], + ); + + return Scaffold( + appBar: AppBar( + title: Text('SecondPage'), + ), + body: stack, + ); + } +} diff --git a/flutter_helper/lib/widgets/a060_dropdownbuttonfromfield.dart b/flutter_helper/lib/widgets/a060_dropdownbuttonfromfield.dart new file mode 100644 index 00000000..a7ef8fb1 --- /dev/null +++ b/flutter_helper/lib/widgets/a060_dropdownbuttonfromfield.dart @@ -0,0 +1,137 @@ +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; + +class DropdownButtonFromFieldApp extends StatelessWidget { + @override + Widget build(BuildContext context) { + print('${context.toString()}'); + return MaterialApp( + title: "Flutter DEMO APP", + theme: ThemeData( + primarySwatch: Colors.orange, + visualDensity: VisualDensity.adaptivePlatformDensity, + ), + home: _Test(), + ); + } +} + +class _Test extends StatefulWidget { + @override + State createState() { + return _TestState(); + } +} + +class _TestState extends State<_Test> with SingleTickerProviderStateMixin { + @override + void initState() { + super.initState(); + } + + @override + void dispose() { + super.dispose(); + } + + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: AppBar( + title: Text('ZhaoJian'), + ), + body: Builder(builder: (context) { + return buildBody(); + }), + // body: buildDataTable(), + floatingActionButton: RaisedButton( + child: CircleAvatar( + child: Text('点'), + ), + onPressed: () { + Scaffold.of(context).openDrawer(); + }, + ), + ); + } + + var _color = Colors.blue.withOpacity(.1); + + String _value = null; + + // buildBody() => DropdownButtonHideUnderline(child: DropdownButton()); + + buildBody() => DropdownButtonFormField( + hint: Text('请选择'), + value: _value, + items: [ + DropdownMenuItem(child: Text('语文'), value: '语文'), + DropdownMenuItem(child: Text('数学'), value: '数学'), + DropdownMenuItem(child: Text('英语'), value: '英语') + ], + selectedItemBuilder: (context) { + return [ + OutlineButton(onPressed: () {}, child: Text('语文')), + OutlineButton(onPressed: () {}, child: Text('数学')), + OutlineButton(onPressed: () {}, child: Text('英语')), + ]; + }, + onChanged: (String value) { + setState(() { + _value = value; + }); + }, + ); +} + +class _SecondPage extends StatelessWidget { + @override + Widget build(BuildContext context) { + var stack = Stack( + children: [ + Column( + children: [ + Image.network( + 'https://flutter.github' + '.io/assets-for-api-docs/assets/widgets/owl-2.jpg', + height: 200, + ), + Container( + height: 200, + color: Colors.grey, + alignment: Alignment.center, + child: Text('电影介绍'), + ) + ], + ), + Positioned.fill( + child: DraggableScrollableSheet( + expand: false, + initialChildSize: 0.4, + minChildSize: 0.4, + maxChildSize: 1, + builder: (BuildContext context, ScrollController scrollController) { + return Container( + color: Colors.blue[100], + child: ListView.builder( + controller: scrollController, + itemCount: 100, + itemBuilder: (BuildContext context, int index) { + return ListTile( + title: Text('评评论 $index'), + ); + }), + ); + }, + )) + ], + ); + + return Scaffold( + appBar: AppBar( + title: Text('SecondPage'), + ), + body: stack, + ); + } +} diff --git a/flutter_helper/lib/widgets/a061_expansiontile.dart b/flutter_helper/lib/widgets/a061_expansiontile.dart new file mode 100644 index 00000000..ee5710bf --- /dev/null +++ b/flutter_helper/lib/widgets/a061_expansiontile.dart @@ -0,0 +1,156 @@ +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; + +class FlexiableApp extends StatelessWidget { + @override + Widget build(BuildContext context) { + print('${context.toString()}'); + return MaterialApp( + title: "Flutter DEMO APP", + theme: ThemeData( + primarySwatch: Colors.orange, + visualDensity: VisualDensity.adaptivePlatformDensity, + ), + home: _Test(), + ); + } +} + +class _Test extends StatefulWidget { + @override + State createState() { + return _TestState(); + } +} + +class _TestState extends State<_Test> with SingleTickerProviderStateMixin { + @override + void initState() { + super.initState(); + } + + @override + void dispose() { + super.dispose(); + } + + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: AppBar( + title: Text('ZhaoJian'), + ), + body: Builder(builder: (context) { + return buildBody(); + }), + // body: buildDataTable(), + floatingActionButton: RaisedButton( + child: CircleAvatar( + child: Text('点'), + ), + onPressed: () { + Scaffold.of(context).openDrawer(); + }, + ), + ); + } + + var _color = Colors.blue.withOpacity(.1); + + String _value = null; + + // buildBody() => DropdownButtonHideUnderline(child: DropdownButton()); + + bool _expanded = false; + + List dataList = List.generate(20, (index) => false).toList(); + + _buildExpansionPanelList() { + return SingleChildScrollView( + child: Container( + child: ExpansionPanelList( + expansionCallback: (index, isExpaned) { + setState(() { + dataList[index] = !isExpaned; + }); + }, + children: dataList + .map((value) => ExpansionPanel( + isExpanded: value, + headerBuilder: (context, isExpanded) { + return ListTile( + title: Text('老孟 $isExpanded'), + ); + }, + body: Container( + height: 100, + color: Colors.greenAccent, + child: Text('HelloWorl!'), + ), + )) + .toList(), + ), + ), + ); + } + + buildBody() => SingleChildScrollView( + child: Column( + children: [ + Row( + children: [ + Container( + color: Colors.blue, + height: 50, + width: 50, + child: ExpandIcon( + isExpanded: _expanded, + onPressed: (value) { + setState(() { + _expanded = !_expanded; + }); + }), + ), + Container( + color: Colors.blue, + height: 50, + width: 50, + child: ExpandIcon( + size: 48, + color: Colors.red, + isExpanded: _expanded, + onPressed: (value) { + setState(() { + _expanded = !_expanded; + }); + }), + ), + Flexible( + child: Container( + color: Colors.red, + height: 50, + ), + ), + Container( + color: Colors.blue, + height: 50, + width: 100, + child: ExpandIcon( + disabledColor: Colors.green, + expandedColor: Colors.red, + color: Colors.yellow, + onPressed: (value) { + setState(() { + _expanded = !_expanded; + }); + }, + isExpanded: _expanded, + ), + ), + ], + ), + _buildExpansionPanelList(), + ], + ), + ); +} diff --git a/flutter_helper/lib/widgets/a062_flexiable.dart b/flutter_helper/lib/widgets/a062_flexiable.dart new file mode 100644 index 00000000..45eae6b6 --- /dev/null +++ b/flutter_helper/lib/widgets/a062_flexiable.dart @@ -0,0 +1,130 @@ +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; + +class ExpansionTileApp extends StatelessWidget { + @override + Widget build(BuildContext context) { + print('${context.toString()}'); + return MaterialApp( + title: "Flutter DEMO APP", + theme: ThemeData( + primarySwatch: Colors.orange, + visualDensity: VisualDensity.adaptivePlatformDensity, + ), + home: _Test(), + ); + } +} + +class _Test extends StatefulWidget { + @override + State createState() { + return _TestState(); + } +} + +class _TestState extends State<_Test> with SingleTickerProviderStateMixin { + @override + void initState() { + super.initState(); + } + + @override + void dispose() { + super.dispose(); + } + + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: AppBar( + title: Text('ZhaoJian'), + ), + body: Builder(builder: (context) { + return buildBody(); + }), + // body: buildDataTable(), + floatingActionButton: RaisedButton( + child: CircleAvatar( + child: Text('点'), + ), + onPressed: () { + Scaffold.of(context).openDrawer(); + }, + ), + ); + } + + var _color = Colors.blue.withOpacity(.1); + + String _value = null; + + // buildBody() => DropdownButtonHideUnderline(child: DropdownButton()); + + bool _expanded = false; + + List dataList = List.generate(20, (index) => false).toList(); + + _buildExpansionPanelList() { + return SingleChildScrollView( + child: Container( + child: ExpansionPanelList( + expansionCallback: (index, isExpaned) { + setState(() { + dataList[index] = !isExpaned; + }); + }, + children: dataList + .map((value) => ExpansionPanel( + isExpanded: value, + headerBuilder: (context, isExpanded) { + return ListTile( + title: Text('老孟 $isExpanded'), + ); + }, + body: Container( + height: 100, + color: Colors.greenAccent, + child: Text('HelloWorl!'), + ), + )) + .toList(), + ), + ), + ); + } + + _buildExpansionTile() => ExpansionTile( + title: Text('学科'), + children: [ + Text('英语'), + Text('数学'), + Text('语文'), + ], + ); + + _buildExpansionTile2() => ExpansionTile( + leading: Icon(Icons.home), + subtitle: Text('各种学科'), + backgroundColor: Colors.greenAccent, + initiallyExpanded: true, + title: Text('学科'), + onExpansionChanged: (bool value) { + print('onChanged!'); + }, + children: [ + Text('英语'), + Text('数学'), + Text('语文'), + ], + ); + + buildBody() => SingleChildScrollView( + child: Column( + children: [ + _buildExpansionTile(), + _buildExpansionTile2(), + ], + ), + ); +} diff --git a/flutter_helper/lib/widgets/a063_fadetransition.dart b/flutter_helper/lib/widgets/a063_fadetransition.dart new file mode 100644 index 00000000..b161dd92 --- /dev/null +++ b/flutter_helper/lib/widgets/a063_fadetransition.dart @@ -0,0 +1,84 @@ +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; + +class FadeTransitionApp extends StatelessWidget { + @override + Widget build(BuildContext context) { + print('${context.toString()}'); + return MaterialApp( + title: "Flutter DEMO APP", + theme: ThemeData( + primarySwatch: Colors.orange, + visualDensity: VisualDensity.adaptivePlatformDensity, + ), + home: _Test(), + ); + } +} + +class _Test extends StatefulWidget { + @override + State createState() { + return _TestState(); + } +} + +class _TestState extends State<_Test> with SingleTickerProviderStateMixin { + Animation animation; + AnimationController controller; + + @override + void initState() { + controller = + AnimationController(vsync: this, duration: Duration(seconds: 1)) + ..repeat(); + animation = Tween(begin: 0.0, end: 1.0).animate(controller); + controller.forward(); + + super.initState(); + } + + @override + void dispose() { + controller.dispose(); + super.dispose(); + } + + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: AppBar( + title: Text('ZhaoJian'), + ), + body: Builder(builder: (context) { + return buildBody(); + }), + // body: buildDataTable(), + floatingActionButton: RaisedButton( + child: CircleAvatar( + child: Text('点'), + ), + onPressed: () { + if (controller.status == AnimationStatus.completed) { + controller.reverse(); + } else if (controller.status == AnimationStatus.dismissed) { + controller.forward(); + } + }, + ), + ); + } + + List dataList = List.generate(20, (index) => false).toList(); + + buildBody() => Center( + child: FadeTransition( + opacity: animation, + child: Container( + color: Colors.red, + width: 100, + height: 100, + ), + ), + ); +} diff --git a/flutter_helper/lib/widgets/a064_dialog.dart b/flutter_helper/lib/widgets/a064_dialog.dart new file mode 100644 index 00000000..95087ea6 --- /dev/null +++ b/flutter_helper/lib/widgets/a064_dialog.dart @@ -0,0 +1,227 @@ +import 'dart:math'; + +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; + +class DialogsApp extends StatelessWidget { + @override + Widget build(BuildContext context) { + print('${context.toString()}'); + return MaterialApp( + title: "Flutter DEMO APP", + // localizationsDelegates: [ + // GlobalMaterialLocalizations.delegate, + // GlobalMaterialLocalizations.delegate, + // ], + // supportedLocales: [ + // const Locale('zh', 'CH'), + // const Locale('en', 'US'), + // ], + locale: Locale('zh'), + theme: ThemeData( + primarySwatch: Colors.orange, + visualDensity: VisualDensity.adaptivePlatformDensity, + ), + home: _Test(), + ); + } +} + +class _Test extends StatefulWidget { + @override + State createState() { + return _TestState(); + } +} + +class _TestState extends State<_Test> with SingleTickerProviderStateMixin { + Animation animation; + AnimationController controller; + + @override + void initState() { + controller = + AnimationController(vsync: this, duration: Duration(seconds: 1)) + ..repeat(); + animation = Tween(begin: 0.0, end: 1.0).animate(controller); + controller.forward(); + + super.initState(); + } + + @override + void dispose() { + controller.dispose(); + super.dispose(); + } + + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: AppBar( + title: Text('ZhaoJian'), + ), + body: Builder(builder: (context) { + return buildBody(); + }), + // body: buildDataTable(), + floatingActionButton: RaisedButton( + child: CircleAvatar( + child: Text('点'), + ), + onPressed: () { + showBottomSheet( + context: context, + backgroundColor: Colors.lightGreenAccent, + elevation: 20, + shape: CircleBorder(), + builder: (context) { + return Container( + height: 200, + color: Colors.lightBlue, + ); + }, + ); + }, + ), + ); + } + + List dataList = List.generate(20, (index) => false).toList(); + + buildBody() => SingleChildScrollView( + child: Column( + children: [ + RaisedButton(onPressed: () { + showGeneralDialog( + context: context, + barrierDismissible: true, + barrierLabel: '', + transitionDuration: Duration(milliseconds: 200), + pageBuilder: (BuildContext context, + Animation animation, + Animation secondaryAnimation) { + return Center( + child: Container( + height: 300, + width: 250, + color: Colors.lightGreenAccent, + ), + ); + }, + transitionBuilder: (BuildContext context, + Animation animation, + Animation secodaryAnimation, + Widget child) { + return ScaleTransition( + scale: animation, + child: child, + ); + }); + }), + RaisedButton(onPressed: () { + showAboutDialog( + context: context, + applicationIcon: Image.asset( + 'images/bird.png', + width: 100, + height: 100, + ), + applicationName: '应用程序', + applicationVersion: '1.0.0', + applicationLegalese: 'copyright 老孟,一枚有态度的程序员', + children: [ + Container( + height: 30, + color: Colors.red, + ), + Container( + height: 30, + color: Colors.blue, + ), + Container( + height: 30, + color: Colors.green, + ) + ]); + }), + RaisedButton(onPressed: () { + showMenu( + initialValue: PopupMenuItem(child: Text('语文')), + context: context, + position: RelativeRect.fill, + items: [ + PopupMenuItem(child: Text('语文')), + PopupMenuDivider(), + CheckedPopupMenuItem( + child: Text('数学'), + checked: true, + ), + PopupMenuDivider(), + PopupMenuItem(child: Text('英语')), + ]); + }), + RaisedButton(onPressed: () { + showSearch(context: context, delegate: CustomSearchDelegate()); + }), + RaisedButton(onPressed: () {}), + ], + ), + ); +} + +class CustomSearchDelegate extends SearchDelegate { + @override + List buildActions(BuildContext context) { + return null; + } + + @override + Widget buildLeading(BuildContext context) { + return IconButton( + icon: Icon(Icons.arrow_back,color: Colors.blue,), + onPressed: (){ + close(context, ''); + }, + ); + } + @override + Widget buildResults(BuildContext context) { + return ListView.separated( + itemBuilder: (context, index) { + return Container( + height: 60, + alignment: Alignment.center, + child: Text( + '$index', + style: TextStyle(fontSize: 20), + ), + ); + }, + separatorBuilder: (context, index) { + return Divider(); + }, + itemCount: 10, + ); + } + + + @override + Widget buildSuggestions(BuildContext context) { + return ListView.separated( + itemBuilder: (context, index) { + return ListTile( + title: Text('老孟 $index'), + onTap: () { + query = '老孟 $index'; + }, + ); + }, + separatorBuilder: (context, index) { + return Divider(); + }, + itemCount: Random().nextInt(5), + ); + } + +} diff --git a/flutter_helper/lib/widgets/a065_wrap.dart b/flutter_helper/lib/widgets/a065_wrap.dart new file mode 100644 index 00000000..301e1a5b --- /dev/null +++ b/flutter_helper/lib/widgets/a065_wrap.dart @@ -0,0 +1,183 @@ +import 'dart:math'; + +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; + +class WrapApp extends StatelessWidget { + @override + Widget build(BuildContext context) { + print('${context.toString()}'); + return MaterialApp( + title: "Flutter DEMO APP", + // localizationsDelegates: [ + // GlobalMaterialLocalizations.delegate, + // GlobalMaterialLocalizations.delegate, + // ], + // supportedLocales: [ + // const Locale('zh', 'CH'), + // const Locale('en', 'US'), + // ], + locale: Locale('zh'), + theme: ThemeData( + primarySwatch: Colors.orange, + visualDensity: VisualDensity.adaptivePlatformDensity, + ), + home: _Test(), + ); + } +} + +class _Test extends StatefulWidget { + @override + State createState() { + return _TestState(); + } +} + +class _TestState extends State<_Test> with SingleTickerProviderStateMixin { + Animation animation; + AnimationController controller; + + @override + void initState() { + controller = + AnimationController(vsync: this, duration: Duration(seconds: 1)) + ..repeat(); + animation = Tween(begin: 0.0, end: 1.0).animate(controller); + controller.forward(); + + super.initState(); + } + + @override + void dispose() { + controller.dispose(); + super.dispose(); + } + + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: AppBar( + title: Text('ZhaoJian'), + ), + body: Builder(builder: (context) { + return buildBody(); + }), + // body: buildDataTable(), + floatingActionButton: RaisedButton( + child: CircleAvatar( + child: Text('点'), + ), + onPressed: () { + showBottomSheet( + context: context, + backgroundColor: Colors.lightGreenAccent, + elevation: 20, + shape: CircleBorder(), + builder: (context) { + return Container( + height: 200, + color: Colors.lightBlue, + ); + }, + ); + }, + ), + ); + } + + List dataList = List.generate(20, (index) => false).toList(); + + buildBody() => SingleChildScrollView( + child: Column( + children: [ + Wrap( + children: List.generate(10, (i) { + double w = 50.0 + 10 * i; + return Container( + color: Colors.primaries[i], + height: 50, + width: w, + child: Text('$i'), + ); + }), + ), + Wrap( + spacing: 5, + runSpacing: 3, + crossAxisAlignment: WrapCrossAlignment.center, + children: List.generate(10, (i) { + double w = 50.0 + 10 * i; + double h = 50.0 + 5 * i; + return Container( + color: Colors.primaries[i], + height: h, + alignment: Alignment.center, + width: w, + child: Text('$i'), + ); + }), + ) + ], + ), + ); +} + +class CustomSearchDelegate extends SearchDelegate { + @override + List buildActions(BuildContext context) { + return null; + } + + @override + Widget buildLeading(BuildContext context) { + return IconButton( + icon: Icon( + Icons.arrow_back, + color: Colors.blue, + ), + onPressed: () { + close(context, ''); + }, + ); + } + + @override + Widget buildResults(BuildContext context) { + return ListView.separated( + itemBuilder: (context, index) { + return Container( + height: 60, + alignment: Alignment.center, + child: Text( + '$index', + style: TextStyle(fontSize: 20), + ), + ); + }, + separatorBuilder: (context, index) { + return Divider(); + }, + itemCount: 10, + ); + } + + @override + Widget buildSuggestions(BuildContext context) { + return ListView.separated( + itemBuilder: (context, index) { + return ListTile( + title: Text('老孟 $index'), + onTap: () { + query = '老孟 $index'; + }, + ); + }, + separatorBuilder: (context, index) { + return Divider(); + }, + itemCount: Random().nextInt(5), + ); + } +} diff --git a/flutter_helper/lib/widgets/a066_fittedbox.dart b/flutter_helper/lib/widgets/a066_fittedbox.dart new file mode 100644 index 00000000..3f65d1de --- /dev/null +++ b/flutter_helper/lib/widgets/a066_fittedbox.dart @@ -0,0 +1,104 @@ +import 'dart:math'; + +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; + +class FittedBoxApp extends StatelessWidget { + @override + Widget build(BuildContext context) { + print('${context.toString()}'); + return MaterialApp( + title: "Flutter DEMO APP", + // localizationsDelegates: [ + // GlobalMaterialLocalizations.delegate, + // GlobalMaterialLocalizations.delegate, + // ], + // supportedLocales: [ + // const Locale('zh', 'CH'), + // const Locale('en', 'US'), + // ], + locale: Locale('zh'), + theme: ThemeData( + primarySwatch: Colors.orange, + visualDensity: VisualDensity.adaptivePlatformDensity, + ), + home: _Test(), + ); + } +} + +class _Test extends StatefulWidget { + @override + State createState() { + return _TestState(); + } +} + +class _TestState extends State<_Test> with SingleTickerProviderStateMixin { + Animation animation; + AnimationController controller; + + @override + void initState() { + controller = + AnimationController(vsync: this, duration: Duration(seconds: 1)) + ..repeat(); + animation = Tween(begin: 0.0, end: 1.0).animate(controller); + controller.forward(); + + super.initState(); + } + + @override + void dispose() { + controller.dispose(); + super.dispose(); + } + + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: AppBar( + title: Text('ZhaoJian'), + ), + body: Builder(builder: (context) { + return buildBody(); + }), + // body: buildDataTable(), + floatingActionButton: RaisedButton( + child: CircleAvatar( + child: Text('点'), + ), + onPressed: () { + showBottomSheet( + context: context, + backgroundColor: Colors.lightGreenAccent, + elevation: 20, + shape: CircleBorder(), + builder: (context) { + return Container( + height: 200, + color: Colors.lightBlue, + ); + }, + ); + }, + ), + ); + } + + List dataList = List.generate(20, (index) => false).toList(); + + buildBody() => Container( + height: 300, + width: 200, + color: Colors.green, + child: FittedBox( + child: Container( + height: 80, + width: 80, + color: Colors.red, + ), + ), + ); +} \ No newline at end of file diff --git a/flutter_helper/lib/widgets/a067_flexible.dart b/flutter_helper/lib/widgets/a067_flexible.dart new file mode 100644 index 00000000..e653ed6c --- /dev/null +++ b/flutter_helper/lib/widgets/a067_flexible.dart @@ -0,0 +1,202 @@ +import 'dart:math'; + +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; + +class FlexibleApp extends StatelessWidget { + @override + Widget build(BuildContext context) { + print('${context.toString()}'); + return MaterialApp( + title: "Flutter DEMO APP", + locale: Locale('zh'), + theme: ThemeData( + primarySwatch: Colors.orange, + visualDensity: VisualDensity.adaptivePlatformDensity, + ), + home: _Test(), + ); + } +} + +class _Test extends StatefulWidget { + @override + State createState() { + return _TestState(); + } +} + +class _TestState extends State<_Test> with SingleTickerProviderStateMixin { + @override + void initState() { + super.initState(); + } + + @override + void dispose() { + super.dispose(); + } + + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: AppBar( + title: Text('ZhaoJian'), + ), + body: Builder(builder: (context) { + return buildBody(); + }), + // body: buildDataTable(), + floatingActionButton: RaisedButton( + child: CircleAvatar( + child: Text('点'), + ), + onPressed: () { + showBottomSheet( + context: context, + backgroundColor: Colors.lightGreenAccent, + elevation: 20, + shape: CircleBorder(), + builder: (context) { + return Container( + height: 200, + color: Colors.lightBlue, + ); + }, + ); + }, + ), + ); + } + + List dataList = List.generate(20, (index) => false).toList(); + + buildBody() => Column( + children: [ + Row( + children: [ + Container( + width: 100, + height: 50, + color: Colors.green, + ), + Spacer( + flex: 2, + ), + Container( + width: 100, + height: 50, + color: Colors.blue, + ), + Spacer(), + Container( + width: 100, + height: 50, + color: Colors.green, + ), + ], + ), + Row( + children: [ + Container( + color: Colors.blue, + height: 50, + width: 50, + ), + Expanded( + child: OutlineButton( + child: Text('OutlineButton'), + ), + ), + Container( + color: Colors.blue, + height: 50, + width: 50, + ), + ], + ), + Row( + children: [ + Container( + color: Colors.blue, + height: 50, + width: 50, + ), + Flexible( + fit: FlexFit.loose, + child: OutlineButton( + child: Text('OutlineButton'), + ), + ), + Container( + color: Colors.blue, + height: 50, + width: 50, + ), + ], + ), + Row( + children: [ + Container( + color: Colors.blue, + height: 50, + width: 50, + ), + Flexible( + fit: FlexFit.loose, + child: Container( + color: Colors.red, + height: 50, + alignment: Alignment.center, + child: Text( + 'Container', + style: TextStyle(color: Colors.white), + ), + ), + ), + Container( + color: Colors.blue, + height: 50, + width: 50, + ), + ], + ), + SizedBox( + height: 4, + ), + Flexible( + flex: 1, + child: Container( + color: Colors.blue, + alignment: Alignment.center, + child: Text( + '1 Flex / 6 Total', + style: TextStyle(color: Colors.white), + ), + ), + ), + Flexible( + flex: 2, + child: Container( + color: Colors.red, + alignment: Alignment.center, + child: Text( + '1 Flex / 6 Total', + style: TextStyle(color: Colors.white), + ), + ), + ), + Flexible( + flex: 3, + child: Container( + color: Colors.green, + alignment: Alignment.center, + child: Text( + '1 Flex / 6 Total', + style: TextStyle(color: Colors.white), + ), + ), + ), + ], + ); +} diff --git a/flutter_helper/lib/widgets/a068_flexiblespacebar.dart b/flutter_helper/lib/widgets/a068_flexiblespacebar.dart new file mode 100644 index 00000000..3fbe246d --- /dev/null +++ b/flutter_helper/lib/widgets/a068_flexiblespacebar.dart @@ -0,0 +1,99 @@ +import 'dart:math'; + +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; + +class FlexibleSpaceBarApp extends StatelessWidget { + @override + Widget build(BuildContext context) { + print('${context.toString()}'); + return MaterialApp( + title: "Flutter DEMO APP", + locale: Locale('zh'), + theme: ThemeData( + primarySwatch: Colors.orange, + visualDensity: VisualDensity.adaptivePlatformDensity, + ), + home: _Test(), + ); + } +} + +class _Test extends StatefulWidget { + @override + State createState() { + return _TestState(); + } +} + +class _TestState extends State<_Test> with SingleTickerProviderStateMixin { + @override + void initState() { + super.initState(); + } + + @override + void dispose() { + super.dispose(); + } + + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: AppBar( + title: Text('ZhaoJian'), + ), + body: Builder(builder: (context) { + return buildBody(); + }), + // body: buildDataTable(), + floatingActionButton: RaisedButton( + child: CircleAvatar( + child: Text('点'), + ), + onPressed: () { + showBottomSheet( + context: context, + backgroundColor: Colors.lightGreenAccent, + elevation: 20, + shape: CircleBorder(), + builder: (context) { + return Container( + height: 200, + color: Colors.lightBlue, + ); + }, + ); + }, + ), + ); + } + + List dataList = List.generate(20, (index) => false).toList(); + + buildBody() => CustomScrollView( + slivers: [ + SliverAppBar( + pinned: true, + expandedHeight: 200.0, + stretch: true, + flexibleSpace: FlexibleSpaceBar( + stretchModes: [StretchMode.zoomBackground,StretchMode.blurBackground], + title: Text('复仇者联盟'), + background: Image.network( + 'http://img.haote.com/upload/20180918/2018091815372344164.jpg', + fit: BoxFit.fitHeight, + ), + ), + ), + SliverList( + delegate: SliverChildBuilderDelegate((context, index) { + return Container( + height: 65, + color: Colors.primaries[index % Colors.primaries.length], + ); + }, childCount: 50), + ), + ], + ); +} diff --git a/flutter_helper/lib/widgets/a069_flow.dart b/flutter_helper/lib/widgets/a069_flow.dart new file mode 100644 index 00000000..a1dc2aa6 --- /dev/null +++ b/flutter_helper/lib/widgets/a069_flow.dart @@ -0,0 +1,407 @@ +import 'dart:math'; + +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; + +class FlowApp extends StatelessWidget { + @override + Widget build(BuildContext context) { + print('${context.toString()}'); + return MaterialApp( + title: "Flutter DEMO APP", + locale: Locale('zh'), + theme: ThemeData( + primarySwatch: Colors.orange, + visualDensity: VisualDensity.adaptivePlatformDensity, + ), + home: _Test(), + ); + } +} + +class _Test extends StatefulWidget { + @override + State createState() { + return _TestState(); + } +} + +class _TestState extends State<_Test> with SingleTickerProviderStateMixin { + @override + void initState() { + super.initState(); + } + + @override + void dispose() { + super.dispose(); + } + + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: AppBar( + title: Text('ZhaoJian'), + ), + body: Builder(builder: (context) { + return buildBody(); + }), + // body: buildDataTable(), + floatingActionButton: RaisedButton( + child: CircleAvatar( + child: Text('点'), + ), + onPressed: () { + showBottomSheet( + context: context, + backgroundColor: Colors.lightGreenAccent, + elevation: 20, + shape: CircleBorder(), + builder: (context) { + return Container( + height: 200, + color: Colors.lightBlue, + ); + }, + ); + }, + ), + ); + } + + List dataList = List.generate(20, (index) => false).toList(); + + buildBody() => CustomScrollView( + slivers: [ + SliverAppBar( + pinned: true, + expandedHeight: 200.0, + stretch: true, + flexibleSpace: FlexibleSpaceBar( + stretchModes: [ + StretchMode.zoomBackground, + StretchMode.blurBackground + ], + title: Text('复仇者联盟'), + background: Image.network( + 'http://img.haote.com/upload/20180918/2018091815372344164.jpg', + fit: BoxFit.fitHeight, + ), + ), + ), + SliverList( + delegate: SliverChildBuilderDelegate((context, index) { + return Container( + height: 65, + color: Colors.primaries[index % Colors.primaries.length], + ); + }, childCount: 50), + ), + ], + ); +} + +class DemoFlowPopMenuApp extends StatelessWidget { + @override + Widget build(BuildContext context) { + return MaterialApp( + home: DemoFlowPopMenu(), + ); + } +} + +class DemoFlowPopMenu extends StatefulWidget { + @override + State createState() => _DemoFlowPopMenuState(); +} + +class _DemoFlowPopMenuState extends State + with SingleTickerProviderStateMixin { + // 动画必须要with这个类 + AnimationController _ctrlAnimationPopMenu; //自定义动画的变量 + IconData lastTapped = Icons.notifications; + final List menuItems = [ + //菜单的icon + Icons.home, + Icons.new_releases, + Icons.notifications, + Icons.settings, + Icons.menu, + ]; + + void _updateMenu(IconData icon) { + if (icon != Icons.menu) { + setState(() { + lastTapped = icon; + }); + } else { + if (_ctrlAnimationPopMenu.status == AnimationStatus.completed) { + _ctrlAnimationPopMenu.reverse(); + } else { + _ctrlAnimationPopMenu.forward(); + } + } + } + + @override + void initState() { + _ctrlAnimationPopMenu = AnimationController( + //必须初始化动画变量 + duration: const Duration(milliseconds: 250), + vsync: this, + ); + super.initState(); + } + + // 生成Popmenu数据 + Widget flowMenuItem(IconData icon) { + final double buttonDiameter = + MediaQuery.of(context).size.width * 2 / (menuItems.length * 3); + return Padding( + padding: const EdgeInsets.symmetric(vertical: 8.0), + child: RawMaterialButton( + fillColor: lastTapped == icon ? Colors.amber[700] : Colors.blue, + splashColor: Colors.amber[100], + shape: CircleBorder(), + constraints: BoxConstraints.tight(Size(buttonDiameter, buttonDiameter)), + onPressed: () { + _updateMenu(icon); + }, + child: Icon( + icon, + color: Colors.white, + size: 30.0, + ), + ), + ); + } + + @override + Widget build(BuildContext context) { + return Center( + child: Flow( + delegate: FlowMenuDelegate(animation: _ctrlAnimationPopMenu), + children: menuItems.map((e) => flowMenuItem(e)).toList(), + ), + ); + } +} + +class FlowMenuDelegate extends FlowDelegate { + final Animation animation; + + FlowMenuDelegate({this.animation}) : super(repaint: animation); + + @override + void paintChildren(FlowPaintingContext context) { + double x = 50.0; + double y = 50.0; + for (int i = 0; i < context.childCount; i++) { + x = context.getChildSize(i).width * i * animation.value; + context.paintChild(i, transform: Matrix4.translationValues(x, y, 0)); + } + } + + @override + bool shouldRepaint(covariant FlowMenuDelegate oldDelegate) { + return animation != oldDelegate.animation; + } +} + +class DemoFlowCircelApp extends StatelessWidget { + @override + Widget build(BuildContext context) { + return MaterialApp( + home: DemoFlowCircle(), + ); + } +} + +class DemoFlowCircle extends StatefulWidget { + @override + _DemoFlowCircleState createState() => _DemoFlowCircleState(); +} + +class _DemoFlowCircleState extends State + with TickerProviderStateMixin { + //动画需要这个类来混合 + //动画变量,以及初始化和销毁 + AnimationController _ctrlAnimationCircle; + + @override + void initState() { + super.initState(); + _ctrlAnimationCircle = AnimationController( + //初始化动画变量 + lowerBound: 0, + upperBound: 80, + duration: Duration(seconds: 3), + vsync: this); + _ctrlAnimationCircle.addListener(() => setState(() {})); + } + + @override + void dispose() { + _ctrlAnimationCircle.dispose(); //销毁变量,释放资源 + super.dispose(); + } + + //生成Flow的数据 + List _buildFlowChildren() { + return List.generate( + 15, + (index) => Container( + child: Icon( + index.isEven ? Icons.timer : Icons.ac_unit, + color: Colors.primaries[index % Colors.primaries.length], + ), + )); + } + +//系统生成页面 + @override + Widget build(BuildContext context) { + return Center( + child: GestureDetector( + onTap: () { + setState(() { + //点击后让动画可前行或回退 + _ctrlAnimationCircle.status == AnimationStatus.completed + ? _ctrlAnimationCircle.reverse() + : _ctrlAnimationCircle.forward(); + }); + }, + child: Container( + color: Colors.blueAccent.withOpacity(0.4), + width: 200, + height: 200, + child: Flow( + delegate: FlowAnimatedCircle(_ctrlAnimationCircle.value), + children: _buildFlowChildren(), + ), + ), + ), + ); + } +} + +class FlowAnimatedCircle extends FlowDelegate { + final double radius; //绑定半径,让圆动起来 + FlowAnimatedCircle(this.radius); + + @override + void paintChildren(FlowPaintingContext context) { + double x = 0; //开始(0,0)在父组件的中心 + double y = 0; + for (int i = 0; i < context.childCount; i++) { + x = radius * cos(i * 2 * pi / (context.childCount - 1)); //根据数学得出坐标 + y = radius * sin(i * 2 * pi / (context.childCount - 1)); //根据数学得出坐标 + context.paintChild(i, transform: Matrix4.translationValues(x, y, 0)); + } //使用Matrix定位每个子组件 + } + + @override + bool shouldRepaint(FlowDelegate oldDelegate) => true; +} + +class DemoFlowMenuApp extends StatelessWidget { + @override + Widget build(BuildContext context) { + MaterialApp( + home: Scaffold( + body: DemoFlowMenu(), + ), + ); + } +} + +class DemoFlowMenu extends StatefulWidget { + @override + _DemoFlowMenuState createState() => _DemoFlowMenuState(); +} + +class _DemoFlowMenuState extends State + with TickerProviderStateMixin { + //动画需要这个类来混合 + //动画变量,以及初始化和销毁 + AnimationController _ctrlAnimationCircle; + + @override + void initState() { + super.initState(); + _ctrlAnimationCircle = AnimationController( + //初始化动画变量 + lowerBound: 0, + upperBound: 80, + duration: Duration(milliseconds: 300), + vsync: this); + _ctrlAnimationCircle.addListener(() => setState(() {})); + } + + @override + void dispose() { + _ctrlAnimationCircle.dispose(); //销毁变量,释放资源 + super.dispose(); + } + + //生成Flow的数据 + List _buildFlowChildren() { + return List.generate( + 5, + (index) => Container( + child: Icon( + index.isEven ? Icons.timer : Icons.ac_unit, + color: Colors.primaries[index % Colors.primaries.length], + ), + )); + } + + @override + Widget build(BuildContext context) { + return Stack( + children: [ + Positioned.fill( + child: Flow( + delegate: FlowAnimatedCircle2(_ctrlAnimationCircle.value), + children: _buildFlowChildren(), + ), + ), + Positioned.fill( + child: IconButton( + icon: Icon(Icons.menu), + onPressed: () { + setState(() { + //点击后让动画可前行或回退 + _ctrlAnimationCircle.status == AnimationStatus.completed + ? _ctrlAnimationCircle.reverse() + : _ctrlAnimationCircle.forward(); + }); + }, + ), + ), + ], + ); + } +} + +class FlowAnimatedCircle2 extends FlowDelegate { + final double radius; //绑定半径,让圆动起来 + FlowAnimatedCircle2(this.radius); + + @override + void paintChildren(FlowPaintingContext context) { + if (radius == 0) { + return; + } + double x = 0; //开始(0,0)在父组件的中心 + double y = 0; + for (int i = 0; i < context.childCount; i++) { + x = radius * cos(i * pi / (context.childCount - 1)); //根据数学得出坐标 + y = radius * sin(i * pi / (context.childCount - 1)); //根据数学得出坐标 + context.paintChild(i, transform: Matrix4.translationValues(x, -y, 0)); + } //使用Matrix定位每个子组件 + } + + @override + bool shouldRepaint(FlowDelegate oldDelegate) => true; +} diff --git a/flutter_helper/lib/widgets/a070_textfield.dart b/flutter_helper/lib/widgets/a070_textfield.dart new file mode 100644 index 00000000..a3eaca6a --- /dev/null +++ b/flutter_helper/lib/widgets/a070_textfield.dart @@ -0,0 +1,89 @@ +import 'dart:math'; + +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; + +class TextField222App extends StatelessWidget { + @override + Widget build(BuildContext context) { + print('${context.toString()}'); + return MaterialApp( + title: "Flutter DEMO APP", + locale: Locale('zh'), + theme: ThemeData( + primarySwatch: Colors.orange, + visualDensity: VisualDensity.adaptivePlatformDensity, + ), + home: _Test(), + ); + } +} + +class _Test extends StatefulWidget { + @override + State createState() { + return _TestState(); + } +} + +class _TestState extends State<_Test> with SingleTickerProviderStateMixin { + @override + void initState() { + super.initState(); + } + + @override + void dispose() { + super.dispose(); + } + + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: AppBar( + title: Text('ZhaoJian'), + ), + body: Builder(builder: (context) { + return buildBody(); + }), + // body: buildDataTable(), + floatingActionButton: RaisedButton( + child: CircleAvatar( + child: Text('点'), + ), + onPressed: () { + showBottomSheet( + context: context, + backgroundColor: Colors.lightGreenAccent, + elevation: 20, + shape: CircleBorder(), + builder: (context) { + return Container( + height: 200, + color: Colors.lightBlue, + ); + }, + ); + }, + ), + ); + } + + List dataList = List.generate(20, (index) => false).toList(); + + buildBody() => SingleChildScrollView( + child: Column( + children: [ + TextFormField( + onSaved: (value) { + print('$value'); + }, + autovalidate: false, + validator: (String value) { + return value.length >= 6 ? null : '账号最少6个字符'; + }, + ), + ], + ), + ); +} diff --git a/flutter_helper/lib/widgets/a071_futurebuilder.dart b/flutter_helper/lib/widgets/a071_futurebuilder.dart new file mode 100644 index 00000000..513c7ff5 --- /dev/null +++ b/flutter_helper/lib/widgets/a071_futurebuilder.dart @@ -0,0 +1,180 @@ +import 'dart:math'; + +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; + +class FutureBuilderApp extends StatelessWidget { + @override + Widget build(BuildContext context) { + print('${context.toString()}'); + return MaterialApp( + title: "Flutter DEMO APP", + locale: Locale('zh'), + theme: ThemeData( + primarySwatch: Colors.orange, + visualDensity: VisualDensity.adaptivePlatformDensity, + ), + home: _Test(), + ); + } +} + +class _Test extends StatefulWidget { + @override + State createState() { + return _TestState(); + } +} + +class _TestState extends State<_Test> with SingleTickerProviderStateMixin { + @override + void initState() { + super.initState(); + } + + @override + void dispose() { + super.dispose(); + } + + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: AppBar( + title: Text('ZhaoJian'), + ), + body: Builder(builder: (context) { + return buildBody(); + }), + // body: buildDataTable(), + floatingActionButton: RaisedButton( + child: CircleAvatar( + child: Text('点'), + ), + onPressed: () { + showBottomSheet( + context: context, + backgroundColor: Colors.lightGreenAccent, + elevation: 20, + shape: CircleBorder(), + builder: (context) { + return Container( + height: 200, + color: Colors.lightBlue, + ); + }, + ); + }, + ), + ); + } + + List dataList = List.generate(20, (index) => false).toList(); + + buildBody2() => FutureBuilder( + future: _future, + builder: (context, snapshot) { + var widget; + if (snapshot.connectionState == ConnectionState.done) { + if (snapshot.hasError) { + widget = Icon( + Icons.error, + color: Colors.red, + size: 48, + ); + } else { + widget = Icon( + Icons.check_circle, + color: Colors.green, + size: 36, + ); + } + } else { + widget = Padding( + padding: EdgeInsets.all(20), + child: CircularProgressIndicator(), + ); + } + + return Center( + child: Container( + height: 100, + width: 100, + decoration: BoxDecoration( + border: Border.all(color: Colors.grey), + borderRadius: BorderRadius.all(Radius.circular(10))), + child: widget, + ), + ); + }, + ); + // var _future = Future.delayed(Duration(seconds: 3), () { + // return "老孟,一个有态度的程序员"; + // }); + + // var _future = Future.delayed(Duration(seconds: 3), () { + // return Future.error(''); + // }); + + buildBody() => FutureBuilder( + future: _future, + builder: (context, snapshot) { + var widget; + if (snapshot.connectionState == ConnectionState.done) { + if (snapshot.hasError) { + widget = _loadingErrorWidget(); + } else { + widget = _dataWidget(snapshot.data); + } + } else { + widget = _loadingWidget(); + } + return widget; + }, + ); + + _loadingWidget() { + return Center( + child: Padding( + padding: EdgeInsets.all(20), + child: CircularProgressIndicator(), + ), + ); + } + + + _loadingErrorWidget() { + return Center( + child: Text('数据加载失败,请重试。'), + ); + } + + _dataWidget(data) { + return ListView.separated( + itemBuilder: (context, index) { + return Container( + height: 60, + alignment: Alignment.center, + child: Text( + '$index', + style: TextStyle(fontSize: 20), + ), + ); + }, + separatorBuilder: (context, index) { + return Divider(); + }, + itemCount: 10, + ); + } + + var _future = Future.delayed(Duration(seconds: 3), () { + return Future.error(''); + }); + + +// var _future = Future.delayed(Duration(seconds: 3), () { + // return 'json 字符串'; + // }); + +} diff --git a/flutter_helper/lib/widgets/a072_gesturedetector.dart b/flutter_helper/lib/widgets/a072_gesturedetector.dart new file mode 100644 index 00000000..43c352c6 --- /dev/null +++ b/flutter_helper/lib/widgets/a072_gesturedetector.dart @@ -0,0 +1,108 @@ +import 'dart:math'; + +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; + +class GestureDetectorApp extends StatelessWidget { + @override + Widget build(BuildContext context) { + print('${context.toString()}'); + return MaterialApp( + title: "Flutter DEMO APP", + locale: Locale('zh'), + theme: ThemeData( + primarySwatch: Colors.orange, + visualDensity: VisualDensity.adaptivePlatformDensity, + ), + home: _Test(), + ); + } +} + +class _Test extends StatefulWidget { + @override + State createState() { + return _TestState(); + } +} + +class _TestState extends State<_Test> with SingleTickerProviderStateMixin { + @override + void initState() { + super.initState(); + } + + @override + void dispose() { + super.dispose(); + } + + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: AppBar( + title: Text('ZhaoJian'), + ), + body: Builder(builder: (context) { + return buildBody(); + }), + // body: buildDataTable(), + floatingActionButton: RaisedButton( + child: CircleAvatar( + child: Text('点'), + ), + onPressed: () { + showBottomSheet( + context: context, + backgroundColor: Colors.lightGreenAccent, + elevation: 20, + shape: CircleBorder(), + builder: (context) { + return Container( + height: 200, + color: Colors.lightBlue, + ); + }, + ); + }, + ), + ); + } + + List dataList = List.generate(20, (index) => false).toList(); + + buildBody() => GestureDetector( + // onTapDown: (tapDown) { + // print('onTapDown'); + // }, + // onTapUp: (tapUp) { + // print('onTapUp'); + // }, + // onTap: () { + // print('onTap'); + // }, + // onTapCancel: () { + // print('onTapCancel'); + // }, + // onDoubleTap: () { + // print('onDoubleTap'); + // }, + onLongPressStart: (v) => print('onLongPressStart'), + onLongPressMoveUpdate: (v) => print('onLongPressMoveUpdate'), + onLongPressUp: () => print('onLongPressUp'), + onLongPressEnd: (v) => print('onLongPressEnd'), + onLongPress: () => print('onLongPress'), + onVerticalDragStart: (v) => print('onVerticalDragStart'), + onVerticalDragDown: (v) => print('onVerticalDragDown'), + onVerticalDragUpdate: (v) => print('onVerticalDragUpdate'), + onVerticalDragCancel: () => print('onVerticalDragCancel'), + onVerticalDragEnd: (v) => print('onVerticalDragEnd'), + child: Center( + child: Container( + width: 200, + height: 200, + color: Colors.red, + ), + ), + ); +} diff --git a/flutter_helper/lib/widgets/a073_hero.dart b/flutter_helper/lib/widgets/a073_hero.dart new file mode 100644 index 00000000..f5f5231f --- /dev/null +++ b/flutter_helper/lib/widgets/a073_hero.dart @@ -0,0 +1,80 @@ +import 'dart:math'; + +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; + +class HeroApp extends StatelessWidget { + @override + Widget build(BuildContext context) { + print('${context.toString()}'); + return MaterialApp( + title: "Flutter DEMO APP", + locale: Locale('zh'), + theme: ThemeData( + primarySwatch: Colors.orange, + visualDensity: VisualDensity.adaptivePlatformDensity, + ), + home: HeroDemo(), + ); + } +} + +class HeroDemo extends StatefulWidget { + @override + State createState() => _HeroDemo(); +} + +class _HeroDemo extends State { + @override + Widget build(BuildContext context) { + return Scaffold( + body: GridView( + gridDelegate: SliverGridDelegateWithFixedCrossAxisCount( + crossAxisCount: 3, crossAxisSpacing: 5, mainAxisSpacing: 3), + children: List.generate(10, (index) { + if (index == 6) { + return InkWell( + onTap: () { + Navigator.push( + context, + new MaterialPageRoute( + builder: (context) => new _Hero1Demo())); + }, + child: Hero( + tag: 'hero', + child: Container( + child: Image.asset( + 'images/bird.png', + fit: BoxFit.fitWidth, + ), + ), + ), + ); + } + return Container( + color: Colors.red, + ); + }), + ), + ); + } +} + +class _Hero1Demo extends StatelessWidget { + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: AppBar(), + body: Container( + alignment: Alignment.topCenter, + child: Hero( + tag: 'hero', + child: Container( + child: Image.asset( + 'images/bird.png', + ), + ), + )), + ); + } +} diff --git a/flutter_helper/lib/widgets/a074_intrinsicheight.dart b/flutter_helper/lib/widgets/a074_intrinsicheight.dart new file mode 100644 index 00000000..9d70e0a7 --- /dev/null +++ b/flutter_helper/lib/widgets/a074_intrinsicheight.dart @@ -0,0 +1,71 @@ +import 'dart:math'; + +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; + +class IntrinsicHeightApp extends StatelessWidget { + @override + Widget build(BuildContext context) { + print('${context.toString()}'); + return MaterialApp( + title: "Flutter DEMO APP", + locale: Locale('zh'), + theme: ThemeData( + primarySwatch: Colors.orange, + visualDensity: VisualDensity.adaptivePlatformDensity, + ), + home: HeroDemo(), + ); + } +} + +class HeroDemo extends StatefulWidget { + @override + State createState() => _HeroDemo(); +} + +class _HeroDemo extends State { + @override + Widget build(BuildContext context) { + return Scaffold( + // body: buildBody(), + // body: buildBody(), + // body: buildColumn(), + body: buildBody2(), + ); + } + + buildRow() => Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + new Container(color: Colors.blue, width: 100.0), + new Container( + color: Colors.red, + width: 50.0, + height: 50.0, + ), + new Container(color: Colors.yellow, width: 150.0), + ], + ); + + buildBody() => IntrinsicHeight( + child: buildRow(), + ); + + buildColumn() => Column( + children: [ + new Container(color: Colors.blue, height: 100.0), + new Container(color: Colors.red, width: 150.0, height: 100.0), + new Container( + color: Colors.yellow, + height: 150.0, + ), + ], + ); + + buildBody2() => IntrinsicWidth( + stepHeight: 450.0, + stepWidth: 300.0, + child: buildColumn(), + ); +} diff --git a/flutter_helper/lib/widgets/a075_nestedscrollview.dart b/flutter_helper/lib/widgets/a075_nestedscrollview.dart new file mode 100644 index 00000000..9f342881 --- /dev/null +++ b/flutter_helper/lib/widgets/a075_nestedscrollview.dart @@ -0,0 +1,137 @@ +import 'dart:math'; + +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; + +///http://laomengit.com/flutter/widgets/NestedScrollView.html#%E6%BB%9A%E5%8A%A8%E9%9A%90%E8%97%8Fappbar +class NestedScrollViewApp extends StatelessWidget { + @override + Widget build(BuildContext context) { + print('${context.toString()}'); + return MaterialApp( + title: "Flutter DEMO APP", + locale: Locale('zh'), + theme: ThemeData( + primarySwatch: Colors.orange, + visualDensity: VisualDensity.adaptivePlatformDensity, + ), + home: HeroDemo(), + ); + } +} + +class HeroDemo extends StatefulWidget { + @override + State createState() => _HeroDemo(); +} + +class _HeroDemo extends State with SingleTickerProviderStateMixin { + ScrollController _scrollController; + TabController _tabController; + var tabs = [ + Tab(text: '资讯'), + Tab(text: '技术'), + ]; + + @override + void initState() { + _scrollController = ScrollController(); + +//监听滚动位置 + _scrollController.addListener(() { + print('${_scrollController.position}'); + }); + //滚动到指定位置 + // _scrollController.animateTo(20.0); + _tabController = TabController(vsync: this, length: tabs.length); + + super.initState(); + } + + @override + Widget build(BuildContext context) { + return Scaffold( + body: buildBody(), + ); + } + + buildBody() => NestedScrollView( + headerSliverBuilder: (BuildContext context, bool innerBoxIsScrolled) { + return [ + SliverAppBar( + expandedHeight: 230.0, + pinned: true, + flexibleSpace: Padding( + padding: EdgeInsets.symmetric(vertical: 8), + child: PageView(), + ), + ), + SliverPersistentHeader( + pinned: true, + delegate: StickyTabBarDelegate( + child: TabBar( + labelColor: Colors.black, + controller: this._tabController, + tabs: tabs, + ), + ), + ), + ]; + }, + body: TabBarView( + controller: this._tabController, + children: [ + RefreshIndicator( + onRefresh: () async { + print(('onRefresh')); + }, + child: _buildTabNewsList(), + ), + _buildTabNewsList(), + ], + ), + ); + + _buildTabNewsList() { + return ListView.builder( + itemBuilder: (BuildContext context, int index) { + return Container( + height: 80, + color: Colors.primaries[index % Colors.primaries.length], + alignment: Alignment.center, + child: Text( + '$index', + style: TextStyle(color: Colors.white, fontSize: 20), + ), + ); + }, + itemCount: 20, + ); + } +} + +class StickyTabBarDelegate extends SliverPersistentHeaderDelegate { + final TabBar child; + + StickyTabBarDelegate({@required this.child}); + + @override + Widget build( + BuildContext context, double shrinkOffset, bool overlapsContent) { + return Container( + color: Theme.of(context).backgroundColor, + child: this.child, + ); + } + + @override + double get maxExtent => this.child.preferredSize.height; + + @override + double get minExtent => this.child.preferredSize.height; + + @override + bool shouldRebuild(SliverPersistentHeaderDelegate oldDelegate) { + return true; + } +} diff --git a/flutter_helper/lib/widgets/a076_notificationlistener.dart b/flutter_helper/lib/widgets/a076_notificationlistener.dart new file mode 100644 index 00000000..40052fc9 --- /dev/null +++ b/flutter_helper/lib/widgets/a076_notificationlistener.dart @@ -0,0 +1,145 @@ +import 'dart:math'; + +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; + +///http://laomengit.com/flutter/widgets/NestedScrollView.html#%E6%BB%9A%E5%8A%A8%E9%9A%90%E8%97%8Fappbar +class NotificationListenerApp extends StatelessWidget { + @override + Widget build(BuildContext context) { + print('${context.toString()}'); + return MaterialApp( + title: "Flutter DEMO APP", + locale: Locale('zh'), + theme: ThemeData( + primarySwatch: Colors.orange, + visualDensity: VisualDensity.adaptivePlatformDensity, + ), + home: HeroDemo(), + ); + } +} + +class HeroDemo extends StatefulWidget { + @override + State createState() => _HeroDemo(); +} + +class _HeroDemo extends State with SingleTickerProviderStateMixin { + ScrollController _scrollController; + TabController _tabController; + var tabs = [ + Tab(text: '资讯'), + Tab(text: '技术'), + ]; + + @override + void initState() { + _scrollController = ScrollController(); + +//监听滚动位置 + _scrollController.addListener(() { + print('${_scrollController.position}'); + }); + //滚动到指定位置 + // _scrollController.animateTo(20.0); + _tabController = TabController(vsync: this, length: tabs.length); + + super.initState(); + } + + @override + Widget build(BuildContext context) { + return Scaffold( + body: buildBody(), + ); + } + + buildBody() => NotificationListener( + onNotification: (CustomNotification notification) { + print('介绍事件——1:${notification.value}'); + return true; + }, + child: NotificationListener( + onNotification: (CustomNotification notification) { + print('介绍事件——2:${notification.value}'); + return false; + }, + child: Center( + child: Builder( + builder: (context) { + return RaisedButton( + child: Text('发送'), + onPressed: () { + CustomNotification('自定义事件').dispatch(context); + }, + ); + }, + ), + ), + )); + + buildBody2() => NotificationListener( + onNotification: (notification) { + print('$notification'); + return true; + }, + child: ListView.builder( + itemBuilder: (context, index) { + return ListTile( + title: Text('index:$index'), + ); + }, + itemCount: 50, + ), + ); + + _buildTabNewsList() { + return ListView.builder( + itemBuilder: (BuildContext context, int index) { + return Container( + height: 80, + color: Colors.primaries[index % Colors.primaries.length], + alignment: Alignment.center, + child: Text( + '$index', + style: TextStyle(color: Colors.white, fontSize: 20), + ), + ); + }, + itemCount: 20, + ); + } +} + +class StickyTabBarDelegate extends SliverPersistentHeaderDelegate { + final TabBar child; + + StickyTabBarDelegate({@required this.child}); + + @override + Widget build( + BuildContext context, double shrinkOffset, bool overlapsContent) { + return Container( + color: Theme.of(context).backgroundColor, + child: this.child, + ); + } + + @override + double get maxExtent => this.child.preferredSize.height; + + @override + double get minExtent => this.child.preferredSize.height; + + @override + bool shouldRebuild(SliverPersistentHeaderDelegate oldDelegate) { + return true; + } +} + +class CustomNotification extends Notification { + CustomNotification(this.value); + + final String value; +} diff --git a/flutter_helper/lib/widgets/a077_pageview.dart b/flutter_helper/lib/widgets/a077_pageview.dart new file mode 100644 index 00000000..eb747e30 --- /dev/null +++ b/flutter_helper/lib/widgets/a077_pageview.dart @@ -0,0 +1,131 @@ +import 'dart:math'; + +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; + +///http://laomengit.com/flutter/widgets/NestedScrollView.html#%E6%BB%9A%E5%8A%A8%E9%9A%90%E8%97%8Fappbar +class PageViewApp extends StatelessWidget { + @override + Widget build(BuildContext context) { + print('${context.toString()}'); + return MaterialApp( + title: "Flutter DEMO APP", + locale: Locale('zh'), + theme: ThemeData( + primarySwatch: Colors.orange, + visualDensity: VisualDensity.adaptivePlatformDensity, + ), + home: _Home(), + ); + } +} + +class _Home extends StatelessWidget { + @override + Widget build(BuildContext context) => Scaffold( + appBar: AppBar( + bottom: PreferredSize( + preferredSize: Size.fromHeight(148), + child: Container( + height: 48, + color: Colors.red, + ), + ), + ), + body: ViewPage(), + ); +} + +class ViewPage extends StatefulWidget { + @override + State createState() => _ViewPageState(); +} + +class _ViewPageState extends State { + var imgList = [ + 'https://ss1.bdstatic.com/70cFvXSh_Q1YnxGkpoWK1HF6hhy/it/u=2877516247,37083492&fm=26&gp=0.jpg', + 'https://ss1.bdstatic.com/70cFvXSh_Q1YnxGkpoWK1HF6hhy/it/u=2877516247,37083492&fm=26&gp=0.jpg', + ]; + PageController _pageController; + + var _currPageValue = 0.0; + + //缩放系数 + double _scaleFactor = .8; + + //view page height + double _height = 230.0; + + @override + void initState() { + super.initState(); + _pageController = PageController(viewportFraction: 0.9); + _pageController.addListener(() { + setState(() { + _currPageValue = _pageController.page; + }); + }); + } + + @override + void dispose() { + super.dispose(); + _pageController.dispose(); + } + + @override + Widget build(BuildContext context) { + return Container( + height: _height, + child: PageView.builder( + itemBuilder: (context, index) => _buildPageItem(index), + itemCount: 10, + controller: _pageController, + )); + } + + _buildPageItem(int index) { + Matrix4 matrix4 = Matrix4.identity(); + if (index == _currPageValue.floor()) { + //当前的item + var currScale = 1 - (_currPageValue - index) * (1 - _scaleFactor); + var currTrans = _height * (1 - currScale) / 2; + + matrix4 = Matrix4.diagonal3Values(1.0, currScale, 1.0) + ..setTranslationRaw(0.0, currTrans, 0.0); + } else if (index == _currPageValue.floor() + 1) { + //右边的item + var currScale = + _scaleFactor + (_currPageValue - index + 1) * (1 - _scaleFactor); + var currTrans = _height * (1 - currScale) / 2; + + matrix4 = Matrix4.diagonal3Values(1.0, currScale, 1.0) + ..setTranslationRaw(0.0, currTrans, 0.0); + } else if (index == _currPageValue.floor() - 1) { + //左边 + var currScale = 1 - (_currPageValue - index) * (1 - _scaleFactor); + var currTrans = _height * (1 - currScale) / 2; + + matrix4 = Matrix4.diagonal3Values(1.0, currScale, 1.0) + ..setTranslationRaw(0.0, currTrans, 0.0); + } else { + //其他,不在屏幕显示的item + matrix4 = Matrix4.diagonal3Values(1.0, _scaleFactor, 1.0) + ..setTranslationRaw(0.0, _height * (1 - _scaleFactor) / 2, 0.0); + } + + return Transform( + transform: matrix4, + child: Padding( + padding: EdgeInsets.symmetric(horizontal: 10), + child: Container( + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(12), + image: DecorationImage( + image: NetworkImage(imgList[index % 2]), fit: BoxFit.fill), + ), + ), + ), + ); + } +} diff --git a/flutter_helper/pubspec.lock b/flutter_helper/pubspec.lock new file mode 100644 index 00000000..5406b175 --- /dev/null +++ b/flutter_helper/pubspec.lock @@ -0,0 +1,213 @@ +# Generated by pub +# See https://dart.dev/tools/pub/glossary#lockfile +packages: + async: + dependency: transitive + description: + name: async + url: "https://pub.flutter-io.cn" + source: hosted + version: "2.6.1" + boolean_selector: + dependency: transitive + description: + name: boolean_selector + url: "https://pub.flutter-io.cn" + source: hosted + version: "2.1.0" + characters: + dependency: transitive + description: + name: characters + url: "https://pub.flutter-io.cn" + source: hosted + version: "1.1.0" + charcode: + dependency: transitive + description: + name: charcode + url: "https://pub.flutter-io.cn" + source: hosted + version: "1.2.0" + clock: + dependency: transitive + description: + name: clock + url: "https://pub.flutter-io.cn" + source: hosted + version: "1.1.0" + collection: + dependency: transitive + description: + name: collection + url: "https://pub.flutter-io.cn" + source: hosted + version: "1.15.0" + convert: + dependency: "direct main" + description: + name: convert + url: "https://pub.flutter-io.cn" + source: hosted + version: "3.0.1" + crypto: + dependency: "direct main" + description: + name: crypto + url: "https://pub.flutter-io.cn" + source: hosted + version: "3.0.1" + cupertino_icons: + dependency: "direct main" + description: + name: cupertino_icons + url: "https://pub.flutter-io.cn" + source: hosted + version: "1.0.0" + decimal: + dependency: "direct main" + description: + name: decimal + url: "https://pub.flutter-io.cn" + source: hosted + version: "1.2.0" + fake_async: + dependency: transitive + description: + name: fake_async + url: "https://pub.flutter-io.cn" + source: hosted + version: "1.2.0" + flutter: + dependency: "direct main" + description: flutter + source: sdk + version: "0.0.0" + flutter_localizations: + dependency: "direct dev" + description: flutter + source: sdk + version: "0.0.0" + flutter_test: + dependency: "direct dev" + description: flutter + source: sdk + version: "0.0.0" + flutter_web_plugins: + dependency: transitive + description: flutter + source: sdk + version: "0.0.0" + fluttertoast: + dependency: "direct main" + description: + name: fluttertoast + url: "https://pub.flutter-io.cn" + source: hosted + version: "4.0.1" + intl: + dependency: transitive + description: + name: intl + url: "https://pub.flutter-io.cn" + source: hosted + version: "0.17.0" + js: + dependency: transitive + description: + name: js + url: "https://pub.flutter-io.cn" + source: hosted + version: "0.6.3" + matcher: + dependency: transitive + description: + name: matcher + url: "https://pub.flutter-io.cn" + source: hosted + version: "0.12.10" + meta: + dependency: transitive + description: + name: meta + url: "https://pub.flutter-io.cn" + source: hosted + version: "1.3.0" + path: + dependency: transitive + description: + name: path + url: "https://pub.flutter-io.cn" + source: hosted + version: "1.8.0" + rational: + dependency: transitive + description: + name: rational + url: "https://pub.flutter-io.cn" + source: hosted + version: "1.2.1" + sky_engine: + dependency: transitive + description: flutter + source: sdk + version: "0.0.99" + source_span: + dependency: transitive + description: + name: source_span + url: "https://pub.flutter-io.cn" + source: hosted + version: "1.8.1" + stack_trace: + dependency: transitive + description: + name: stack_trace + url: "https://pub.flutter-io.cn" + source: hosted + version: "1.10.0" + stream_channel: + dependency: transitive + description: + name: stream_channel + url: "https://pub.flutter-io.cn" + source: hosted + version: "2.1.0" + string_scanner: + dependency: transitive + description: + name: string_scanner + url: "https://pub.flutter-io.cn" + source: hosted + version: "1.1.0" + term_glyph: + dependency: transitive + description: + name: term_glyph + url: "https://pub.flutter-io.cn" + source: hosted + version: "1.2.0" + test_api: + dependency: transitive + description: + name: test_api + url: "https://pub.flutter-io.cn" + source: hosted + version: "0.3.0" + typed_data: + dependency: transitive + description: + name: typed_data + url: "https://pub.flutter-io.cn" + source: hosted + version: "1.3.0" + vector_math: + dependency: transitive + description: + name: vector_math + url: "https://pub.flutter-io.cn" + source: hosted + version: "2.1.0" +sdks: + dart: ">=2.12.0 <3.0.0" + flutter: ">=1.12.8" diff --git a/flutter_helper/pubspec.yaml b/flutter_helper/pubspec.yaml new file mode 100644 index 00000000..d8dec36a --- /dev/null +++ b/flutter_helper/pubspec.yaml @@ -0,0 +1,106 @@ +name: flutter_helper +description: A new Flutter project. + +# The following line prevents the package from being accidentally published to +# pub.dev using `pub publish`. This is preferred for private packages. +publish_to: 'none' # Remove this line if you wish to publish to pub.dev + +# The following defines the version and build number for your application. +# A version number is three numbers separated by dots, like 1.2.43 +# followed by an optional build number separated by a +. +# Both the version and the builder number may be overridden in flutter +# build by specifying --build-name and --build-number, respectively. +# In Android, build-name is used as versionName while build-number used as versionCode. +# Read more about Android versioning at https://developer.android.com/studio/publish/versioning +# In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion. +# Read more about iOS versioning at +# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html +version: 1.0.0+1 + +environment: + sdk: ">=2.7.0 <3.0.0" + +dependencies: + flutter: + sdk: flutter + # https://github.com/a14n/dart-decimal + decimal: ">=1.0.0 <3.0.0" + # https://github.com/dart-lang/crypto + crypto: ">=3.0.0 <5.0.0" + # https://github.com/dart-lang/convert + convert: ">=3.0.0 <5.0.0" + fluttertoast: ^4.0.1 + + + # The following adds the Cupertino Icons font to your application. + # Use with the CupertinoIcons class for iOS style icons. + cupertino_icons: ^1.0.0 + +dev_dependencies: + flutter_test: + sdk: flutter + flutter_localizations: + sdk: flutter + +# For information on the generic Dart part of this file, see the +# following page: https://dart.dev/tools/pub/pubspec + +# The following section is specific to Flutter. +flutter: + + # The following line ensures that the Material Icons font is + # included with your application, so that you can use the icons in + # the material Icons class. + uses-material-design: true + + # To add assets to your application, add an assets section, like this: + assets: + - images/bird.png + - images/beatiful_lady.jpeg + - images/ic_purchase_history_blank.jpeg + - images/ic_purchase_history_blank.png + - images/ic_purchase_history_blank.webp + - images/image_1111.png + - images/image_2222.png + - images/image_3333.png + - images/image_-pet-wild.png + - images/image_and_nature.png + - images/image_animaltest.png + - images/image_domestic_3204653.png + - images/image_eye_care.png + - images/image_hospital.png + - images/bossapp2x.png + - images/ic_main_tab_company_nor.png + - images/ic_main_tab_company_pre.png + - images/ic_main_tab_contacts_nor.png + - images/ic_main_tab_contacts_pre.png + - images/ic_main_tab_find_nor.png + - images/ic_main_tab_find_pre.png + - images/ic_main_tab_my_nor.png + - images/ic_main_tab_my_pre.png + + # An image asset can refer to one or more resolution-specific "variants", see + # https://flutter.dev/assets-and-images/#resolution-aware. + + # For details regarding adding assets from package dependencies, see + # https://flutter.dev/assets-and-images/#from-packages + + # To add custom fonts to your application, add a fonts section here, + # in this "flutter" section. Each entry in this list should have a + # "family" key with the font family name, and a "fonts" key with a + # list giving the asset and other descriptors for the font. For + # example: + # fonts: + # - family: Schyler + # fonts: + # - asset: fonts/Schyler-Regular.ttf + # - asset: fonts/Schyler-Italic.ttf + # style: italic + # - family: Trajan Pro + # fonts: + # - asset: fonts/TrajanPro.ttf + # - asset: fonts/TrajanPro_Bold.ttf + # weight: 700 + # + # For details regarding fonts from package dependencies, + # see https://flutter.dev/custom-fonts/#from-packages diff --git a/flutter_helper/test/widget_test.dart b/flutter_helper/test/widget_test.dart new file mode 100644 index 00000000..a635895b --- /dev/null +++ b/flutter_helper/test/widget_test.dart @@ -0,0 +1,30 @@ +// This is a basic Flutter widget test. +// +// To perform an interaction with a widget in your test, use the WidgetTester +// utility that Flutter provides. For example, you can send tap and scroll +// gestures. You can also use WidgetTester to find child widgets in the widget +// tree, read text, and verify that the values of widget properties are correct. + +import 'package:flutter/material.dart'; +import 'package:flutter_test/flutter_test.dart'; + +import 'package:flutter_helper/main.dart'; + +void main() { + testWidgets('Counter increments smoke test', (WidgetTester tester) async { + // Build our app and trigger a frame. + // await tester.pumpWidget(MyApp()); + // + // // Verify that our counter starts at 0. + // expect(find.text('0'), findsOneWidget); + // expect(find.text('1'), findsNothing); + // + // // Tap the '+' icon and trigger a frame. + // await tester.tap(find.byIcon(Icons.add)); + // await tester.pump(); + // + // // Verify that our counter has incremented. + // expect(find.text('0'), findsNothing); + // expect(find.text('1'), findsOneWidget); + }); +} diff --git a/gradledemo/gradledownload-library/.gitignore b/gradledemo/gradledownload-library/.gitignore new file mode 100644 index 00000000..42afabfd --- /dev/null +++ b/gradledemo/gradledownload-library/.gitignore @@ -0,0 +1 @@ +/build \ No newline at end of file diff --git a/gradledemo/gradledownload-library/build.gradle b/gradledemo/gradledownload-library/build.gradle new file mode 100644 index 00000000..0a357a91 --- /dev/null +++ b/gradledemo/gradledownload-library/build.gradle @@ -0,0 +1,44 @@ +plugins { + id 'com.android.library' + id 'kotlin-android' +} + +android { + compileSdkVersion 30 + buildToolsVersion "30.0.3" + + defaultConfig { + minSdkVersion 16 + targetSdkVersion 30 + versionCode 1 + versionName "1.0" + + testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" + consumerProguardFiles "consumer-rules.pro" + } + + buildTypes { + release { + minifyEnabled false + proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' + } + } + compileOptions { + sourceCompatibility JavaVersion.VERSION_1_8 + targetCompatibility JavaVersion.VERSION_1_8 + } + kotlinOptions { + jvmTarget = '1.8' + } +} + +dependencies { + + implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" + implementation 'androidx.core:core-ktx:1.6.0' + implementation 'androidx.appcompat:appcompat:1.3.0' + implementation 'com.google.android.material:material:1.4.0' + testImplementation 'junit:junit:4.+' + androidTestImplementation 'androidx.test.ext:junit:1.1.3' + androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0' +} \ No newline at end of file diff --git a/gradledemo/gradledownload-library/consumer-rules.pro b/gradledemo/gradledownload-library/consumer-rules.pro new file mode 100644 index 00000000..e69de29b diff --git a/gradledemo/gradledownload-library/proguard-rules.pro b/gradledemo/gradledownload-library/proguard-rules.pro new file mode 100644 index 00000000..481bb434 --- /dev/null +++ b/gradledemo/gradledownload-library/proguard-rules.pro @@ -0,0 +1,21 @@ +# Add project specific ProGuard rules here. +# You can control the set of applied configuration files using the +# proguardFiles setting in build.gradle. +# +# For more details, see +# http://developer.android.com/guide/developing/tools/proguard.html + +# If your project uses WebView with JS, uncomment the following +# and specify the fully qualified class name to the JavaScript interface +# class: +#-keepclassmembers class fqcn.of.javascript.interface.for.webview { +# public *; +#} + +# Uncomment this to preserve the line number information for +# debugging stack traces. +#-keepattributes SourceFile,LineNumberTable + +# If you keep the line number information, uncomment this to +# hide the original source file name. +#-renamesourcefileattribute SourceFile \ No newline at end of file diff --git a/gradledemo/gradledownload-library/src/androidTest/java/com/flannery/gradledownload_library/ExampleInstrumentedTest.kt b/gradledemo/gradledownload-library/src/androidTest/java/com/flannery/gradledownload_library/ExampleInstrumentedTest.kt new file mode 100644 index 00000000..69d91fb6 --- /dev/null +++ b/gradledemo/gradledownload-library/src/androidTest/java/com/flannery/gradledownload_library/ExampleInstrumentedTest.kt @@ -0,0 +1,24 @@ +package com.flannery.gradledownload_library + +import androidx.test.platform.app.InstrumentationRegistry +import androidx.test.ext.junit.runners.AndroidJUnit4 + +import org.junit.Test +import org.junit.runner.RunWith + +import org.junit.Assert.* + +/** + * Instrumented test, which will execute on an Android device. + * + * See [testing documentation](http://d.android.com/tools/testing). + */ +@RunWith(AndroidJUnit4::class) +class ExampleInstrumentedTest { + @Test + fun useAppContext() { + // Context of the app under test. + val appContext = InstrumentationRegistry.getInstrumentation().targetContext + assertEquals("com.flannery.gradledownload_library.test", appContext.packageName) + } +} \ No newline at end of file diff --git a/gradledemo/gradledownload-library/src/main/AndroidManifest.xml b/gradledemo/gradledownload-library/src/main/AndroidManifest.xml new file mode 100644 index 00000000..d9450428 --- /dev/null +++ b/gradledemo/gradledownload-library/src/main/AndroidManifest.xml @@ -0,0 +1,5 @@ + + + + \ No newline at end of file diff --git a/gradledemo/gradledownload-library/src/test/java/com/flannery/gradledownload_library/ExampleUnitTest.kt b/gradledemo/gradledownload-library/src/test/java/com/flannery/gradledownload_library/ExampleUnitTest.kt new file mode 100644 index 00000000..616e06d1 --- /dev/null +++ b/gradledemo/gradledownload-library/src/test/java/com/flannery/gradledownload_library/ExampleUnitTest.kt @@ -0,0 +1,17 @@ +package com.flannery.gradledownload_library + +import org.junit.Test + +import org.junit.Assert.* + +/** + * Example local unit test, which will execute on the development machine (host). + * + * See [testing documentation](http://d.android.com/tools/testing). + */ +class ExampleUnitTest { + @Test + fun addition_isCorrect() { + assertEquals(4, 2 + 2) + } +} \ No newline at end of file diff --git a/gradledemo/gradledownload/.gitignore b/gradledemo/gradledownload/.gitignore new file mode 100644 index 00000000..42afabfd --- /dev/null +++ b/gradledemo/gradledownload/.gitignore @@ -0,0 +1 @@ +/build \ No newline at end of file diff --git a/gradledemo/gradledownload/build.gradle b/gradledemo/gradledownload/build.gradle new file mode 100644 index 00000000..b791557f --- /dev/null +++ b/gradledemo/gradledownload/build.gradle @@ -0,0 +1,72 @@ +plugins { + id 'com.android.application' + id 'kotlin-android' + id "de.undercouch.download" //version "4.1.2" +} + + +print('*********************') +print(buildDir) +print('*********************') + +android { + compileSdkVersion 30 + buildToolsVersion "30.0.3" + + defaultConfig { + applicationId "com.fannery.gradledownload" + minSdkVersion 16 + targetSdkVersion 30 + versionCode 1 + versionName "1.0" + + testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" + } + + buildTypes { + release { + minifyEnabled false + proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' + } + } + compileOptions { + sourceCompatibility JavaVersion.VERSION_1_8 + targetCompatibility JavaVersion.VERSION_1_8 + } + kotlinOptions { + jvmTarget = '1.8' + } +} + +dependencies { + + implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" + implementation 'androidx.core:core-ktx:1.6.0' + implementation 'androidx.appcompat:appcompat:1.3.0' + implementation 'com.google.android.material:material:1.4.0' + implementation 'androidx.constraintlayout:constraintlayout:2.0.4' + testImplementation 'junit:junit:4.+' + androidTestImplementation 'androidx.test.ext:junit:1.1.3' + androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0' + + implementation project(':gradledemo:gradledownload-library') +} + +task downloadFile(type: Download) { + src 'http://multi-lang.duowan.com/multiLangBig/Teachee/Teachee___2_3_0/ko.json?time=613981000' + dest buildDir + overwrite false +} + +task myTask { + doLast { + // do something + // ... then download a file + download { + src 'http://multi-lang.duowan.com/multiLangBig/Teachee/Teachee___2_3_0/ko.json?time=613981000' + dest buildDir + overwrite false + } + // ... dosomething else + } +} \ No newline at end of file diff --git a/gradledemo/gradledownload/proguard-rules.pro b/gradledemo/gradledownload/proguard-rules.pro new file mode 100644 index 00000000..481bb434 --- /dev/null +++ b/gradledemo/gradledownload/proguard-rules.pro @@ -0,0 +1,21 @@ +# Add project specific ProGuard rules here. +# You can control the set of applied configuration files using the +# proguardFiles setting in build.gradle. +# +# For more details, see +# http://developer.android.com/guide/developing/tools/proguard.html + +# If your project uses WebView with JS, uncomment the following +# and specify the fully qualified class name to the JavaScript interface +# class: +#-keepclassmembers class fqcn.of.javascript.interface.for.webview { +# public *; +#} + +# Uncomment this to preserve the line number information for +# debugging stack traces. +#-keepattributes SourceFile,LineNumberTable + +# If you keep the line number information, uncomment this to +# hide the original source file name. +#-renamesourcefileattribute SourceFile \ No newline at end of file diff --git a/gradledemo/gradledownload/src/androidTest/java/com/fannery/gradledownload/ExampleInstrumentedTest.kt b/gradledemo/gradledownload/src/androidTest/java/com/fannery/gradledownload/ExampleInstrumentedTest.kt new file mode 100644 index 00000000..c73048b5 --- /dev/null +++ b/gradledemo/gradledownload/src/androidTest/java/com/fannery/gradledownload/ExampleInstrumentedTest.kt @@ -0,0 +1,24 @@ +package com.fannery.gradledownload + +import androidx.test.platform.app.InstrumentationRegistry +import androidx.test.ext.junit.runners.AndroidJUnit4 + +import org.junit.Test +import org.junit.runner.RunWith + +import org.junit.Assert.* + +/** + * Instrumented test, which will execute on an Android device. + * + * See [testing documentation](http://d.android.com/tools/testing). + */ +@RunWith(AndroidJUnit4::class) +class ExampleInstrumentedTest { + @Test + fun useAppContext() { + // Context of the app under test. + val appContext = InstrumentationRegistry.getInstrumentation().targetContext + assertEquals("com.fannery.gradledownload", appContext.packageName) + } +} \ No newline at end of file diff --git a/gradledemo/gradledownload/src/main/AndroidManifest.xml b/gradledemo/gradledownload/src/main/AndroidManifest.xml new file mode 100644 index 00000000..7c6a4f57 --- /dev/null +++ b/gradledemo/gradledownload/src/main/AndroidManifest.xml @@ -0,0 +1,21 @@ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/gradledemo/gradledownload/src/main/java/com/fannery/gradledownload/BaseActivity.kt b/gradledemo/gradledownload/src/main/java/com/fannery/gradledownload/BaseActivity.kt new file mode 100644 index 00000000..81ccc4ed --- /dev/null +++ b/gradledemo/gradledownload/src/main/java/com/fannery/gradledownload/BaseActivity.kt @@ -0,0 +1,37 @@ +package com.fannery.gradledownload + +import android.os.Bundle +import android.os.PersistableBundle +import android.util.Log +import android.widget.Toast +import androidx.appcompat.app.AppCompatActivity +import java.lang.StringBuilder + +/** + * Time:2021/7/26 10:48 + * Author: + * Description: + */ +open class BaseActivity : AppCompatActivity() { + + override fun onCreate(savedInstanceState: Bundle?, persistentState: PersistableBundle?) { + super.onCreate(savedInstanceState, persistentState) + + printStackTrace() + } + + + fun printStackTrace() { + // StackTraceElement[] trace = getOurStackTrace(); + // for (StackTraceElement traceElement : trace) + // s.println("\tat " + traceElement); + val sb = StringBuilder() + for (element in Thread.currentThread().stackTrace) { + sb.append("\tat").append(element).appendLine() + } + Toast.makeText(this, sb.toString(), Toast.LENGTH_LONG).show() + Log.e("MainActivity", sb.toString()) + } + + +} \ No newline at end of file diff --git a/gradledemo/gradledownload/src/main/java/com/fannery/gradledownload/MYTextView.kt b/gradledemo/gradledownload/src/main/java/com/fannery/gradledownload/MYTextView.kt new file mode 100644 index 00000000..2d65a215 --- /dev/null +++ b/gradledemo/gradledownload/src/main/java/com/fannery/gradledownload/MYTextView.kt @@ -0,0 +1,22 @@ +package com.fannery.gradledownload + +import android.content.Context +import android.util.AttributeSet +import android.widget.TextView + +/** + * Time:2021/7/27 10:30 + * Author: + * Description: + */ +class MYTextView(context: Context?, attrs: AttributeSet?) : TextView(context, attrs) { + + +// fun test() { +// context.getString() +// } + + override fun setText(text: CharSequence?, type: BufferType?) { + super.setText(text, type) + } +} \ No newline at end of file diff --git a/gradledemo/gradledownload/src/main/java/com/fannery/gradledownload/MainActivity.kt b/gradledemo/gradledownload/src/main/java/com/fannery/gradledownload/MainActivity.kt new file mode 100644 index 00000000..e26709d4 --- /dev/null +++ b/gradledemo/gradledownload/src/main/java/com/fannery/gradledownload/MainActivity.kt @@ -0,0 +1,30 @@ +package com.fannery.gradledownload + +import android.os.Bundle +import android.util.Log + +class MainActivity : BaseActivity() { + override fun onCreate(savedInstanceState: Bundle?) { + super.onCreate(savedInstanceState) + setContentView(R.layout.activity_main) + + val resourceEntryName = resources.getResourceEntryName(R.string.app_name) + Log.e("MainActivity", resourceEntryName); + val resourceTypeName = resources.getResourceTypeName(R.string.app_name) + Log.e("MainActivity", resourceTypeName); + } + + var isDefaultSkin = true + var hashMap: HashMap = HashMap() + + fun getString2(resId: Int): String { + if (isDefaultSkin) { + resources.getString(resId) + } + val resourceEntryName = resources.getResourceEntryName(resId) + val s = hashMap[resourceEntryName] + return if (s == null) return resources.getString(resId) else s + } + + +} \ No newline at end of file diff --git a/gradledemo/gradledownload/src/main/res/drawable-v24/ic_launcher_foreground.xml b/gradledemo/gradledownload/src/main/res/drawable-v24/ic_launcher_foreground.xml new file mode 100644 index 00000000..2b068d11 --- /dev/null +++ b/gradledemo/gradledownload/src/main/res/drawable-v24/ic_launcher_foreground.xml @@ -0,0 +1,30 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/gradledemo/gradledownload/src/main/res/drawable/ic_launcher_background.xml b/gradledemo/gradledownload/src/main/res/drawable/ic_launcher_background.xml new file mode 100644 index 00000000..07d5da9c --- /dev/null +++ b/gradledemo/gradledownload/src/main/res/drawable/ic_launcher_background.xml @@ -0,0 +1,170 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/gradledemo/gradledownload/src/main/res/layout/activity_main.xml b/gradledemo/gradledownload/src/main/res/layout/activity_main.xml new file mode 100644 index 00000000..2fdb3d36 --- /dev/null +++ b/gradledemo/gradledownload/src/main/res/layout/activity_main.xml @@ -0,0 +1,18 @@ + + + + + + \ No newline at end of file diff --git a/gradledemo/gradledownload/src/main/res/mipmap-anydpi-v26/ic_launcher.xml b/gradledemo/gradledownload/src/main/res/mipmap-anydpi-v26/ic_launcher.xml new file mode 100644 index 00000000..eca70cfe --- /dev/null +++ b/gradledemo/gradledownload/src/main/res/mipmap-anydpi-v26/ic_launcher.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/gradledemo/gradledownload/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml b/gradledemo/gradledownload/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml new file mode 100644 index 00000000..eca70cfe --- /dev/null +++ b/gradledemo/gradledownload/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/gradledemo/gradledownload/src/main/res/mipmap-hdpi/ic_launcher.png b/gradledemo/gradledownload/src/main/res/mipmap-hdpi/ic_launcher.png new file mode 100644 index 00000000..a571e600 Binary files /dev/null and b/gradledemo/gradledownload/src/main/res/mipmap-hdpi/ic_launcher.png differ diff --git a/gradledemo/gradledownload/src/main/res/mipmap-hdpi/ic_launcher_round.png b/gradledemo/gradledownload/src/main/res/mipmap-hdpi/ic_launcher_round.png new file mode 100644 index 00000000..61da551c Binary files /dev/null and b/gradledemo/gradledownload/src/main/res/mipmap-hdpi/ic_launcher_round.png differ diff --git a/gradledemo/gradledownload/src/main/res/mipmap-mdpi/ic_launcher.png b/gradledemo/gradledownload/src/main/res/mipmap-mdpi/ic_launcher.png new file mode 100644 index 00000000..c41dd285 Binary files /dev/null and b/gradledemo/gradledownload/src/main/res/mipmap-mdpi/ic_launcher.png differ diff --git a/gradledemo/gradledownload/src/main/res/mipmap-mdpi/ic_launcher_round.png b/gradledemo/gradledownload/src/main/res/mipmap-mdpi/ic_launcher_round.png new file mode 100644 index 00000000..db5080a7 Binary files /dev/null and b/gradledemo/gradledownload/src/main/res/mipmap-mdpi/ic_launcher_round.png differ diff --git a/gradledemo/gradledownload/src/main/res/mipmap-xhdpi/ic_launcher.png b/gradledemo/gradledownload/src/main/res/mipmap-xhdpi/ic_launcher.png new file mode 100644 index 00000000..6dba46da Binary files /dev/null and b/gradledemo/gradledownload/src/main/res/mipmap-xhdpi/ic_launcher.png differ diff --git a/gradledemo/gradledownload/src/main/res/mipmap-xhdpi/ic_launcher_round.png b/gradledemo/gradledownload/src/main/res/mipmap-xhdpi/ic_launcher_round.png new file mode 100644 index 00000000..da31a871 Binary files /dev/null and b/gradledemo/gradledownload/src/main/res/mipmap-xhdpi/ic_launcher_round.png differ diff --git a/gradledemo/gradledownload/src/main/res/mipmap-xxhdpi/ic_launcher.png b/gradledemo/gradledownload/src/main/res/mipmap-xxhdpi/ic_launcher.png new file mode 100644 index 00000000..15ac6817 Binary files /dev/null and b/gradledemo/gradledownload/src/main/res/mipmap-xxhdpi/ic_launcher.png differ diff --git a/gradledemo/gradledownload/src/main/res/mipmap-xxhdpi/ic_launcher_round.png b/gradledemo/gradledownload/src/main/res/mipmap-xxhdpi/ic_launcher_round.png new file mode 100644 index 00000000..b216f2d3 Binary files /dev/null and b/gradledemo/gradledownload/src/main/res/mipmap-xxhdpi/ic_launcher_round.png differ diff --git a/gradledemo/gradledownload/src/main/res/mipmap-xxxhdpi/ic_launcher.png b/gradledemo/gradledownload/src/main/res/mipmap-xxxhdpi/ic_launcher.png new file mode 100644 index 00000000..f25a4197 Binary files /dev/null and b/gradledemo/gradledownload/src/main/res/mipmap-xxxhdpi/ic_launcher.png differ diff --git a/gradledemo/gradledownload/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png b/gradledemo/gradledownload/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png new file mode 100644 index 00000000..e96783cc Binary files /dev/null and b/gradledemo/gradledownload/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png differ diff --git a/gradledemo/gradledownload/src/main/res/values-bn-rBD/strings.xml b/gradledemo/gradledownload/src/main/res/values-bn-rBD/strings.xml new file mode 100644 index 00000000..3051c36d --- /dev/null +++ b/gradledemo/gradledownload/src/main/res/values-bn-rBD/strings.xml @@ -0,0 +1,3 @@ + + bn-rBD + \ No newline at end of file diff --git a/gradledemo/gradledownload/src/main/res/values-night/themes.xml b/gradledemo/gradledownload/src/main/res/values-night/themes.xml new file mode 100644 index 00000000..bda24f08 --- /dev/null +++ b/gradledemo/gradledownload/src/main/res/values-night/themes.xml @@ -0,0 +1,16 @@ + + + + \ No newline at end of file diff --git a/gradledemo/gradledownload/src/main/res/values/colors.xml b/gradledemo/gradledownload/src/main/res/values/colors.xml new file mode 100644 index 00000000..f8c6127d --- /dev/null +++ b/gradledemo/gradledownload/src/main/res/values/colors.xml @@ -0,0 +1,10 @@ + + + #FFBB86FC + #FF6200EE + #FF3700B3 + #FF03DAC5 + #FF018786 + #FF000000 + #FFFFFFFF + \ No newline at end of file diff --git a/gradledemo/gradledownload/src/main/res/values/strings.xml b/gradledemo/gradledownload/src/main/res/values/strings.xml new file mode 100644 index 00000000..2320261f --- /dev/null +++ b/gradledemo/gradledownload/src/main/res/values/strings.xml @@ -0,0 +1,3 @@ + + gradledownload + \ No newline at end of file diff --git a/gradledemo/gradledownload/src/main/res/values/themes.xml b/gradledemo/gradledownload/src/main/res/values/themes.xml new file mode 100644 index 00000000..39ef7d1e --- /dev/null +++ b/gradledemo/gradledownload/src/main/res/values/themes.xml @@ -0,0 +1,16 @@ + + + + \ No newline at end of file diff --git a/gradledemo/gradledownload/src/test/java/com/fannery/gradledownload/ExampleUnitTest.kt b/gradledemo/gradledownload/src/test/java/com/fannery/gradledownload/ExampleUnitTest.kt new file mode 100644 index 00000000..c1adba37 --- /dev/null +++ b/gradledemo/gradledownload/src/test/java/com/fannery/gradledownload/ExampleUnitTest.kt @@ -0,0 +1,17 @@ +package com.fannery.gradledownload + +import org.junit.Test + +import org.junit.Assert.* + +/** + * Example local unit test, which will execute on the development machine (host). + * + * See [testing documentation](http://d.android.com/tools/testing). + */ +class ExampleUnitTest { + @Test + fun addition_isCorrect() { + assertEquals(4, 2 + 2) + } +} \ No newline at end of file diff --git a/jetpackdir/navigationdemo/src/main/AndroidManifest.xml b/jetpackdir/navigationdemo/src/main/AndroidManifest.xml index e90a48a9..9ff7e133 100644 --- a/jetpackdir/navigationdemo/src/main/AndroidManifest.xml +++ b/jetpackdir/navigationdemo/src/main/AndroidManifest.xml @@ -3,6 +3,7 @@ package="com.example.navigationdemo"> (R.id.textView3).text = "$value" + stepTo(FlowStepFragment::class, Bundle().apply { putInt("KEY", 1 + value) }) // 测试能装几个 + view.findViewById(R.id.stepNext).setOnClickListener { + stepTo(FlowStepFragment::class, Bundle().apply { putInt("KEY", 1 + value) }) + } + view.findViewById(R.id.popBack).setOnClickListener { + popBack() + } + } + + override fun onAttach(activity: Activity) { + super.onAttach(activity) + K.m(javaClass) + } + + override fun onCreateAnimation(transit: Int, enter: Boolean, nextAnim: Int): Animation? { + K.m(javaClass) + return super.onCreateAnimation(transit, enter, nextAnim) + } + + override fun onCreateAnimator(transit: Int, enter: Boolean, nextAnim: Int): Animator? { + K.m(javaClass) + return super.onCreateAnimator(transit, enter, nextAnim) + } + + override fun onCreate(savedInstanceState: Bundle?) { + super.onCreate(savedInstanceState) + K.m(javaClass) + } + + override fun onActivityCreated(savedInstanceState: Bundle?) { + super.onActivityCreated(savedInstanceState) + K.m(javaClass) + } + + override fun onViewStateRestored(savedInstanceState: Bundle?) { + super.onViewStateRestored(savedInstanceState) + K.m(javaClass) + } + + override fun onStart() { + super.onStart() + K.m(javaClass) + } + + override fun onResume() { + super.onResume() + K.m(javaClass) + } + + override fun onSaveInstanceState(outState: Bundle) { + super.onSaveInstanceState(outState) + K.m(javaClass) + } + + override fun onMultiWindowModeChanged(isInMultiWindowMode: Boolean) { + super.onMultiWindowModeChanged(isInMultiWindowMode) + K.m(javaClass) + } + + override fun onPictureInPictureModeChanged(isInPictureInPictureMode: Boolean) { + super.onPictureInPictureModeChanged(isInPictureInPictureMode) + K.m(javaClass) + } + + override fun onPrimaryNavigationFragmentChanged(isPrimaryNavigationFragment: Boolean) { + super.onPrimaryNavigationFragmentChanged(isPrimaryNavigationFragment) + K.m(javaClass) + } + + override fun onPause() { + super.onPause() + K.m(javaClass) + } + + override fun onStop() { + super.onStop() + K.m(javaClass) + } + + override fun onDestroyView() { + super.onDestroyView() + K.m(javaClass) + } + + override fun onDestroy() { + super.onDestroy() + K.m(javaClass) + } + + override fun onDetach() { + super.onDetach() + K.m(javaClass) + } + + override fun onCreateOptionsMenu(menu: Menu, inflater: MenuInflater) { + super.onCreateOptionsMenu(menu, inflater) + K.m(javaClass) + } + + override fun onPrepareOptionsMenu(menu: Menu) { + super.onPrepareOptionsMenu(menu) + K.m(javaClass) + } + + override fun onDestroyOptionsMenu() { + super.onDestroyOptionsMenu() + K.m(javaClass) + } + + override fun onOptionsItemSelected(item: MenuItem): Boolean { + return super.onOptionsItemSelected(item) + K.m(javaClass) + } + + override fun onOptionsMenuClosed(menu: Menu) { + super.onOptionsMenuClosed(menu) + K.m(javaClass) + } + + override fun onContextItemSelected(item: MenuItem): Boolean { + return super.onContextItemSelected(item) + K.m(javaClass) + } + + override fun onAttach(context: Context) { + super.onAttach(context) + K.m(javaClass) + } + + override fun onConfigurationChanged(newConfig: Configuration) { + super.onConfigurationChanged(newConfig) + K.m(javaClass) + } + + override fun onLowMemory() { + super.onLowMemory() + K.m(javaClass) + } + + override fun onCreateContextMenu( + menu: ContextMenu, + v: View, + menuInfo: ContextMenu.ContextMenuInfo? + ) { + super.onCreateContextMenu(menu, v, menuInfo) + K.m(javaClass) + } + + override fun onHiddenChanged(hidden: Boolean) { + super.onHiddenChanged(hidden) + K.m(javaClass) + } + + override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) { + super.onActivityResult(requestCode, resultCode, data) + K.m(javaClass) + } + + override fun onRequestPermissionsResult( + requestCode: Int, + permissions: Array, + grantResults: IntArray + ) { + K.m(javaClass) + super.onRequestPermissionsResult(requestCode, permissions, grantResults) + } + + override fun onGetLayoutInflater(savedInstanceState: Bundle?): LayoutInflater { + K.m(javaClass) + return super.onGetLayoutInflater(savedInstanceState) + } + + override fun onInflate(context: Context, attrs: AttributeSet, savedInstanceState: Bundle?) { + super.onInflate(context, attrs, savedInstanceState) + K.m(javaClass) + } + + override fun onInflate(activity: Activity, attrs: AttributeSet, savedInstanceState: Bundle?) { + super.onInflate(activity, attrs, savedInstanceState) + K.m(javaClass) + } + + override fun onAttachFragment(childFragment: Fragment) { + super.onAttachFragment(childFragment) + K.m(javaClass) + } +} \ No newline at end of file diff --git a/jetpackdir/navigationdemo/src/main/java/com/example/navigationdemo/FragmentExt.kt b/jetpackdir/navigationdemo/src/main/java/com/example/navigationdemo/FragmentExt.kt new file mode 100644 index 00000000..c14d1a78 --- /dev/null +++ b/jetpackdir/navigationdemo/src/main/java/com/example/navigationdemo/FragmentExt.kt @@ -0,0 +1,37 @@ +package com.example.navigationdemo + +import android.os.Bundle +import androidx.fragment.app.Fragment +import androidx.navigation.NavOptions +import androidx.navigation.fragment.FragmentNavigator +import androidx.navigation.fragment.FragmentNavigatorDestinationBuilder +import androidx.navigation.fragment.findNavController +import kotlin.reflect.KClass + +/** + * Time:2021/7/12 11:02 + * Author: + * Description: + */ +fun Fragment.stepTo(kClass: KClass, bundle: Bundle = Bundle()) { + val navController = findNavController() + val finalDestinationId = kClass.hashCode() + val destination = FragmentNavigatorDestinationBuilder( + navController.navigatorProvider.getNavigator(FragmentNavigator::class.java), + finalDestinationId, + kClass + ).build() + if (destination.id != navController.graph.findNode(finalDestinationId)?.id) { + navController.graph.addDestination(destination) + } + navController.navigate( + finalDestinationId, + bundle, + NavOptions.Builder().build(), + null + ) +} + +fun Fragment.popBack() { + findNavController().popBackStack() +} \ No newline at end of file diff --git a/jetpackdir/navigationdemo/src/main/java/com/example/navigationdemo/HomeFragment.kt b/jetpackdir/navigationdemo/src/main/java/com/example/navigationdemo/HomeFragment.kt index 3c91fd9f..f8bd50a4 100644 --- a/jetpackdir/navigationdemo/src/main/java/com/example/navigationdemo/HomeFragment.kt +++ b/jetpackdir/navigationdemo/src/main/java/com/example/navigationdemo/HomeFragment.kt @@ -1,6 +1,15 @@ package com.example.navigationdemo +import android.os.Bundle +import android.view.LayoutInflater +import android.view.View +import android.view.ViewGroup import androidx.fragment.app.Fragment +import androidx.navigation.NavOptions +import androidx.navigation.fragment.FragmentNavigator +import androidx.navigation.fragment.FragmentNavigatorDestinationBuilder +import androidx.navigation.fragment.findNavController +import kotlin.reflect.KClass /** * Time:2021/6/30 09:58 @@ -8,4 +17,37 @@ import androidx.fragment.app.Fragment * Description: */ class HomeFragment : Fragment() { + override fun onCreateView( + inflater: LayoutInflater, + container: ViewGroup?, + savedInstanceState: Bundle? + ): View? { + return inflater.inflate(R.layout.home_fragment, container, false) + } + + override fun onViewCreated(view: View, savedInstanceState: Bundle?) { + super.onViewCreated(view, savedInstanceState) + view.findViewById(R.id.to_step_one).setOnClickListener { + stepTo(FlowStepFragment::class) + } + } + +// private fun stepTo(kClass: KClass) { +// val navController = findNavController() +// val finalDestinationId = kClass.hashCode() +// val destination = FragmentNavigatorDestinationBuilder( +// navController.navigatorProvider.getNavigator(FragmentNavigator::class.java), +// finalDestinationId, +// kClass +// ).build() +// if (destination.id != navController.graph.findNode(finalDestinationId)?.id) { +// navController.graph.addDestination(destination) +// } +// navController.navigate( +// finalDestinationId, +// Bundle(), +// NavOptions.Builder().build(), +// null +// ) +// } } \ No newline at end of file diff --git a/jetpackdir/navigationdemo/src/main/java/com/example/navigationdemo/NestedScrollWebView.java b/jetpackdir/navigationdemo/src/main/java/com/example/navigationdemo/NestedScrollWebView.java new file mode 100644 index 00000000..21a2aadb --- /dev/null +++ b/jetpackdir/navigationdemo/src/main/java/com/example/navigationdemo/NestedScrollWebView.java @@ -0,0 +1,256 @@ +package com.example.navigationdemo; + +import android.content.Context; +import android.util.AttributeSet; +import android.view.MotionEvent; +import android.view.VelocityTracker; +import android.view.ViewConfiguration; +import android.webkit.WebView; +import android.widget.OverScroller; + +import androidx.core.view.NestedScrollingChild2; +import androidx.core.view.NestedScrollingChildHelper; +import androidx.core.view.ViewCompat; + +/** + * 实现 NestedScrollingChild2 可与协调者布局配合使用 + * + * @author qjs + */ +public class NestedScrollWebView extends WebView implements NestedScrollingChild2 { + + private static final String TAG = NestedScrollWebView.class.getSimpleName(); + + + private final int[] mScrollConsumed = new int[2]; + private final int[] mScrollOffset = new int[2]; + + private int mLastMotionY; + + private VelocityTracker mVelocityTracker; + private int mMinimumVelocity; + private int mMaximumVelocity; + private OverScroller mScroller; + private int mLastScrollerY; + + + private final NestedScrollingChildHelper mChildHelper; + + public NestedScrollWebView(Context context) { + this(context, null); + } + + public NestedScrollWebView(Context context, AttributeSet attrs) { + this(context, attrs, 0); + } + + public NestedScrollWebView(Context context, AttributeSet attrs, int defStyleAttr) { + super(context, attrs, defStyleAttr); + mChildHelper = new NestedScrollingChildHelper(this); + setNestedScrollingEnabled(true); + + mScroller = new OverScroller(getContext()); + + final ViewConfiguration configuration = ViewConfiguration.get(getContext()); + mMinimumVelocity = configuration.getScaledMinimumFlingVelocity(); + mMaximumVelocity = configuration.getScaledMaximumFlingVelocity(); + } + + private void initVelocityTrackerIfNotExists() { + if (mVelocityTracker == null) { + mVelocityTracker = VelocityTracker.obtain(); + } + } + + private void recycleVelocityTracker() { + if (mVelocityTracker != null) { + mVelocityTracker.recycle(); + mVelocityTracker = null; + } + } + + public void fling(int velocityY) { + startNestedScroll(ViewCompat.SCROLL_AXIS_VERTICAL, ViewCompat.TYPE_NON_TOUCH); + mScroller.fling(getScrollX(), getScrollY(), // start + 0, velocityY, // velocities + 0, 0, // x + Integer.MIN_VALUE, Integer.MAX_VALUE, // y + 0, 0); // overscroll + mLastScrollerY = getScrollY(); + ViewCompat.postInvalidateOnAnimation(this); + } + + @Override + public void computeScroll() { + super.computeScroll(); + if (mScroller.computeScrollOffset()) { + final int x = mScroller.getCurrX(); + final int y = mScroller.getCurrY(); + int dy = y - mLastScrollerY; + if (dy != 0) { + int scrollY = getScrollY(); + int dyUnConsumed = 0; + int consumedY = dy; + if (scrollY == 0) { + dyUnConsumed = dy; + consumedY = 0; + } else if (scrollY + dy < 0) { + dyUnConsumed = dy + scrollY; + consumedY = -scrollY; + } + + if (!dispatchNestedScroll(0, consumedY, 0, dyUnConsumed, null, + ViewCompat.TYPE_NON_TOUCH)) { + + } + } + + // Finally update the scroll positions and post an invalidation + mLastScrollerY = y; + ViewCompat.postInvalidateOnAnimation(this); + } else { + // We can't scroll any more, so stop any indirect scrolling + if (hasNestedScrollingParent(ViewCompat.TYPE_NON_TOUCH)) { + stopNestedScroll(ViewCompat.TYPE_NON_TOUCH); + } + // and reset the scroller y + mLastScrollerY = 0; + } + } + + @Override + public boolean onTouchEvent(MotionEvent event) { + initVelocityTrackerIfNotExists(); + + MotionEvent vtev = MotionEvent.obtain(event); + + final int actionMasked = event.getAction(); + + switch (actionMasked) { + case MotionEvent.ACTION_DOWN: + mLastMotionY = (int) event.getRawY(); + startNestedScroll(ViewCompat.SCROLL_AXIS_VERTICAL); + mVelocityTracker.addMovement(vtev); + mScroller.computeScrollOffset(); + if (!mScroller.isFinished()) { + mScroller.abortAnimation(); + } + break; + case MotionEvent.ACTION_UP: + final VelocityTracker velocityTracker = mVelocityTracker; + velocityTracker.computeCurrentVelocity(1000, mMaximumVelocity); + int initialVelocity = (int) velocityTracker.getYVelocity(); + if (Math.abs(initialVelocity) > mMinimumVelocity) { + fling(-initialVelocity); + } + case MotionEvent.ACTION_CANCEL: + stopNestedScroll(); + recycleVelocityTracker(); + break; + case MotionEvent.ACTION_MOVE: + final int y = (int) event.getRawY(); + int deltaY = mLastMotionY - y; + if (dispatchNestedPreScroll(0, deltaY, mScrollConsumed, mScrollOffset)) { + vtev.offsetLocation(0, mScrollConsumed[1]); + } + mLastMotionY = y; + + int scrollY = getScrollY(); + + int dyUnconsumed = 0; + if (scrollY == 0) { + dyUnconsumed = deltaY; + } else if (scrollY + deltaY < 0) { + dyUnconsumed = deltaY + scrollY; + vtev.offsetLocation(0, -dyUnconsumed); + } + mVelocityTracker.addMovement(vtev); + boolean result = super.onTouchEvent(vtev); + if (dispatchNestedScroll(0, deltaY - dyUnconsumed, 0, dyUnconsumed, mScrollOffset)) { + + } + return result; + default: + + break; + } + return super.onTouchEvent(vtev); + } + + // NestedScrollingChild + + @Override + public void setNestedScrollingEnabled(boolean enabled) { + mChildHelper.setNestedScrollingEnabled(enabled); + } + + @Override + public boolean isNestedScrollingEnabled() { + return mChildHelper.isNestedScrollingEnabled(); + } + + @Override + public boolean startNestedScroll(int axes) { + return mChildHelper.startNestedScroll(axes); + } + + @Override + public boolean startNestedScroll(int axes, int type) { + return mChildHelper.startNestedScroll(axes, type); + } + + @Override + public void stopNestedScroll() { + mChildHelper.stopNestedScroll(); + } + + @Override + public void stopNestedScroll(int type) { + mChildHelper.stopNestedScroll(type); + } + + @Override + public boolean hasNestedScrollingParent() { + return mChildHelper.hasNestedScrollingParent(); + } + + @Override + public boolean hasNestedScrollingParent(int type) { + return mChildHelper.hasNestedScrollingParent(type); + } + + @Override + public boolean dispatchNestedScroll(int dxConsumed, int dyConsumed, int dxUnconsumed, + int dyUnconsumed, int[] offsetInWindow) { + return mChildHelper.dispatchNestedScroll(dxConsumed, dyConsumed, dxUnconsumed, dyUnconsumed, + offsetInWindow); + } + + @Override + public boolean dispatchNestedScroll(int dxConsumed, int dyConsumed, int dxUnconsumed, + int dyUnconsumed, int[] offsetInWindow, int type) { + return mChildHelper.dispatchNestedScroll(dxConsumed, dyConsumed, dxUnconsumed, dyUnconsumed, + offsetInWindow, type); + } + + @Override + public boolean dispatchNestedPreScroll(int dx, int dy, int[] consumed, int[] offsetInWindow) { + return mChildHelper.dispatchNestedPreScroll(dx, dy, consumed, offsetInWindow); + } + + @Override + public boolean dispatchNestedPreScroll(int dx, int dy, int[] consumed, int[] offsetInWindow, + int type) { + return mChildHelper.dispatchNestedPreScroll(dx, dy, consumed, offsetInWindow, type); + } + + @Override + public boolean dispatchNestedFling(float velocityX, float velocityY, boolean consumed) { + return mChildHelper.dispatchNestedFling(velocityX, velocityY, consumed); + } + + @Override + public boolean dispatchNestedPreFling(float velocityX, float velocityY) { + return mChildHelper.dispatchNestedPreFling(velocityX, velocityY); + } +} \ No newline at end of file diff --git a/jetpackdir/navigationdemo/src/main/java/com/example/navigationdemo/NestedScrollWebView2.java b/jetpackdir/navigationdemo/src/main/java/com/example/navigationdemo/NestedScrollWebView2.java new file mode 100644 index 00000000..77cd23b5 --- /dev/null +++ b/jetpackdir/navigationdemo/src/main/java/com/example/navigationdemo/NestedScrollWebView2.java @@ -0,0 +1,256 @@ +package com.example.navigationdemo; + +import android.content.Context; +import android.util.AttributeSet; +import android.view.MotionEvent; +import android.view.VelocityTracker; +import android.view.ViewConfiguration; +import android.webkit.WebView; +import android.widget.OverScroller; + +import androidx.core.view.NestedScrollingChild2; +import androidx.core.view.NestedScrollingChildHelper; +import androidx.core.view.ViewCompat; + +/** + * 实现 NestedScrollingChild2 可与协调者布局配合使用 + * + * @author qjs + */ +public class NestedScrollWebView2 extends WebView implements NestedScrollingChild2 { + + private static final String TAG = NestedScrollWebView2.class.getSimpleName(); + + + private final int[] mScrollConsumed = new int[2]; + private final int[] mScrollOffset = new int[2]; + + private int mLastMotionY; + + private VelocityTracker mVelocityTracker; + private int mMinimumVelocity; + private int mMaximumVelocity; + private OverScroller mScroller; + private int mLastScrollerY; + + + private final NestedScrollingChildHelper mChildHelper; + + public NestedScrollWebView2(Context context) { + this(context, null); + } + + public NestedScrollWebView2(Context context, AttributeSet attrs) { + this(context, attrs, 0); + } + + public NestedScrollWebView2(Context context, AttributeSet attrs, int defStyleAttr) { + super(context, attrs, defStyleAttr); + mChildHelper = new NestedScrollingChildHelper(this); + setNestedScrollingEnabled(true); + + mScroller = new OverScroller(getContext()); + + final ViewConfiguration configuration = ViewConfiguration.get(getContext()); + mMinimumVelocity = configuration.getScaledMinimumFlingVelocity(); + mMaximumVelocity = configuration.getScaledMaximumFlingVelocity(); + } + + private void initVelocityTrackerIfNotExists() { + if (mVelocityTracker == null) { + mVelocityTracker = VelocityTracker.obtain(); + } + } + + private void recycleVelocityTracker() { + if (mVelocityTracker != null) { + mVelocityTracker.recycle(); + mVelocityTracker = null; + } + } + + public void fling(int velocityY) { + startNestedScroll(ViewCompat.SCROLL_AXIS_VERTICAL, ViewCompat.TYPE_NON_TOUCH); + mScroller.fling(getScrollX(), getScrollY(), // start + 0, velocityY, // velocities + 0, 0, // x + Integer.MIN_VALUE, Integer.MAX_VALUE, // y + 0, 0); // overscroll + mLastScrollerY = getScrollY(); + ViewCompat.postInvalidateOnAnimation(this); + } + + @Override + public void computeScroll() { + super.computeScroll(); + if (mScroller.computeScrollOffset()) { + final int x = mScroller.getCurrX(); + final int y = mScroller.getCurrY(); + int dy = y - mLastScrollerY; + if (dy != 0) { + int scrollY = getScrollY(); + int dyUnConsumed = 0; + int consumedY = dy; + if (scrollY == 0) { + dyUnConsumed = dy; + consumedY = 0; + } else if (scrollY + dy < 0) { + dyUnConsumed = dy + scrollY; + consumedY = -scrollY; + } + + if (!dispatchNestedScroll(0, consumedY, 0, dyUnConsumed, null, + ViewCompat.TYPE_NON_TOUCH)) { + + } + } + + // Finally update the scroll positions and post an invalidation + mLastScrollerY = y; + ViewCompat.postInvalidateOnAnimation(this); + } else { + // We can't scroll any more, so stop any indirect scrolling + if (hasNestedScrollingParent(ViewCompat.TYPE_NON_TOUCH)) { + stopNestedScroll(ViewCompat.TYPE_NON_TOUCH); + } + // and reset the scroller y + mLastScrollerY = 0; + } + } + + @Override + public boolean onTouchEvent(MotionEvent event) { + initVelocityTrackerIfNotExists(); + + MotionEvent vtev = MotionEvent.obtain(event); + + final int actionMasked = event.getAction(); + + switch (actionMasked) { + case MotionEvent.ACTION_DOWN: + mLastMotionY = (int) event.getRawY(); + startNestedScroll(ViewCompat.SCROLL_AXIS_VERTICAL); + mVelocityTracker.addMovement(vtev); + mScroller.computeScrollOffset(); + if (!mScroller.isFinished()) { + mScroller.abortAnimation(); + } + break; + case MotionEvent.ACTION_UP: + final VelocityTracker velocityTracker = mVelocityTracker; + velocityTracker.computeCurrentVelocity(1000, mMaximumVelocity); + int initialVelocity = (int) velocityTracker.getYVelocity(); + if (Math.abs(initialVelocity) > mMinimumVelocity) { + fling(-initialVelocity); + } + case MotionEvent.ACTION_CANCEL: + stopNestedScroll(); + recycleVelocityTracker(); + break; + case MotionEvent.ACTION_MOVE: + final int y = (int) event.getRawY(); + int deltaY = mLastMotionY - y; + if (dispatchNestedPreScroll(0, deltaY, mScrollConsumed, mScrollOffset)) { + vtev.offsetLocation(0, mScrollConsumed[1]); + } + mLastMotionY = y; + + int scrollY = getScrollY(); + + int dyUnconsumed = 0; + if (scrollY == 0) { + dyUnconsumed = deltaY; + } else if (scrollY + deltaY < 0) { + dyUnconsumed = deltaY + scrollY; + vtev.offsetLocation(0, -dyUnconsumed); + } + mVelocityTracker.addMovement(vtev); + boolean result = super.onTouchEvent(vtev); + if (dispatchNestedScroll(0, deltaY - dyUnconsumed, 0, dyUnconsumed, mScrollOffset)) { + + } + return result; + default: + + break; + } + return super.onTouchEvent(vtev); + } + + // NestedScrollingChild + + @Override + public void setNestedScrollingEnabled(boolean enabled) { + mChildHelper.setNestedScrollingEnabled(enabled); + } + + @Override + public boolean isNestedScrollingEnabled() { + return mChildHelper.isNestedScrollingEnabled(); + } + + @Override + public boolean startNestedScroll(int axes) { + return mChildHelper.startNestedScroll(axes); + } + + @Override + public boolean startNestedScroll(int axes, int type) { + return mChildHelper.startNestedScroll(axes, type); + } + + @Override + public void stopNestedScroll() { + mChildHelper.stopNestedScroll(); + } + + @Override + public void stopNestedScroll(int type) { + mChildHelper.stopNestedScroll(type); + } + + @Override + public boolean hasNestedScrollingParent() { + return mChildHelper.hasNestedScrollingParent(); + } + + @Override + public boolean hasNestedScrollingParent(int type) { + return mChildHelper.hasNestedScrollingParent(type); + } + + @Override + public boolean dispatchNestedScroll(int dxConsumed, int dyConsumed, int dxUnconsumed, + int dyUnconsumed, int[] offsetInWindow) { + return mChildHelper.dispatchNestedScroll(dxConsumed, dyConsumed, dxUnconsumed, dyUnconsumed, + offsetInWindow); + } + + @Override + public boolean dispatchNestedScroll(int dxConsumed, int dyConsumed, int dxUnconsumed, + int dyUnconsumed, int[] offsetInWindow, int type) { + return mChildHelper.dispatchNestedScroll(dxConsumed, dyConsumed, dxUnconsumed, dyUnconsumed, + offsetInWindow, type); + } + + @Override + public boolean dispatchNestedPreScroll(int dx, int dy, int[] consumed, int[] offsetInWindow) { + return mChildHelper.dispatchNestedPreScroll(dx, dy, consumed, offsetInWindow); + } + + @Override + public boolean dispatchNestedPreScroll(int dx, int dy, int[] consumed, int[] offsetInWindow, + int type) { + return mChildHelper.dispatchNestedPreScroll(dx, dy, consumed, offsetInWindow, type); + } + + @Override + public boolean dispatchNestedFling(float velocityX, float velocityY, boolean consumed) { + return mChildHelper.dispatchNestedFling(velocityX, velocityY, consumed); + } + + @Override + public boolean dispatchNestedPreFling(float velocityX, float velocityY) { + return mChildHelper.dispatchNestedPreFling(velocityX, velocityY); + } +} \ No newline at end of file diff --git a/jetpackdir/navigationdemo/src/main/java/com/example/navigationdemo/SettingsFragment.kt b/jetpackdir/navigationdemo/src/main/java/com/example/navigationdemo/SettingsFragment.kt new file mode 100644 index 00000000..052bdb20 --- /dev/null +++ b/jetpackdir/navigationdemo/src/main/java/com/example/navigationdemo/SettingsFragment.kt @@ -0,0 +1,22 @@ +package com.example.navigationdemo + +import android.os.Bundle +import android.view.LayoutInflater +import android.view.View +import android.view.ViewGroup +import androidx.fragment.app.Fragment + +/** + * Time:2021/6/30 09:58 + * Author: + * Description: + */ +class SettingsFragment : Fragment() { + override fun onCreateView( + inflater: LayoutInflater, + container: ViewGroup?, + savedInstanceState: Bundle? + ): View? { + return inflater.inflate(R.layout.settings_fragment, container, false) + } +} \ No newline at end of file diff --git a/jetpackdir/navigationdemo/src/main/res/layout/activity_main.xml b/jetpackdir/navigationdemo/src/main/res/layout/activity_main.xml index 4fc24441..cd3a072b 100644 --- a/jetpackdir/navigationdemo/src/main/res/layout/activity_main.xml +++ b/jetpackdir/navigationdemo/src/main/res/layout/activity_main.xml @@ -1,18 +1,21 @@ - - + app:layout_constraintTop_toTopOf="parent" + app:navGraph="@navigation/first_navigation" /> - \ No newline at end of file + \ No newline at end of file diff --git a/jetpackdir/navigationdemo/src/main/res/layout/deeplink_fragment.xml b/jetpackdir/navigationdemo/src/main/res/layout/deeplink_fragment.xml new file mode 100644 index 00000000..7a7ea672 --- /dev/null +++ b/jetpackdir/navigationdemo/src/main/res/layout/deeplink_fragment.xml @@ -0,0 +1,14 @@ + + + + + \ No newline at end of file diff --git a/jetpackdir/navigationdemo/src/main/res/layout/flowstep_fragment.xml b/jetpackdir/navigationdemo/src/main/res/layout/flowstep_fragment.xml new file mode 100644 index 00000000..710e00db --- /dev/null +++ b/jetpackdir/navigationdemo/src/main/res/layout/flowstep_fragment.xml @@ -0,0 +1,37 @@ + + + + + + + + + + + \ No newline at end of file diff --git "a/\346\272\220\347\240\201/webview/fullscreen-video-sample/app/src/main/java/fullscreenvideosample/android/chrome/google/com/fullscreenvideosample/MainActivity.java" "b/\346\272\220\347\240\201/webview/fullscreen-video-sample/app/src/main/java/fullscreenvideosample/android/chrome/google/com/fullscreenvideosample/MainActivity.java" new file mode 100644 index 00000000..cae28676 --- /dev/null +++ "b/\346\272\220\347\240\201/webview/fullscreen-video-sample/app/src/main/java/fullscreenvideosample/android/chrome/google/com/fullscreenvideosample/MainActivity.java" @@ -0,0 +1,273 @@ +package fullscreenvideosample.android.chrome.google.com.fullscreenvideosample; + +import android.annotation.TargetApi; +import android.app.Activity; + +import android.app.ActionBar; +import android.app.Fragment; +import android.app.FragmentManager; +import android.content.Context; +import android.content.pm.ActivityInfo; +import android.graphics.Bitmap; +import android.graphics.BitmapFactory; +import android.os.Build; +import android.os.Bundle; +import android.os.Handler; +import android.view.LayoutInflater; +import android.view.Menu; +import android.view.MenuItem; +import android.view.View; +import android.view.ViewGroup; +import android.support.v4.widget.DrawerLayout; +import android.webkit.WebChromeClient; +import android.webkit.WebSettings; +import android.webkit.WebView; +import android.webkit.WebViewClient; +import android.widget.FrameLayout; + + +public class MainActivity extends Activity + implements NavigationDrawerFragment.NavigationDrawerCallbacks { + + private static final String TAG = MainActivity.class.getSimpleName(); + + /** + * Fragment managing the behaviors, interactions and presentation of the navigation drawer. + */ + private NavigationDrawerFragment mNavigationDrawerFragment; + + /** + * Used to store the last screen title. For use in {@link #restoreActionBar()}. + */ + private CharSequence mTitle; + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_main); + + mNavigationDrawerFragment = (NavigationDrawerFragment) + getFragmentManager().findFragmentById(R.id.navigation_drawer); + mTitle = getTitle(); + + // Set up the drawer. + mNavigationDrawerFragment.setUp( + R.id.navigation_drawer, + (DrawerLayout) findViewById(R.id.drawer_layout)); + } + + @Override + public void onNavigationDrawerItemSelected(int position) { + // update the main content by replacing fragments + FragmentManager fragmentManager = getFragmentManager(); + fragmentManager.beginTransaction() + .replace(R.id.container, PlaceholderFragment.newInstance(position + 1)) + .commit(); + } + + public void onSectionAttached(int number) { + switch (number) { + case 1: + mTitle = getString(R.string.title_section1); + break; + case 2: + mTitle = getString(R.string.title_section2); + break; + case 3: + mTitle = getString(R.string.title_section3); + break; + } + } + + public void restoreActionBar() { + ActionBar actionBar = getActionBar(); + actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD); + actionBar.setDisplayShowTitleEnabled(true); + actionBar.setTitle(mTitle); + } + + + @Override + public boolean onCreateOptionsMenu(Menu menu) { + if (!mNavigationDrawerFragment.isDrawerOpen()) { + // Only show items in the action bar relevant to this screen + // if the drawer is not showing. Otherwise, let the drawer + // decide what to show in the action bar. + getMenuInflater().inflate(R.menu.main, menu); + restoreActionBar(); + return true; + } + return super.onCreateOptionsMenu(menu); + } + + @Override + public boolean onOptionsItemSelected(MenuItem item) { + // Handle action bar item clicks here. The action bar will + // automatically handle clicks on the Home/Up button, so long + // as you specify a parent activity in AndroidManifest.xml. + int id = item.getItemId(); + if (id == R.id.action_settings) { + return true; + } + return super.onOptionsItemSelected(item); + } + + /** + * A placeholder fragment containing a simple view. + */ + public static class PlaceholderFragment extends Fragment { + /** + * The fragment argument representing the section number for this + * fragment. + */ + private static final String ARG_SECTION_NUMBER = "section_number"; + + /** + * Returns a new instance of this fragment for the given section + * number. + */ + public static PlaceholderFragment newInstance(int sectionNumber) { + PlaceholderFragment fragment = new PlaceholderFragment(); + Bundle args = new Bundle(); + args.putInt(ARG_SECTION_NUMBER, sectionNumber); + fragment.setArguments(args); + return fragment; + } + + private WebView mWebView; + private View mCustomView; + private int mOriginalSystemUiVisibility; + private int mOriginalOrientation; + private WebChromeClient.CustomViewCallback mCustomViewCallback; + protected FrameLayout mFullscreenContainer; + private Handler mHandler; + + public PlaceholderFragment() { + mHandler = new Handler(); + } + + @Override + public View onCreateView(LayoutInflater inflater, ViewGroup container, + Bundle savedInstanceState) { + View rootView = inflater.inflate(R.layout.fragment_main, container, false); + mWebView = (WebView) rootView.findViewById(R.id.fragment_main_webview); + + setUpWebViewDefaults(mWebView); + + mWebView.loadUrl("file:///android_asset/www/index.html"); + + mWebView.setWebChromeClient(new WebChromeClient() { + + @Override + public Bitmap getDefaultVideoPoster() { + if(getActivity() == null) { + return null; + } + + return BitmapFactory.decodeResource(getActivity().getApplicationContext().getResources(), + R.drawable.video_poster); + } + + @Override + public void onShowCustomView(View view, + WebChromeClient.CustomViewCallback callback) { + // if a view already exists then immediately terminate the new one + if (mCustomView != null) { + onHideCustomView(); + return; + } + + // 1. Stash the current state + mCustomView = view; + mOriginalSystemUiVisibility = getActivity().getWindow().getDecorView().getSystemUiVisibility(); + mOriginalOrientation = getActivity().getRequestedOrientation(); + + // 2. Stash the custom view callback + mCustomViewCallback = callback; + + // 3. Add the custom view to the view hierarchy + FrameLayout decor = (FrameLayout) getActivity().getWindow().getDecorView(); + decor.addView(mCustomView, new FrameLayout.LayoutParams( + ViewGroup.LayoutParams.MATCH_PARENT, + ViewGroup.LayoutParams.MATCH_PARENT)); + + + // 4. Change the state of the window + getActivity().getWindow().getDecorView().setSystemUiVisibility( + View.SYSTEM_UI_FLAG_LAYOUT_STABLE | + View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION | + View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN | + View.SYSTEM_UI_FLAG_HIDE_NAVIGATION | + View.SYSTEM_UI_FLAG_FULLSCREEN | + View.SYSTEM_UI_FLAG_IMMERSIVE); + getActivity().setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE); + } + + @Override + public void onHideCustomView() { + // 1. Remove the custom view + FrameLayout decor = (FrameLayout) getActivity().getWindow().getDecorView(); + decor.removeView(mCustomView); + mCustomView = null; + + // 2. Restore the state to it's original form + getActivity().getWindow().getDecorView() + .setSystemUiVisibility(mOriginalSystemUiVisibility); + getActivity().setRequestedOrientation(mOriginalOrientation); + + // 3. Call the custom view callback + mCustomViewCallback.onCustomViewHidden(); + mCustomViewCallback = null; + + } + + }); + + return rootView; + } + + @Override + public void onAttach(Activity activity) { + super.onAttach(activity); + ((MainActivity) activity).onSectionAttached( + getArguments().getInt(ARG_SECTION_NUMBER)); + } + + /** + * Convenience method to set some generic defaults for a + * given WebView + * + * @param webView + */ + @TargetApi(Build.VERSION_CODES.HONEYCOMB) + private void setUpWebViewDefaults(WebView webView) { + WebSettings settings = webView.getSettings(); + + // Enable Javascript + settings.setJavaScriptEnabled(true); + + // Use WideViewport and Zoom out if there is no viewport defined + settings.setUseWideViewPort(true); + settings.setLoadWithOverviewMode(true); + + // Enable pinch to zoom without the zoom buttons + settings.setBuiltInZoomControls(true); + + // Allow use of Local Storage + settings.setDomStorageEnabled(true); + + if(Build.VERSION.SDK_INT > Build.VERSION_CODES.HONEYCOMB) { + // Hide the zoom controls for HONEYCOMB+ + settings.setDisplayZoomControls(false); + } + + // Enable remote debugging via chrome://inspect + if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) { + WebView.setWebContentsDebuggingEnabled(true); + } + + webView.setWebViewClient(new WebViewClient()); + } + } + +} diff --git "a/\346\272\220\347\240\201/webview/fullscreen-video-sample/app/src/main/java/fullscreenvideosample/android/chrome/google/com/fullscreenvideosample/NavigationDrawerFragment.java" "b/\346\272\220\347\240\201/webview/fullscreen-video-sample/app/src/main/java/fullscreenvideosample/android/chrome/google/com/fullscreenvideosample/NavigationDrawerFragment.java" new file mode 100644 index 00000000..9c824114 --- /dev/null +++ "b/\346\272\220\347\240\201/webview/fullscreen-video-sample/app/src/main/java/fullscreenvideosample/android/chrome/google/com/fullscreenvideosample/NavigationDrawerFragment.java" @@ -0,0 +1,277 @@ +package fullscreenvideosample.android.chrome.google.com.fullscreenvideosample; + + +import android.app.Activity; +import android.app.ActionBar; +import android.app.Fragment; +import android.support.v4.app.ActionBarDrawerToggle; +import android.support.v4.view.GravityCompat; +import android.support.v4.widget.DrawerLayout; +import android.content.SharedPreferences; +import android.content.res.Configuration; +import android.os.Bundle; +import android.preference.PreferenceManager; +import android.view.LayoutInflater; +import android.view.Menu; +import android.view.MenuInflater; +import android.view.MenuItem; +import android.view.View; +import android.view.ViewGroup; +import android.widget.AdapterView; +import android.widget.ArrayAdapter; +import android.widget.ListView; +import android.widget.Toast; + +/** + * Fragment used for managing interactions for and presentation of a navigation drawer. + * See the + * design guidelines for a complete explanation of the behaviors implemented here. + */ +public class NavigationDrawerFragment extends Fragment { + + /** + * Remember the position of the selected item. + */ + private static final String STATE_SELECTED_POSITION = "selected_navigation_drawer_position"; + + /** + * Per the design guidelines, you should show the drawer on launch until the user manually + * expands it. This shared preference tracks this. + */ + private static final String PREF_USER_LEARNED_DRAWER = "navigation_drawer_learned"; + + /** + * A pointer to the current callbacks instance (the Activity). + */ + private NavigationDrawerCallbacks mCallbacks; + + /** + * Helper component that ties the action bar to the navigation drawer. + */ + private ActionBarDrawerToggle mDrawerToggle; + + private DrawerLayout mDrawerLayout; + private ListView mDrawerListView; + private View mFragmentContainerView; + + private int mCurrentSelectedPosition = 0; + private boolean mFromSavedInstanceState; + private boolean mUserLearnedDrawer; + + public NavigationDrawerFragment() { + } + + @Override + public void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + + // Read in the flag indicating whether or not the user has demonstrated awareness of the + // drawer. See PREF_USER_LEARNED_DRAWER for details. + SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(getActivity()); + mUserLearnedDrawer = sp.getBoolean(PREF_USER_LEARNED_DRAWER, false); + + if (savedInstanceState != null) { + mCurrentSelectedPosition = savedInstanceState.getInt(STATE_SELECTED_POSITION); + mFromSavedInstanceState = true; + } + + // Select either the default item (0) or the last selected item. + selectItem(mCurrentSelectedPosition); + } + + @Override + public void onActivityCreated (Bundle savedInstanceState) { + super.onActivityCreated(savedInstanceState); + // Indicate that this fragment would like to influence the set of actions in the action bar. + setHasOptionsMenu(true); + } + + @Override + public View onCreateView(LayoutInflater inflater, ViewGroup container, + Bundle savedInstanceState) { + mDrawerListView = (ListView) inflater.inflate( + R.layout.fragment_navigation_drawer, container, false); + mDrawerListView.setOnItemClickListener(new AdapterView.OnItemClickListener() { + @Override + public void onItemClick(AdapterView parent, View view, int position, long id) { + selectItem(position); + } + }); + mDrawerListView.setAdapter(new ArrayAdapter( + getActionBar().getThemedContext(), + android.R.layout.simple_list_item_activated_1, + android.R.id.text1, + new String[]{ + getString(R.string.title_section1), + getString(R.string.title_section2), + getString(R.string.title_section3), + })); + mDrawerListView.setItemChecked(mCurrentSelectedPosition, true); + return mDrawerListView; + } + + public boolean isDrawerOpen() { + return mDrawerLayout != null && mDrawerLayout.isDrawerOpen(mFragmentContainerView); + } + + /** + * Users of this fragment must call this method to set up the navigation drawer interactions. + * + * @param fragmentId The android:id of this fragment in its activity's layout. + * @param drawerLayout The DrawerLayout containing this fragment's UI. + */ + public void setUp(int fragmentId, DrawerLayout drawerLayout) { + mFragmentContainerView = getActivity().findViewById(fragmentId); + mDrawerLayout = drawerLayout; + + // set a custom shadow that overlays the main content when the drawer opens + mDrawerLayout.setDrawerShadow(R.drawable.drawer_shadow, GravityCompat.START); + // set up the drawer's list view with items and click listener + + ActionBar actionBar = getActionBar(); + actionBar.setDisplayHomeAsUpEnabled(true); + actionBar.setHomeButtonEnabled(true); + + // ActionBarDrawerToggle ties together the the proper interactions + // between the navigation drawer and the action bar app icon. + mDrawerToggle = new ActionBarDrawerToggle( + getActivity(), /* host Activity */ + mDrawerLayout, /* DrawerLayout object */ + R.drawable.ic_drawer, /* nav drawer image to replace 'Up' caret */ + R.string.navigation_drawer_open, /* "open drawer" description for accessibility */ + R.string.navigation_drawer_close /* "close drawer" description for accessibility */ + ) { + @Override + public void onDrawerClosed(View drawerView) { + super.onDrawerClosed(drawerView); + if (!isAdded()) { + return; + } + + getActivity().invalidateOptionsMenu(); // calls onPrepareOptionsMenu() + } + + @Override + public void onDrawerOpened(View drawerView) { + super.onDrawerOpened(drawerView); + if (!isAdded()) { + return; + } + + if (!mUserLearnedDrawer) { + // The user manually opened the drawer; store this flag to prevent auto-showing + // the navigation drawer automatically in the future. + mUserLearnedDrawer = true; + SharedPreferences sp = PreferenceManager + .getDefaultSharedPreferences(getActivity()); + sp.edit().putBoolean(PREF_USER_LEARNED_DRAWER, true).apply(); + } + + getActivity().invalidateOptionsMenu(); // calls onPrepareOptionsMenu() + } + }; + + // If the user hasn't 'learned' about the drawer, open it to introduce them to the drawer, + // per the navigation drawer design guidelines. + //if (!mUserLearnedDrawer && !mFromSavedInstanceState) { + // mDrawerLayout.openDrawer(mFragmentContainerView); + //} + + // Defer code dependent on restoration of previous instance state. + mDrawerLayout.post(new Runnable() { + @Override + public void run() { + mDrawerToggle.syncState(); + } + }); + + mDrawerLayout.setDrawerListener(mDrawerToggle); + } + + private void selectItem(int position) { + mCurrentSelectedPosition = position; + if (mDrawerListView != null) { + mDrawerListView.setItemChecked(position, true); + } + if (mDrawerLayout != null) { + mDrawerLayout.closeDrawer(mFragmentContainerView); + } + if (mCallbacks != null) { + mCallbacks.onNavigationDrawerItemSelected(position); + } + } + + @Override + public void onAttach(Activity activity) { + super.onAttach(activity); + try { + mCallbacks = (NavigationDrawerCallbacks) activity; + } catch (ClassCastException e) { + throw new ClassCastException("Activity must implement NavigationDrawerCallbacks."); + } + } + + @Override + public void onDetach() { + super.onDetach(); + mCallbacks = null; + } + + @Override + public void onSaveInstanceState(Bundle outState) { + super.onSaveInstanceState(outState); + outState.putInt(STATE_SELECTED_POSITION, mCurrentSelectedPosition); + } + + @Override + public void onConfigurationChanged(Configuration newConfig) { + super.onConfigurationChanged(newConfig); + // Forward the new configuration the drawer toggle component. + mDrawerToggle.onConfigurationChanged(newConfig); + } + + @Override + public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) { + // If the drawer is open, show the global app actions in the action bar. See also + // showGlobalContextActionBar, which controls the top-left area of the action bar. + if (mDrawerLayout != null && isDrawerOpen()) { + inflater.inflate(R.menu.global, menu); + showGlobalContextActionBar(); + } + super.onCreateOptionsMenu(menu, inflater); + } + + @Override + public boolean onOptionsItemSelected(MenuItem item) { + if (mDrawerToggle.onOptionsItemSelected(item)) { + return true; + } + + return super.onOptionsItemSelected(item); + } + + /** + * Per the navigation drawer design guidelines, updates the action bar to show the global app + * 'context', rather than just what's in the current screen. + */ + private void showGlobalContextActionBar() { + ActionBar actionBar = getActionBar(); + actionBar.setDisplayShowTitleEnabled(true); + actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD); + actionBar.setTitle(R.string.app_name); + } + + private ActionBar getActionBar() { + return getActivity().getActionBar(); + } + + /** + * Callbacks interface that all activities using this fragment must implement. + */ + public static interface NavigationDrawerCallbacks { + /** + * Called when an item in the navigation drawer is selected. + */ + void onNavigationDrawerItemSelected(int position); + } +} diff --git "a/\346\272\220\347\240\201/webview/fullscreen-video-sample/app/src/main/res/drawable-hdpi/drawer_shadow.9.png" "b/\346\272\220\347\240\201/webview/fullscreen-video-sample/app/src/main/res/drawable-hdpi/drawer_shadow.9.png" new file mode 100644 index 00000000..236bff55 Binary files /dev/null and "b/\346\272\220\347\240\201/webview/fullscreen-video-sample/app/src/main/res/drawable-hdpi/drawer_shadow.9.png" differ diff --git "a/\346\272\220\347\240\201/webview/fullscreen-video-sample/app/src/main/res/drawable-hdpi/ic_drawer.png" "b/\346\272\220\347\240\201/webview/fullscreen-video-sample/app/src/main/res/drawable-hdpi/ic_drawer.png" new file mode 100644 index 00000000..c59f601c Binary files /dev/null and "b/\346\272\220\347\240\201/webview/fullscreen-video-sample/app/src/main/res/drawable-hdpi/ic_drawer.png" differ diff --git "a/\346\272\220\347\240\201/webview/fullscreen-video-sample/app/src/main/res/drawable-hdpi/ic_launcher.png" "b/\346\272\220\347\240\201/webview/fullscreen-video-sample/app/src/main/res/drawable-hdpi/ic_launcher.png" new file mode 100644 index 00000000..96a442e5 Binary files /dev/null and "b/\346\272\220\347\240\201/webview/fullscreen-video-sample/app/src/main/res/drawable-hdpi/ic_launcher.png" differ diff --git "a/\346\272\220\347\240\201/webview/fullscreen-video-sample/app/src/main/res/drawable-mdpi/drawer_shadow.9.png" "b/\346\272\220\347\240\201/webview/fullscreen-video-sample/app/src/main/res/drawable-mdpi/drawer_shadow.9.png" new file mode 100644 index 00000000..ffe3a28d Binary files /dev/null and "b/\346\272\220\347\240\201/webview/fullscreen-video-sample/app/src/main/res/drawable-mdpi/drawer_shadow.9.png" differ diff --git "a/\346\272\220\347\240\201/webview/fullscreen-video-sample/app/src/main/res/drawable-mdpi/ic_drawer.png" "b/\346\272\220\347\240\201/webview/fullscreen-video-sample/app/src/main/res/drawable-mdpi/ic_drawer.png" new file mode 100644 index 00000000..1ed2c56e Binary files /dev/null and "b/\346\272\220\347\240\201/webview/fullscreen-video-sample/app/src/main/res/drawable-mdpi/ic_drawer.png" differ diff --git "a/\346\272\220\347\240\201/webview/fullscreen-video-sample/app/src/main/res/drawable-mdpi/ic_launcher.png" "b/\346\272\220\347\240\201/webview/fullscreen-video-sample/app/src/main/res/drawable-mdpi/ic_launcher.png" new file mode 100644 index 00000000..359047df Binary files /dev/null and "b/\346\272\220\347\240\201/webview/fullscreen-video-sample/app/src/main/res/drawable-mdpi/ic_launcher.png" differ diff --git "a/\346\272\220\347\240\201/webview/fullscreen-video-sample/app/src/main/res/drawable-xhdpi/drawer_shadow.9.png" "b/\346\272\220\347\240\201/webview/fullscreen-video-sample/app/src/main/res/drawable-xhdpi/drawer_shadow.9.png" new file mode 100644 index 00000000..fabe9d96 Binary files /dev/null and "b/\346\272\220\347\240\201/webview/fullscreen-video-sample/app/src/main/res/drawable-xhdpi/drawer_shadow.9.png" differ diff --git "a/\346\272\220\347\240\201/webview/fullscreen-video-sample/app/src/main/res/drawable-xhdpi/ic_drawer.png" "b/\346\272\220\347\240\201/webview/fullscreen-video-sample/app/src/main/res/drawable-xhdpi/ic_drawer.png" new file mode 100644 index 00000000..a5fa74de Binary files /dev/null and "b/\346\272\220\347\240\201/webview/fullscreen-video-sample/app/src/main/res/drawable-xhdpi/ic_drawer.png" differ diff --git "a/\346\272\220\347\240\201/webview/fullscreen-video-sample/app/src/main/res/drawable-xhdpi/ic_launcher.png" "b/\346\272\220\347\240\201/webview/fullscreen-video-sample/app/src/main/res/drawable-xhdpi/ic_launcher.png" new file mode 100644 index 00000000..71c6d760 Binary files /dev/null and "b/\346\272\220\347\240\201/webview/fullscreen-video-sample/app/src/main/res/drawable-xhdpi/ic_launcher.png" differ diff --git "a/\346\272\220\347\240\201/webview/fullscreen-video-sample/app/src/main/res/drawable-xxhdpi/drawer_shadow.9.png" "b/\346\272\220\347\240\201/webview/fullscreen-video-sample/app/src/main/res/drawable-xxhdpi/drawer_shadow.9.png" new file mode 100644 index 00000000..b91e9d7f Binary files /dev/null and "b/\346\272\220\347\240\201/webview/fullscreen-video-sample/app/src/main/res/drawable-xxhdpi/drawer_shadow.9.png" differ diff --git "a/\346\272\220\347\240\201/webview/fullscreen-video-sample/app/src/main/res/drawable-xxhdpi/ic_drawer.png" "b/\346\272\220\347\240\201/webview/fullscreen-video-sample/app/src/main/res/drawable-xxhdpi/ic_drawer.png" new file mode 100644 index 00000000..9c4685d6 Binary files /dev/null and "b/\346\272\220\347\240\201/webview/fullscreen-video-sample/app/src/main/res/drawable-xxhdpi/ic_drawer.png" differ diff --git "a/\346\272\220\347\240\201/webview/fullscreen-video-sample/app/src/main/res/drawable-xxhdpi/ic_launcher.png" "b/\346\272\220\347\240\201/webview/fullscreen-video-sample/app/src/main/res/drawable-xxhdpi/ic_launcher.png" new file mode 100644 index 00000000..4df18946 Binary files /dev/null and "b/\346\272\220\347\240\201/webview/fullscreen-video-sample/app/src/main/res/drawable-xxhdpi/ic_launcher.png" differ diff --git "a/\346\272\220\347\240\201/webview/fullscreen-video-sample/app/src/main/res/drawable-xxhdpi/video_poster.png" "b/\346\272\220\347\240\201/webview/fullscreen-video-sample/app/src/main/res/drawable-xxhdpi/video_poster.png" new file mode 100644 index 00000000..798e5288 Binary files /dev/null and "b/\346\272\220\347\240\201/webview/fullscreen-video-sample/app/src/main/res/drawable-xxhdpi/video_poster.png" differ diff --git "a/\346\272\220\347\240\201/webview/fullscreen-video-sample/app/src/main/res/layout/activity_main.xml" "b/\346\272\220\347\240\201/webview/fullscreen-video-sample/app/src/main/res/layout/activity_main.xml" new file mode 100644 index 00000000..2e8683e3 --- /dev/null +++ "b/\346\272\220\347\240\201/webview/fullscreen-video-sample/app/src/main/res/layout/activity_main.xml" @@ -0,0 +1,31 @@ + + + + + + + + + + + diff --git "a/\346\272\220\347\240\201/webview/fullscreen-video-sample/app/src/main/res/layout/fragment_main.xml" "b/\346\272\220\347\240\201/webview/fullscreen-video-sample/app/src/main/res/layout/fragment_main.xml" new file mode 100644 index 00000000..363cdfa6 --- /dev/null +++ "b/\346\272\220\347\240\201/webview/fullscreen-video-sample/app/src/main/res/layout/fragment_main.xml" @@ -0,0 +1,12 @@ + + + + + diff --git "a/\346\272\220\347\240\201/webview/fullscreen-video-sample/app/src/main/res/layout/fragment_navigation_drawer.xml" "b/\346\272\220\347\240\201/webview/fullscreen-video-sample/app/src/main/res/layout/fragment_navigation_drawer.xml" new file mode 100644 index 00000000..5250946a --- /dev/null +++ "b/\346\272\220\347\240\201/webview/fullscreen-video-sample/app/src/main/res/layout/fragment_navigation_drawer.xml" @@ -0,0 +1,9 @@ + diff --git "a/\346\272\220\347\240\201/webview/fullscreen-video-sample/app/src/main/res/menu/global.xml" "b/\346\272\220\347\240\201/webview/fullscreen-video-sample/app/src/main/res/menu/global.xml" new file mode 100644 index 00000000..f3b10b6c --- /dev/null +++ "b/\346\272\220\347\240\201/webview/fullscreen-video-sample/app/src/main/res/menu/global.xml" @@ -0,0 +1,6 @@ + + + diff --git "a/\346\272\220\347\240\201/webview/fullscreen-video-sample/app/src/main/res/menu/main.xml" "b/\346\272\220\347\240\201/webview/fullscreen-video-sample/app/src/main/res/menu/main.xml" new file mode 100644 index 00000000..5478ac14 --- /dev/null +++ "b/\346\272\220\347\240\201/webview/fullscreen-video-sample/app/src/main/res/menu/main.xml" @@ -0,0 +1,4 @@ + + diff --git "a/\346\272\220\347\240\201/webview/fullscreen-video-sample/app/src/main/res/values-v21/styles.xml" "b/\346\272\220\347\240\201/webview/fullscreen-video-sample/app/src/main/res/values-v21/styles.xml" new file mode 100644 index 00000000..dba3c417 --- /dev/null +++ "b/\346\272\220\347\240\201/webview/fullscreen-video-sample/app/src/main/res/values-v21/styles.xml" @@ -0,0 +1,5 @@ + + + + diff --git "a/\346\272\220\347\240\201/webview/fullscreen-video-sample/app/src/main/res/values-w820dp/dimens.xml" "b/\346\272\220\347\240\201/webview/fullscreen-video-sample/app/src/main/res/values-w820dp/dimens.xml" new file mode 100644 index 00000000..63fc8164 --- /dev/null +++ "b/\346\272\220\347\240\201/webview/fullscreen-video-sample/app/src/main/res/values-w820dp/dimens.xml" @@ -0,0 +1,6 @@ + + + 64dp + diff --git "a/\346\272\220\347\240\201/webview/fullscreen-video-sample/app/src/main/res/values/dimens.xml" "b/\346\272\220\347\240\201/webview/fullscreen-video-sample/app/src/main/res/values/dimens.xml" new file mode 100644 index 00000000..074e7a03 --- /dev/null +++ "b/\346\272\220\347\240\201/webview/fullscreen-video-sample/app/src/main/res/values/dimens.xml" @@ -0,0 +1,9 @@ + + + 16dp + 16dp + + + 240dp + diff --git "a/\346\272\220\347\240\201/webview/fullscreen-video-sample/app/src/main/res/values/strings.xml" "b/\346\272\220\347\240\201/webview/fullscreen-video-sample/app/src/main/res/values/strings.xml" new file mode 100644 index 00000000..4a732576 --- /dev/null +++ "b/\346\272\220\347\240\201/webview/fullscreen-video-sample/app/src/main/res/values/strings.xml" @@ -0,0 +1,13 @@ + + + + Fullscreen Video Sample + Section 1 + Section 2 + Section 3 + Open navigation drawer + Close navigation drawer + Example action + Settings + + diff --git "a/\346\272\220\347\240\201/webview/fullscreen-video-sample/app/src/main/res/values/styles.xml" "b/\346\272\220\347\240\201/webview/fullscreen-video-sample/app/src/main/res/values/styles.xml" new file mode 100644 index 00000000..ff6c9d2c --- /dev/null +++ "b/\346\272\220\347\240\201/webview/fullscreen-video-sample/app/src/main/res/values/styles.xml" @@ -0,0 +1,8 @@ + + + + + + diff --git "a/\346\272\220\347\240\201/webview/fullscreen-video-sample/build.gradle" "b/\346\272\220\347\240\201/webview/fullscreen-video-sample/build.gradle" new file mode 100644 index 00000000..9b8abe4f --- /dev/null +++ "b/\346\272\220\347\240\201/webview/fullscreen-video-sample/build.gradle" @@ -0,0 +1,19 @@ +// Top-level build file where you can add configuration options common to all sub-projects/modules. + +buildscript { + repositories { + jcenter() + } + dependencies { + classpath 'com.android.tools.build:gradle:0.12.2' + + // NOTE: Do not place your application dependencies here; they belong + // in the individual module build.gradle files + } +} + +allprojects { + repositories { + jcenter() + } +} diff --git "a/\346\272\220\347\240\201/webview/fullscreen-video-sample/gradle.properties" "b/\346\272\220\347\240\201/webview/fullscreen-video-sample/gradle.properties" new file mode 100644 index 00000000..5d08ba75 --- /dev/null +++ "b/\346\272\220\347\240\201/webview/fullscreen-video-sample/gradle.properties" @@ -0,0 +1,18 @@ +# Project-wide Gradle settings. + +# IDE (e.g. Android Studio) users: +# Settings specified in this file will override any Gradle settings +# configured through the IDE. + +# For more details on how to configure your build environment visit +# http://www.gradle.org/docs/current/userguide/build_environment.html + +# Specifies the JVM arguments used for the daemon process. +# The setting is particularly useful for tweaking memory settings. +# Default value: -Xmx10248m -XX:MaxPermSize=256m +# org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 + +# When configured, Gradle will run in incubating parallel mode. +# This option should only be used with decoupled projects. More details, visit +# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects +# org.gradle.parallel=true \ No newline at end of file diff --git "a/\346\272\220\347\240\201/webview/fullscreen-video-sample/gradle/wrapper/gradle-wrapper.jar" "b/\346\272\220\347\240\201/webview/fullscreen-video-sample/gradle/wrapper/gradle-wrapper.jar" new file mode 100644 index 00000000..8c0fb64a Binary files /dev/null and "b/\346\272\220\347\240\201/webview/fullscreen-video-sample/gradle/wrapper/gradle-wrapper.jar" differ diff --git "a/\346\272\220\347\240\201/webview/fullscreen-video-sample/gradle/wrapper/gradle-wrapper.properties" "b/\346\272\220\347\240\201/webview/fullscreen-video-sample/gradle/wrapper/gradle-wrapper.properties" new file mode 100644 index 00000000..1e61d1fd --- /dev/null +++ "b/\346\272\220\347\240\201/webview/fullscreen-video-sample/gradle/wrapper/gradle-wrapper.properties" @@ -0,0 +1,6 @@ +#Wed Apr 10 15:27:10 PDT 2013 +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists +distributionUrl=http\://services.gradle.org/distributions/gradle-1.12-all.zip diff --git "a/\346\272\220\347\240\201/webview/fullscreen-video-sample/gradlew" "b/\346\272\220\347\240\201/webview/fullscreen-video-sample/gradlew" new file mode 100755 index 00000000..91a7e269 --- /dev/null +++ "b/\346\272\220\347\240\201/webview/fullscreen-video-sample/gradlew" @@ -0,0 +1,164 @@ +#!/usr/bin/env bash + +############################################################################## +## +## Gradle start up script for UN*X +## +############################################################################## + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS="" + +APP_NAME="Gradle" +APP_BASE_NAME=`basename "$0"` + +# Use the maximum available, or set MAX_FD != -1 to use that value. +MAX_FD="maximum" + +warn ( ) { + echo "$*" +} + +die ( ) { + echo + echo "$*" + echo + exit 1 +} + +# OS specific support (must be 'true' or 'false'). +cygwin=false +msys=false +darwin=false +case "`uname`" in + CYGWIN* ) + cygwin=true + ;; + Darwin* ) + darwin=true + ;; + MINGW* ) + msys=true + ;; +esac + +# For Cygwin, ensure paths are in UNIX format before anything is touched. +if $cygwin ; then + [ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"` +fi + +# Attempt to set APP_HOME +# Resolve links: $0 may be a link +PRG="$0" +# Need this for relative symlinks. +while [ -h "$PRG" ] ; do + ls=`ls -ld "$PRG"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + PRG="$link" + else + PRG=`dirname "$PRG"`"/$link" + fi +done +SAVED="`pwd`" +cd "`dirname \"$PRG\"`/" >&- +APP_HOME="`pwd -P`" +cd "$SAVED" >&- + +CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar + +# Determine the Java command to use to start the JVM. +if [ -n "$JAVA_HOME" ] ; then + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD="$JAVA_HOME/jre/sh/java" + else + JAVACMD="$JAVA_HOME/bin/java" + fi + if [ ! -x "$JAVACMD" ] ; then + die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + fi +else + JAVACMD="java" + which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." +fi + +# Increase the maximum file descriptors if we can. +if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then + MAX_FD_LIMIT=`ulimit -H -n` + if [ $? -eq 0 ] ; then + if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then + MAX_FD="$MAX_FD_LIMIT" + fi + ulimit -n $MAX_FD + if [ $? -ne 0 ] ; then + warn "Could not set maximum file descriptor limit: $MAX_FD" + fi + else + warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" + fi +fi + +# For Darwin, add options to specify how the application appears in the dock +if $darwin; then + GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" +fi + +# For Cygwin, switch paths to Windows format before running java +if $cygwin ; then + APP_HOME=`cygpath --path --mixed "$APP_HOME"` + CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` + + # We build the pattern for arguments to be converted via cygpath + ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` + SEP="" + for dir in $ROOTDIRSRAW ; do + ROOTDIRS="$ROOTDIRS$SEP$dir" + SEP="|" + done + OURCYGPATTERN="(^($ROOTDIRS))" + # Add a user-defined pattern to the cygpath arguments + if [ "$GRADLE_CYGPATTERN" != "" ] ; then + OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" + fi + # Now convert the arguments - kludge to limit ourselves to /bin/sh + i=0 + for arg in "$@" ; do + CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` + CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option + + if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition + eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` + else + eval `echo args$i`="\"$arg\"" + fi + i=$((i+1)) + done + case $i in + (0) set -- ;; + (1) set -- "$args0" ;; + (2) set -- "$args0" "$args1" ;; + (3) set -- "$args0" "$args1" "$args2" ;; + (4) set -- "$args0" "$args1" "$args2" "$args3" ;; + (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; + (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; + (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; + (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; + (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; + esac +fi + +# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules +function splitJvmOpts() { + JVM_OPTS=("$@") +} +eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS +JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME" + +exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@" diff --git "a/\346\272\220\347\240\201/webview/fullscreen-video-sample/gradlew.bat" "b/\346\272\220\347\240\201/webview/fullscreen-video-sample/gradlew.bat" new file mode 100644 index 00000000..8a0b282a --- /dev/null +++ "b/\346\272\220\347\240\201/webview/fullscreen-video-sample/gradlew.bat" @@ -0,0 +1,90 @@ +@if "%DEBUG%" == "" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS= + +set DIRNAME=%~dp0 +if "%DIRNAME%" == "" set DIRNAME=. +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if "%ERRORLEVEL%" == "0" goto init + +echo. +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto init + +echo. +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:init +@rem Get command-line arguments, handling Windowz variants + +if not "%OS%" == "Windows_NT" goto win9xME_args +if "%@eval[2+2]" == "4" goto 4NT_args + +:win9xME_args +@rem Slurp the command line arguments. +set CMD_LINE_ARGS= +set _SKIP=2 + +:win9xME_args_slurp +if "x%~1" == "x" goto execute + +set CMD_LINE_ARGS=%* +goto execute + +:4NT_args +@rem Get arguments from the 4NT Shell from JP Software +set CMD_LINE_ARGS=%$ + +:execute +@rem Setup the command line + +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% + +:end +@rem End local scope for the variables with windows NT shell +if "%ERRORLEVEL%"=="0" goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 +exit /b 1 + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git "a/\346\272\220\347\240\201/webview/fullscreen-video-sample/settings.gradle" "b/\346\272\220\347\240\201/webview/fullscreen-video-sample/settings.gradle" new file mode 100644 index 00000000..e7b4def4 --- /dev/null +++ "b/\346\272\220\347\240\201/webview/fullscreen-video-sample/settings.gradle" @@ -0,0 +1 @@ +include ':app' diff --git "a/\346\272\220\347\240\201/webview/input-file-example/.gitignore" "b/\346\272\220\347\240\201/webview/input-file-example/.gitignore" new file mode 100644 index 00000000..0f885ac8 --- /dev/null +++ "b/\346\272\220\347\240\201/webview/input-file-example/.gitignore" @@ -0,0 +1,5 @@ +.gradle +/local.properties +/.idea/workspace.xml +.DS_Store +/build diff --git "a/\346\272\220\347\240\201/webview/input-file-example/app/.gitignore" "b/\346\272\220\347\240\201/webview/input-file-example/app/.gitignore" new file mode 100644 index 00000000..796b96d1 --- /dev/null +++ "b/\346\272\220\347\240\201/webview/input-file-example/app/.gitignore" @@ -0,0 +1 @@ +/build diff --git "a/\346\272\220\347\240\201/webview/input-file-example/app/build.gradle" "b/\346\272\220\347\240\201/webview/input-file-example/app/build.gradle" new file mode 100644 index 00000000..6b620495 --- /dev/null +++ "b/\346\272\220\347\240\201/webview/input-file-example/app/build.gradle" @@ -0,0 +1,24 @@ +apply plugin: 'com.android.application' + +android { + compileSdkVersion 21 + buildToolsVersion "21.0.0" + + defaultConfig { + applicationId "inputfilesample.android.chrome.google.com.inputfilesample" + minSdkVersion 19 + targetSdkVersion 21 + versionCode 1 + versionName "1.0" + } + buildTypes { + release { + runProguard false + proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' + } + } +} + +dependencies { + compile fileTree(dir: 'libs', include: ['*.jar']) +} diff --git "a/\346\272\220\347\240\201/webview/input-file-example/app/proguard-rules.pro" "b/\346\272\220\347\240\201/webview/input-file-example/app/proguard-rules.pro" new file mode 100644 index 00000000..c7e91516 --- /dev/null +++ "b/\346\272\220\347\240\201/webview/input-file-example/app/proguard-rules.pro" @@ -0,0 +1,17 @@ +# Add project specific ProGuard rules here. +# By default, the flags in this file are appended to flags specified +# in /Users/mattgaunt/Programming/Tools/android-sdk_1518674_mac-x86/tools/proguard/proguard-android.txt +# You can edit the include path and order by changing the proguardFiles +# directive in build.gradle. +# +# For more details, see +# http://developer.android.com/guide/developing/tools/proguard.html + +# Add any project specific keep options here: + +# If your project uses WebView with JS, uncomment the following +# and specify the fully qualified class name to the JavaScript interface +# class: +#-keepclassmembers class fqcn.of.javascript.interface.for.webview { +# public *; +#} diff --git "a/\346\272\220\347\240\201/webview/input-file-example/app/src/androidTest/java/inputfilesample/android/chrome/google/com/inputfilesample/ApplicationTest.java" "b/\346\272\220\347\240\201/webview/input-file-example/app/src/androidTest/java/inputfilesample/android/chrome/google/com/inputfilesample/ApplicationTest.java" new file mode 100644 index 00000000..8eba2fa2 --- /dev/null +++ "b/\346\272\220\347\240\201/webview/input-file-example/app/src/androidTest/java/inputfilesample/android/chrome/google/com/inputfilesample/ApplicationTest.java" @@ -0,0 +1,13 @@ +package inputfilesample.android.chrome.google.com.inputfilesample; + +import android.app.Application; +import android.test.ApplicationTestCase; + +/** + * Testing Fundamentals + */ +public class ApplicationTest extends ApplicationTestCase { + public ApplicationTest() { + super(Application.class); + } +} \ No newline at end of file diff --git "a/\346\272\220\347\240\201/webview/input-file-example/app/src/main/AndroidManifest.xml" "b/\346\272\220\347\240\201/webview/input-file-example/app/src/main/AndroidManifest.xml" new file mode 100644 index 00000000..b1a451d2 --- /dev/null +++ "b/\346\272\220\347\240\201/webview/input-file-example/app/src/main/AndroidManifest.xml" @@ -0,0 +1,23 @@ + + + + + + + + + + + + + + + + diff --git "a/\346\272\220\347\240\201/webview/input-file-example/app/src/main/assets/www/bower_components/modernizr/modernizr.custom.72986.js" "b/\346\272\220\347\240\201/webview/input-file-example/app/src/main/assets/www/bower_components/modernizr/modernizr.custom.72986.js" new file mode 100644 index 00000000..5ef0bd8d --- /dev/null +++ "b/\346\272\220\347\240\201/webview/input-file-example/app/src/main/assets/www/bower_components/modernizr/modernizr.custom.72986.js" @@ -0,0 +1,4 @@ +/* Modernizr 2.6.2 (Custom Build) | MIT & BSD + * Build: http://modernizr.com/download/#-shiv-cssclasses-prefixed-testprop-testallprops-domprefixes-load + */ +;window.Modernizr=function(a,b,c){function x(a){j.cssText=a}function y(a,b){return x(prefixes.join(a+";")+(b||""))}function z(a,b){return typeof a===b}function A(a,b){return!!~(""+a).indexOf(b)}function B(a,b){for(var d in a){var e=a[d];if(!A(e,"-")&&j[e]!==c)return b=="pfx"?e:!0}return!1}function C(a,b,d){for(var e in a){var f=b[a[e]];if(f!==c)return d===!1?a[e]:z(f,"function")?f.bind(d||b):f}return!1}function D(a,b,c){var d=a.charAt(0).toUpperCase()+a.slice(1),e=(a+" "+n.join(d+" ")+d).split(" ");return z(b,"string")||z(b,"undefined")?B(e,b):(e=(a+" "+o.join(d+" ")+d).split(" "),C(e,b,c))}var d="2.6.2",e={},f=!0,g=b.documentElement,h="modernizr",i=b.createElement(h),j=i.style,k,l={}.toString,m="Webkit Moz O ms",n=m.split(" "),o=m.toLowerCase().split(" "),p={},q={},r={},s=[],t=s.slice,u,v={}.hasOwnProperty,w;!z(v,"undefined")&&!z(v.call,"undefined")?w=function(a,b){return v.call(a,b)}:w=function(a,b){return b in a&&z(a.constructor.prototype[b],"undefined")},Function.prototype.bind||(Function.prototype.bind=function(b){var c=this;if(typeof c!="function")throw new TypeError;var d=t.call(arguments,1),e=function(){if(this instanceof e){var a=function(){};a.prototype=c.prototype;var f=new a,g=c.apply(f,d.concat(t.call(arguments)));return Object(g)===g?g:f}return c.apply(b,d.concat(t.call(arguments)))};return e});for(var E in p)w(p,E)&&(u=E.toLowerCase(),e[u]=p[E](),s.push((e[u]?"":"no-")+u));return e.addTest=function(a,b){if(typeof a=="object")for(var d in a)w(a,d)&&e.addTest(d,a[d]);else{a=a.toLowerCase();if(e[a]!==c)return e;b=typeof b=="function"?b():b,typeof f!="undefined"&&f&&(g.className+=" "+(b?"":"no-")+a),e[a]=b}return e},x(""),i=k=null,function(a,b){function k(a,b){var c=a.createElement("p"),d=a.getElementsByTagName("head")[0]||a.documentElement;return c.innerHTML="x",d.insertBefore(c.lastChild,d.firstChild)}function l(){var a=r.elements;return typeof a=="string"?a.split(" "):a}function m(a){var b=i[a[g]];return b||(b={},h++,a[g]=h,i[h]=b),b}function n(a,c,f){c||(c=b);if(j)return c.createElement(a);f||(f=m(c));var g;return f.cache[a]?g=f.cache[a].cloneNode():e.test(a)?g=(f.cache[a]=f.createElem(a)).cloneNode():g=f.createElem(a),g.canHaveChildren&&!d.test(a)?f.frag.appendChild(g):g}function o(a,c){a||(a=b);if(j)return a.createDocumentFragment();c=c||m(a);var d=c.frag.cloneNode(),e=0,f=l(),g=f.length;for(;e",f="hidden"in a,j=a.childNodes.length==1||function(){b.createElement("a");var a=b.createDocumentFragment();return typeof a.cloneNode=="undefined"||typeof a.createDocumentFragment=="undefined"||typeof a.createElement=="undefined"}()}catch(c){f=!0,j=!0}})();var r={elements:c.elements||"abbr article aside audio bdi canvas data datalist details figcaption figure footer header hgroup mark meter nav output progress section summary time video",shivCSS:c.shivCSS!==!1,supportsUnknownElements:j,shivMethods:c.shivMethods!==!1,type:"default",shivDocument:q,createElement:n,createDocumentFragment:o};a.html5=r,q(b)}(this,b),e._version=d,e._domPrefixes=o,e._cssomPrefixes=n,e.testProp=function(a){return B([a])},e.testAllProps=D,e.prefixed=function(a,b,c){return b?D(a,b,c):D(a,"pfx")},g.className=g.className.replace(/(^|\s)no-js(\s|$)/,"$1$2")+(f?" js "+s.join(" "):""),e}(this,this.document),function(a,b,c){function d(a){return"[object Function]"==o.call(a)}function e(a){return"string"==typeof a}function f(){}function g(a){return!a||"loaded"==a||"complete"==a||"uninitialized"==a}function h(){var a=p.shift();q=1,a?a.t?m(function(){("c"==a.t?B.injectCss:B.injectJs)(a.s,0,a.a,a.x,a.e,1)},0):(a(),h()):q=0}function i(a,c,d,e,f,i,j){function k(b){if(!o&&g(l.readyState)&&(u.r=o=1,!q&&h(),l.onload=l.onreadystatechange=null,b)){"img"!=a&&m(function(){t.removeChild(l)},50);for(var d in y[c])y[c].hasOwnProperty(d)&&y[c][d].onload()}}var j=j||B.errorTimeout,l=b.createElement(a),o=0,r=0,u={t:d,s:c,e:f,a:i,x:j};1===y[c]&&(r=1,y[c]=[]),"object"==a?l.data=c:(l.src=c,l.type=a),l.width=l.height="0",l.onerror=l.onload=l.onreadystatechange=function(){k.call(this,r)},p.splice(e,0,u),"img"!=a&&(r||2===y[c]?(t.insertBefore(l,s?null:n),m(k,j)):y[c].push(l))}function j(a,b,c,d,f){return q=0,b=b||"j",e(a)?i("c"==b?v:u,a,b,this.i++,c,d,f):(p.splice(this.i++,0,a),1==p.length&&h()),this}function k(){var a=B;return a.loader={load:j,i:0},a}var l=b.documentElement,m=a.setTimeout,n=b.getElementsByTagName("script")[0],o={}.toString,p=[],q=0,r="MozAppearance"in l.style,s=r&&!!b.createRange().compareNode,t=s?l:n.parentNode,l=a.opera&&"[object Opera]"==o.call(a.opera),l=!!b.attachEvent&&!l,u=r?"object":l?"script":"img",v=l?"script":u,w=Array.isArray||function(a){return"[object Array]"==o.call(a)},x=[],y={},z={timeout:function(a,b){return b.length&&(a.timeout=b[0]),a}},A,B;B=function(a){function b(a){var a=a.split("!"),b=x.length,c=a.pop(),d=a.length,c={url:c,origUrl:c,prefixes:a},e,f,g;for(f=0;f + + + + + Input File Demo + + + + + + + + + + + + + + + diff --git "a/\346\272\220\347\240\201/webview/input-file-example/app/src/main/assets/www/scripts/main.js" "b/\346\272\220\347\240\201/webview/input-file-example/app/src/main/assets/www/scripts/main.js" new file mode 100644 index 00000000..713c1976 --- /dev/null +++ "b/\346\272\220\347\240\201/webview/input-file-example/app/src/main/assets/www/scripts/main.js" @@ -0,0 +1,39 @@ +/* + * Copyright (C) 2010 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * When the window loads, connect the showNotificationBtn to the Javascript + * interface "window.NotificationBind" + */ +window.onload = function() { + console.log('window.onload'); + var loadFileBtn = document.querySelector('.loadFileBtn'); + var fileInputField = document.querySelector('.hiddenFileInput'); + var img = document.querySelector('img'); + + loadFileBtn.addEventListener('click', function() { + fileInputField.click(); + }.bind(this)); + fileInputField.addEventListener('change', function(evt) { + console.log('Change', evt); + var reader = new FileReader(); + reader.onload = function (evt) { + img.src = evt.target.result; + }; + + reader.readAsDataURL(evt.target.files[0]); + }); +}; \ No newline at end of file diff --git "a/\346\272\220\347\240\201/webview/input-file-example/app/src/main/assets/www/styles/main.css" "b/\346\272\220\347\240\201/webview/input-file-example/app/src/main/assets/www/styles/main.css" new file mode 100644 index 00000000..7246a3e8 --- /dev/null +++ "b/\346\272\220\347\240\201/webview/input-file-example/app/src/main/assets/www/styles/main.css" @@ -0,0 +1,131 @@ +/* + * Copyright (C) 2010 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** Reference Local Fonts **/ +@font-face { + font-family: 'Lobster Two'; + font-style: normal; + font-weight: 400; + src: local('Lobster Two'), local('LobsterTwo'), url('../fonts/Lobster_Two/LobsterTwo-Regular.ttf') format('truetype'); +} + +@font-face { + font-family: 'Londrina Shadow'; + font-style: normal; + font-weight: 400; + src: local('Londrina Shadow'), local('LondrinaShadow-Regular'), url('../fonts/Londrina_Shadow/LondrinaShadow-Regular.ttf') format('truetype'); +} + +html, body { + width: 100%; + height: 100%; + min-height: 100%; + margin: 0; + padding: 0; + font-size: 26px; + + overflow: hidden; +} + +body { + position: relative; + font-family: 'Lobster Two', cursive; + + overflow: hidden; +} + +h1, h2, h3, h4, h5, h6 { + font-family: 'Londrina Shadow', cursive; +} + +button { + display: block; + width: 100%; + background-color: #f39c12; + color: #fefefe; + font-family: inherit; + font-size: inherit; + padding: 16px; + margin: 0 auto; + border-radius: 6px; + border-style: none; + border-bottom-style: solid; + border-color: #E68F05; + border-width: 4px; + + /** + * Remove any touch feedback from WebView since + * We handle the :active state + */ + outline: 0; + -webkit-tap-highlight-color: rgba(0,0,0, 0.0); + + -webkit-user-select: none; + user-select: none; +} + +button:focus { + background-color: #E68F05; + border-color: #DA8300; +} + +button:active { + background-color: #FFA91F; + border-color: #E68F05; +} + +@media screen and (min-width: 500px) { + button { + width: 60%; + } +} + +@media screen and (min-width: 750px) { + button { + width: 40%; + max-width: 400px; + } +} + +.hiddenFileInput { + width: 0; + height: 0; + visibility: hidden; + position: absolute; + top: 0; + left: 0; +} + +.center { + display: flex; + flex-direction: column; + + width: 100%; + height: 100%; + + align-items: center; + justify-content: center; + + padding: 8px; + + box-sizing: border-box; +} + +img { + max-width: 100%; + max-height: 60%; + margin-bottom: 8px; +} \ No newline at end of file diff --git "a/\346\272\220\347\240\201/webview/input-file-example/app/src/main/java/inputfilesample/android/chrome/google/com/inputfilesample/MainActivity.java" "b/\346\272\220\347\240\201/webview/input-file-example/app/src/main/java/inputfilesample/android/chrome/google/com/inputfilesample/MainActivity.java" new file mode 100644 index 00000000..f7ef42f6 --- /dev/null +++ "b/\346\272\220\347\240\201/webview/input-file-example/app/src/main/java/inputfilesample/android/chrome/google/com/inputfilesample/MainActivity.java" @@ -0,0 +1,73 @@ +/* + * Copyright (C) 2010 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package inputfilesample.android.chrome.google.com.inputfilesample; + +import android.annotation.TargetApi; +import android.app.Activity; +import android.app.ActionBar; +import android.app.Fragment; +import android.os.Bundle; +import android.util.Log; +import android.view.LayoutInflater; +import android.view.Menu; +import android.view.MenuItem; +import android.view.View; +import android.view.ViewGroup; +import android.os.Build; +import android.webkit.CookieManager; +import android.webkit.PermissionRequest; +import android.webkit.WebChromeClient; +import android.webkit.WebSettings; +import android.webkit.WebView; +import android.webkit.WebViewClient; + + +public class MainActivity extends Activity { + + private static final String TAG = MainActivity.class.getSimpleName(); + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_main); + if (savedInstanceState == null) { + Log.v(TAG, "MainFragment Creation"); + getFragmentManager().beginTransaction() + .add(R.id.container, new MainFragment()) + .commit(); + } + } + + + @Override + public boolean onCreateOptionsMenu(Menu menu) { + // Inflate the menu; this adds items to the action bar if it is present. + getMenuInflater().inflate(R.menu.main, menu); + return true; + } + + @Override + public boolean onOptionsItemSelected(MenuItem item) { + // Handle action bar item clicks here. The action bar will + // automatically handle clicks on the Home/Up button, so long + // as you specify a parent activity in AndroidManifest.xml. + int id = item.getItemId(); + if (id == R.id.action_settings) { + return true; + } + return super.onOptionsItemSelected(item); + } +} diff --git "a/\346\272\220\347\240\201/webview/input-file-example/app/src/main/java/inputfilesample/android/chrome/google/com/inputfilesample/MainFragment.java" "b/\346\272\220\347\240\201/webview/input-file-example/app/src/main/java/inputfilesample/android/chrome/google/com/inputfilesample/MainFragment.java" new file mode 100644 index 00000000..2e67ec4d --- /dev/null +++ "b/\346\272\220\347\240\201/webview/input-file-example/app/src/main/java/inputfilesample/android/chrome/google/com/inputfilesample/MainFragment.java" @@ -0,0 +1,220 @@ +/* + * Copyright (C) 2010 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package inputfilesample.android.chrome.google.com.inputfilesample; + +import android.annotation.TargetApi; +import android.app.Activity; +import android.app.Fragment; +import android.content.Intent; +import android.net.Uri; +import android.os.Build; +import android.os.Bundle; +import android.os.Environment; +import android.provider.MediaStore; +import android.util.Log; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.webkit.ValueCallback; +import android.webkit.WebChromeClient; +import android.webkit.WebSettings; +import android.webkit.WebView; +import android.webkit.WebViewClient; + +import java.io.File; +import java.io.IOException; +import java.text.SimpleDateFormat; +import java.util.Date; + +/** + * Created by mattgaunt on 10/16/14. + */ +public class MainFragment extends Fragment { + + private static final String TAG = MainFragment.class.getSimpleName(); + + public static final int INPUT_FILE_REQUEST_CODE = 1; + public static final String EXTRA_FROM_NOTIFICATION = "EXTRA_FROM_NOTIFICATION"; + + private WebView mWebView; + private ValueCallback mFilePathCallback; + private String mCameraPhotoPath; + + public MainFragment() { + } + + @Override + public View onCreateView(LayoutInflater inflater, ViewGroup container, + Bundle savedInstanceState) { + View rootView = inflater.inflate(R.layout.fragment_main, container, false); + + // Get reference of WebView from layout/activity_main.xml + mWebView = (WebView) rootView.findViewById(R.id.fragment_main_webview); + + setUpWebViewDefaults(mWebView); + + // Check whether we're recreating a previously destroyed instance + if (savedInstanceState != null) { + // Restore the previous URL and history stack + mWebView.restoreState(savedInstanceState); + } + + mWebView.setWebChromeClient(new WebChromeClient() { + public boolean onShowFileChooser( + WebView webView, ValueCallback filePathCallback, + WebChromeClient.FileChooserParams fileChooserParams) { + if(mFilePathCallback != null) { + mFilePathCallback.onReceiveValue(null); + } + mFilePathCallback = filePathCallback; + + Intent takePictureIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE); + if (takePictureIntent.resolveActivity(getActivity().getPackageManager()) != null) { + // Create the File where the photo should go + File photoFile = null; + try { + photoFile = createImageFile(); + takePictureIntent.putExtra("PhotoPath", mCameraPhotoPath); + } catch (IOException ex) { + // Error occurred while creating the File + Log.e(TAG, "Unable to create Image File", ex); + } + + // Continue only if the File was successfully created + if (photoFile != null) { + mCameraPhotoPath = "file:" + photoFile.getAbsolutePath(); + takePictureIntent.putExtra(MediaStore.EXTRA_OUTPUT, + Uri.fromFile(photoFile)); + } else { + takePictureIntent = null; + } + } + + Intent contentSelectionIntent = new Intent(Intent.ACTION_GET_CONTENT); + contentSelectionIntent.addCategory(Intent.CATEGORY_OPENABLE); + contentSelectionIntent.setType("image/*"); + + Intent[] intentArray; + if(takePictureIntent != null) { + intentArray = new Intent[]{takePictureIntent}; + } else { + intentArray = new Intent[0]; + } + + Intent chooserIntent = new Intent(Intent.ACTION_CHOOSER); + chooserIntent.putExtra(Intent.EXTRA_INTENT, contentSelectionIntent); + chooserIntent.putExtra(Intent.EXTRA_TITLE, "Image Chooser"); + chooserIntent.putExtra(Intent.EXTRA_INITIAL_INTENTS, intentArray); + + startActivityForResult(chooserIntent, INPUT_FILE_REQUEST_CODE); + + return true; + } + }); + + // Load the local index.html file + if(mWebView.getUrl() == null) { + mWebView.loadUrl("file:///android_asset/www/index.html"); + } + + return rootView; + } + + /** + * More info this method can be found at + * http://developer.android.com/training/camera/photobasics.html + * + * @return + * @throws IOException + */ + private File createImageFile() throws IOException { + // Create an image file name + String timeStamp = new SimpleDateFormat("yyyyMMdd_HHmmss").format(new Date()); + String imageFileName = "JPEG_" + timeStamp + "_"; + File storageDir = Environment.getExternalStoragePublicDirectory( + Environment.DIRECTORY_PICTURES); + File imageFile = File.createTempFile( + imageFileName, /* prefix */ + ".jpg", /* suffix */ + storageDir /* directory */ + ); + return imageFile; + } + + /** + * Convenience method to set some generic defaults for a + * given WebView + * + * @param webView + */ + @TargetApi(Build.VERSION_CODES.HONEYCOMB) + private void setUpWebViewDefaults(WebView webView) { + WebSettings settings = webView.getSettings(); + + // Enable Javascript + settings.setJavaScriptEnabled(true); + + // Use WideViewport and Zoom out if there is no viewport defined + settings.setUseWideViewPort(true); + settings.setLoadWithOverviewMode(true); + + // Enable pinch to zoom without the zoom buttons + settings.setBuiltInZoomControls(true); + + if(Build.VERSION.SDK_INT > Build.VERSION_CODES.HONEYCOMB) { + // Hide the zoom controls for HONEYCOMB+ + settings.setDisplayZoomControls(false); + } + + // Enable remote debugging via chrome://inspect + if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) { + WebView.setWebContentsDebuggingEnabled(true); + } + + // We set the WebViewClient to ensure links are consumed by the WebView rather + // than passed to a browser if it can + mWebView.setWebViewClient(new WebViewClient()); + } + + @Override + public void onActivityResult (int requestCode, int resultCode, Intent data) { + if(requestCode != INPUT_FILE_REQUEST_CODE || mFilePathCallback == null) { + super.onActivityResult(requestCode, resultCode, data); + return; + } + + Uri[] results = null; + + // Check that the response is a good one + if(resultCode == Activity.RESULT_OK) { + if(data == null) { + // If there is not data, then we may have taken a photo + if(mCameraPhotoPath != null) { + results = new Uri[]{Uri.parse(mCameraPhotoPath)}; + } + } else { + String dataString = data.getDataString(); + if (dataString != null) { + results = new Uri[]{Uri.parse(dataString)}; + } + } + } + + mFilePathCallback.onReceiveValue(results); + mFilePathCallback = null; + return; + } +} diff --git "a/\346\272\220\347\240\201/webview/input-file-example/app/src/main/res/drawable-hdpi/ic_launcher.png" "b/\346\272\220\347\240\201/webview/input-file-example/app/src/main/res/drawable-hdpi/ic_launcher.png" new file mode 100644 index 00000000..96a442e5 Binary files /dev/null and "b/\346\272\220\347\240\201/webview/input-file-example/app/src/main/res/drawable-hdpi/ic_launcher.png" differ diff --git "a/\346\272\220\347\240\201/webview/input-file-example/app/src/main/res/drawable-mdpi/ic_launcher.png" "b/\346\272\220\347\240\201/webview/input-file-example/app/src/main/res/drawable-mdpi/ic_launcher.png" new file mode 100644 index 00000000..359047df Binary files /dev/null and "b/\346\272\220\347\240\201/webview/input-file-example/app/src/main/res/drawable-mdpi/ic_launcher.png" differ diff --git "a/\346\272\220\347\240\201/webview/input-file-example/app/src/main/res/drawable-xhdpi/ic_launcher.png" "b/\346\272\220\347\240\201/webview/input-file-example/app/src/main/res/drawable-xhdpi/ic_launcher.png" new file mode 100644 index 00000000..71c6d760 Binary files /dev/null and "b/\346\272\220\347\240\201/webview/input-file-example/app/src/main/res/drawable-xhdpi/ic_launcher.png" differ diff --git "a/\346\272\220\347\240\201/webview/input-file-example/app/src/main/res/drawable-xxhdpi/ic_launcher.png" "b/\346\272\220\347\240\201/webview/input-file-example/app/src/main/res/drawable-xxhdpi/ic_launcher.png" new file mode 100644 index 00000000..4df18946 Binary files /dev/null and "b/\346\272\220\347\240\201/webview/input-file-example/app/src/main/res/drawable-xxhdpi/ic_launcher.png" differ diff --git "a/\346\272\220\347\240\201/webview/input-file-example/app/src/main/res/layout/activity_main.xml" "b/\346\272\220\347\240\201/webview/input-file-example/app/src/main/res/layout/activity_main.xml" new file mode 100644 index 00000000..c6fd0bc1 --- /dev/null +++ "b/\346\272\220\347\240\201/webview/input-file-example/app/src/main/res/layout/activity_main.xml" @@ -0,0 +1,22 @@ + + diff --git "a/\346\272\220\347\240\201/webview/input-file-example/app/src/main/res/layout/fragment_main.xml" "b/\346\272\220\347\240\201/webview/input-file-example/app/src/main/res/layout/fragment_main.xml" new file mode 100644 index 00000000..cfe62dc5 --- /dev/null +++ "b/\346\272\220\347\240\201/webview/input-file-example/app/src/main/res/layout/fragment_main.xml" @@ -0,0 +1,27 @@ + + + + + + diff --git "a/\346\272\220\347\240\201/webview/input-file-example/app/src/main/res/menu/main.xml" "b/\346\272\220\347\240\201/webview/input-file-example/app/src/main/res/menu/main.xml" new file mode 100644 index 00000000..9bfd22c8 --- /dev/null +++ "b/\346\272\220\347\240\201/webview/input-file-example/app/src/main/res/menu/main.xml" @@ -0,0 +1,8 @@ + + + diff --git "a/\346\272\220\347\240\201/webview/input-file-example/app/src/main/res/values-v21/styles.xml" "b/\346\272\220\347\240\201/webview/input-file-example/app/src/main/res/values-v21/styles.xml" new file mode 100644 index 00000000..dba3c417 --- /dev/null +++ "b/\346\272\220\347\240\201/webview/input-file-example/app/src/main/res/values-v21/styles.xml" @@ -0,0 +1,5 @@ + + + + diff --git "a/\346\272\220\347\240\201/webview/input-file-example/app/src/main/res/values-w820dp/dimens.xml" "b/\346\272\220\347\240\201/webview/input-file-example/app/src/main/res/values-w820dp/dimens.xml" new file mode 100644 index 00000000..63fc8164 --- /dev/null +++ "b/\346\272\220\347\240\201/webview/input-file-example/app/src/main/res/values-w820dp/dimens.xml" @@ -0,0 +1,6 @@ + + + 64dp + diff --git "a/\346\272\220\347\240\201/webview/input-file-example/app/src/main/res/values/dimens.xml" "b/\346\272\220\347\240\201/webview/input-file-example/app/src/main/res/values/dimens.xml" new file mode 100644 index 00000000..47c82246 --- /dev/null +++ "b/\346\272\220\347\240\201/webview/input-file-example/app/src/main/res/values/dimens.xml" @@ -0,0 +1,5 @@ + + + 16dp + 16dp + diff --git "a/\346\272\220\347\240\201/webview/input-file-example/app/src/main/res/values/strings.xml" "b/\346\272\220\347\240\201/webview/input-file-example/app/src/main/res/values/strings.xml" new file mode 100644 index 00000000..c9165362 --- /dev/null +++ "b/\346\272\220\347\240\201/webview/input-file-example/app/src/main/res/values/strings.xml" @@ -0,0 +1,8 @@ + + + + Input File Sample + Hello world! + Settings + + diff --git "a/\346\272\220\347\240\201/webview/input-file-example/app/src/main/res/values/styles.xml" "b/\346\272\220\347\240\201/webview/input-file-example/app/src/main/res/values/styles.xml" new file mode 100644 index 00000000..ff6c9d2c --- /dev/null +++ "b/\346\272\220\347\240\201/webview/input-file-example/app/src/main/res/values/styles.xml" @@ -0,0 +1,8 @@ + + + + + + diff --git "a/\346\272\220\347\240\201/webview/input-file-example/assets/www/bower_components/modernizr/modernizr.custom.72986.js" "b/\346\272\220\347\240\201/webview/input-file-example/assets/www/bower_components/modernizr/modernizr.custom.72986.js" new file mode 100644 index 00000000..5ef0bd8d --- /dev/null +++ "b/\346\272\220\347\240\201/webview/input-file-example/assets/www/bower_components/modernizr/modernizr.custom.72986.js" @@ -0,0 +1,4 @@ +/* Modernizr 2.6.2 (Custom Build) | MIT & BSD + * Build: http://modernizr.com/download/#-shiv-cssclasses-prefixed-testprop-testallprops-domprefixes-load + */ +;window.Modernizr=function(a,b,c){function x(a){j.cssText=a}function y(a,b){return x(prefixes.join(a+";")+(b||""))}function z(a,b){return typeof a===b}function A(a,b){return!!~(""+a).indexOf(b)}function B(a,b){for(var d in a){var e=a[d];if(!A(e,"-")&&j[e]!==c)return b=="pfx"?e:!0}return!1}function C(a,b,d){for(var e in a){var f=b[a[e]];if(f!==c)return d===!1?a[e]:z(f,"function")?f.bind(d||b):f}return!1}function D(a,b,c){var d=a.charAt(0).toUpperCase()+a.slice(1),e=(a+" "+n.join(d+" ")+d).split(" ");return z(b,"string")||z(b,"undefined")?B(e,b):(e=(a+" "+o.join(d+" ")+d).split(" "),C(e,b,c))}var d="2.6.2",e={},f=!0,g=b.documentElement,h="modernizr",i=b.createElement(h),j=i.style,k,l={}.toString,m="Webkit Moz O ms",n=m.split(" "),o=m.toLowerCase().split(" "),p={},q={},r={},s=[],t=s.slice,u,v={}.hasOwnProperty,w;!z(v,"undefined")&&!z(v.call,"undefined")?w=function(a,b){return v.call(a,b)}:w=function(a,b){return b in a&&z(a.constructor.prototype[b],"undefined")},Function.prototype.bind||(Function.prototype.bind=function(b){var c=this;if(typeof c!="function")throw new TypeError;var d=t.call(arguments,1),e=function(){if(this instanceof e){var a=function(){};a.prototype=c.prototype;var f=new a,g=c.apply(f,d.concat(t.call(arguments)));return Object(g)===g?g:f}return c.apply(b,d.concat(t.call(arguments)))};return e});for(var E in p)w(p,E)&&(u=E.toLowerCase(),e[u]=p[E](),s.push((e[u]?"":"no-")+u));return e.addTest=function(a,b){if(typeof a=="object")for(var d in a)w(a,d)&&e.addTest(d,a[d]);else{a=a.toLowerCase();if(e[a]!==c)return e;b=typeof b=="function"?b():b,typeof f!="undefined"&&f&&(g.className+=" "+(b?"":"no-")+a),e[a]=b}return e},x(""),i=k=null,function(a,b){function k(a,b){var c=a.createElement("p"),d=a.getElementsByTagName("head")[0]||a.documentElement;return c.innerHTML="x",d.insertBefore(c.lastChild,d.firstChild)}function l(){var a=r.elements;return typeof a=="string"?a.split(" "):a}function m(a){var b=i[a[g]];return b||(b={},h++,a[g]=h,i[h]=b),b}function n(a,c,f){c||(c=b);if(j)return c.createElement(a);f||(f=m(c));var g;return f.cache[a]?g=f.cache[a].cloneNode():e.test(a)?g=(f.cache[a]=f.createElem(a)).cloneNode():g=f.createElem(a),g.canHaveChildren&&!d.test(a)?f.frag.appendChild(g):g}function o(a,c){a||(a=b);if(j)return a.createDocumentFragment();c=c||m(a);var d=c.frag.cloneNode(),e=0,f=l(),g=f.length;for(;e",f="hidden"in a,j=a.childNodes.length==1||function(){b.createElement("a");var a=b.createDocumentFragment();return typeof a.cloneNode=="undefined"||typeof a.createDocumentFragment=="undefined"||typeof a.createElement=="undefined"}()}catch(c){f=!0,j=!0}})();var r={elements:c.elements||"abbr article aside audio bdi canvas data datalist details figcaption figure footer header hgroup mark meter nav output progress section summary time video",shivCSS:c.shivCSS!==!1,supportsUnknownElements:j,shivMethods:c.shivMethods!==!1,type:"default",shivDocument:q,createElement:n,createDocumentFragment:o};a.html5=r,q(b)}(this,b),e._version=d,e._domPrefixes=o,e._cssomPrefixes=n,e.testProp=function(a){return B([a])},e.testAllProps=D,e.prefixed=function(a,b,c){return b?D(a,b,c):D(a,"pfx")},g.className=g.className.replace(/(^|\s)no-js(\s|$)/,"$1$2")+(f?" js "+s.join(" "):""),e}(this,this.document),function(a,b,c){function d(a){return"[object Function]"==o.call(a)}function e(a){return"string"==typeof a}function f(){}function g(a){return!a||"loaded"==a||"complete"==a||"uninitialized"==a}function h(){var a=p.shift();q=1,a?a.t?m(function(){("c"==a.t?B.injectCss:B.injectJs)(a.s,0,a.a,a.x,a.e,1)},0):(a(),h()):q=0}function i(a,c,d,e,f,i,j){function k(b){if(!o&&g(l.readyState)&&(u.r=o=1,!q&&h(),l.onload=l.onreadystatechange=null,b)){"img"!=a&&m(function(){t.removeChild(l)},50);for(var d in y[c])y[c].hasOwnProperty(d)&&y[c][d].onload()}}var j=j||B.errorTimeout,l=b.createElement(a),o=0,r=0,u={t:d,s:c,e:f,a:i,x:j};1===y[c]&&(r=1,y[c]=[]),"object"==a?l.data=c:(l.src=c,l.type=a),l.width=l.height="0",l.onerror=l.onload=l.onreadystatechange=function(){k.call(this,r)},p.splice(e,0,u),"img"!=a&&(r||2===y[c]?(t.insertBefore(l,s?null:n),m(k,j)):y[c].push(l))}function j(a,b,c,d,f){return q=0,b=b||"j",e(a)?i("c"==b?v:u,a,b,this.i++,c,d,f):(p.splice(this.i++,0,a),1==p.length&&h()),this}function k(){var a=B;return a.loader={load:j,i:0},a}var l=b.documentElement,m=a.setTimeout,n=b.getElementsByTagName("script")[0],o={}.toString,p=[],q=0,r="MozAppearance"in l.style,s=r&&!!b.createRange().compareNode,t=s?l:n.parentNode,l=a.opera&&"[object Opera]"==o.call(a.opera),l=!!b.attachEvent&&!l,u=r?"object":l?"script":"img",v=l?"script":u,w=Array.isArray||function(a){return"[object Array]"==o.call(a)},x=[],y={},z={timeout:function(a,b){return b.length&&(a.timeout=b[0]),a}},A,B;B=function(a){function b(a){var a=a.split("!"),b=x.length,c=a.pop(),d=a.length,c={url:c,origUrl:c,prefixes:a},e,f,g;for(f=0;f + + + + + JS Interface Demo + + + + + + + +
+
+

Notify Me of Awesome

+
+ + +
+ +
+ + +
+
+

Notification Time

+
+ +

There should be a notification waiting for you...

+
+
+ +
+
+

You Clicked the Notification

+
+
+

There is only so much I can do with a notification you know...

+
+
+ +
+
+

Ssshhhhh

+
+ +
+

Secret Spot in the app, congrats :)

+
+
+ + + + diff --git "a/\346\272\220\347\240\201/webview/input-file-example/assets/www/scripts/main.js" "b/\346\272\220\347\240\201/webview/input-file-example/assets/www/scripts/main.js" new file mode 100644 index 00000000..4b5bceed --- /dev/null +++ "b/\346\272\220\347\240\201/webview/input-file-example/assets/www/scripts/main.js" @@ -0,0 +1,189 @@ +/* + * Copyright (C) 2010 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * When the window loads, connect the showNotificationBtn to the Javascript + * interface "window.NotificationBind" + */ +window.onload = function() { + console.log('window.onload'); + var showNotificationBtn = document.querySelector('#show-notification-btn'); + showNotificationBtn.addEventListener('click', function() { + if(window.NotificationBind) { + NotificationBind.showNotification('This is an Awesome notification'); + } + + changeState(NOTIFICATION_SHOWN, true); + }); + + updateUI(true); +}; + +/** + * From this point onwards, the Javascript is managing UI and + * application state + */ +var animEndEventNames = { + 'WebkitAnimation' : 'webkitAnimationEnd', + 'OAnimation' : 'oAnimationEnd', + 'msAnimation' : 'MSAnimationEnd', + 'animation' : 'animationend' +}; + +// animation end event name +var animEndEventName = animEndEventNames[ Modernizr.prefixed( 'animation' ) ]; + +var NOTIFICATION_SHOWN = 0; +var LAUNCH_FROM_NOTIFICATION = 1; +var DEFAULT = 2; +var SECRET_SCREEN = 3; + +var exports = {}; + +var currentState; +var animating = false; + +function changeState(newState, animateForward) { + console.log('changeState()'); + + if(animating || (newState == currentState)) { + return; + } + + var currentPage = document.querySelector('.current-page'); + var newUI; + + var animCurrent = animateForward ? 'animate-to-left' : 'animate-to-right'; + var animNew = animateForward ? 'animate-from-right' : 'animate-from-left'; + + var hash; + + switch(newState) { + case NOTIFICATION_SHOWN: + newUI = getNotifcationArrow(); + hash = 'notification-shown'; + break; + case LAUNCH_FROM_NOTIFICATION: + newUI = getLaunchFromNotificationUI(); + hash = 'notification-launch'; + break; + case DEFAULT: + newUI = getDefaultUI(); + hash = ''; + break; + case SECRET_SCREEN: + animCurrent = 'animate-to-right'; + animNew = 'animate-from-left'; + newUI = getSecretUI(); + hash = 'secret'; + break; + } + + newUI.classList.add('current-page'); + + if(currentPage) { + // We need to animate + animating = true; + + currentPage.classList.add(animCurrent); + newUI.classList.add(animNew); + + currentPage.addEventListener(animEndEventName, pageAnimationEnd(currentPage, newUI, animCurrent, animNew), false); + } + + currentState = newState; + + pushState({}, "", hash); +} + +function pageAnimationEnd(currentPage, newPage, animCurrent, animNew) { + var animEndFunc = function() { + currentPage.removeEventListener(animEndEventName, animEndFunc, false); + + currentPage.classList.remove(animCurrent); + newPage.classList.remove(animNew); + + currentPage.classList.remove('current-page'); + + animating = false; + }; + return animEndFunc; +} + +function getNotifcationArrow() { + return document.querySelector('.notification-opened'); +} + +function getLaunchFromNotificationUI() { + return document.querySelector('.launched-from-notification'); +} + +function getDefaultUI() { + return document.querySelector('.init-screen'); +} + +function getSecretUI() { + return document.querySelector('.secret-screen'); +} + +function updateUI(animateForward) { + console.log('updateUI()'); + var identifier = window.location.hash; + var state; + + if(identifier == '#notification-launch') { + state = LAUNCH_FROM_NOTIFICATION; + } else if(identifier == '#notification-shown') { + state = NOTIFICATION_SHOWN; + } else if(identifier == '#secret') { + state = SECRET_SCREEN; + } else { + state = DEFAULT; + } + + changeState(state, animateForward); +} + +function showSecretMessage() { + var ui = getSecretUI(); + if(ui.classList.contains('current-page')) { + if(animating) { + return; + } + window.history.back(); + } else { + changeState(SECRET_SCREEN); + + return 'You Found the Secret'; + } +} + +function pushState(state, title, path) { + if(!path) { + return; + } + + window.location.hash = path; +} + +window.onpopstate = function(event) { + console.log('onpopstate()'); + var popped = document.querySelector('.current-page') ? true : false; + if(popped && currentState == SECRET_SCREEN) { + popped = false; + } + updateUI(!popped); +}; diff --git "a/\346\272\220\347\240\201/webview/input-file-example/assets/www/styles/main.css" "b/\346\272\220\347\240\201/webview/input-file-example/assets/www/styles/main.css" new file mode 100644 index 00000000..8433978b --- /dev/null +++ "b/\346\272\220\347\240\201/webview/input-file-example/assets/www/styles/main.css" @@ -0,0 +1,269 @@ +/* + * Copyright (C) 2010 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** Reference Local Fonts **/ +@font-face { + font-family: 'Lobster Two'; + font-style: normal; + font-weight: 400; + src: local('Lobster Two'), local('LobsterTwo'), url('../fonts/Lobster_Two/LobsterTwo-Regular.ttf') format('truetype'); +} + +@font-face { + font-family: 'Londrina Shadow'; + font-style: normal; + font-weight: 400; + src: local('Londrina Shadow'), local('LondrinaShadow-Regular'), url('../fonts/Londrina_Shadow/LondrinaShadow-Regular.ttf') format('truetype'); +} + +html, body { + width: 100%; + height: 100%; + min-height: 100%; + margin: 0; + padding: 0; + font-size: 26px; + + overflow: hidden; +} + +body { + position: relative; + font-family: 'Lobster Two', cursive; + color: #fefefe; + + overflow: hidden; +} + +h1, h2, h3, h4, h5, h6 { + font-family: 'Londrina Shadow', cursive; +} + +header { + display: flex; + display: -webkit-box; + + align-items: center; + -webkit-box-align: center; + + flex: 1; + -webkit-box-flex: 1; +} + +header > h1 { + width: 100%; + font-size: 60px; + text-align: center; + margin: 16px 0; +} + +@media screen and (orientation: landscape) { + header > h1 { + font-size: 50px; + } +} + +button { + display: block; + width: 100%; + background-color: #f39c12; + color: inherit; + font-family: inherit; + font-size: inherit; + padding: 16px; + margin: 0 auto; + border-radius: 6px; + border-style: none; + border-bottom-style: solid; + border-color: #E68F05; + border-width: 4px; + + /** + * Remove any touch feedback from WebView since + * We handle the :active state + */ + outline: 0; + -webkit-tap-highlight-color: rgba(0,0,0, 0.0); + + -webkit-user-select: none; + user-select: none; + } + + button:focus { + background-color: #E68F05; + border-color: #DA8300; +} + +button:active { + background-color: #FFA91F; + border-color: #E68F05; +} + +@media screen and (min-width: 500px) { + button { + width: 60%; + } +} + +@media screen and (min-width: 750px) { + button { + width: 40%; + max-width: 400px; + } +} + +.page-container { + position: absolute; + left: 0; + top: 0; + + min-width: 100%; + min-height: 100%; + + display: -webkit-box; + display: flex; + + -webkit-box-orient: vertical; + flex-direction: column; + + align-items: center; + + visibility: hidden; + + padding: 20px; + box-sizing: border-box; + background-color: #f1c40f; +} + +.page-container.current-page { + visibility: visible; +} + +.page-container.notification-opened { + background-color: #3498db; +} + +@media screen and (orientation: landscape) { + .page-container.notification-opened { + -webkit-box-orient: horizontal; + flex-direction: row; + } + + .page-container.notification-opened > .notification-arrow { + margin-right: 20px; + } +} + +.page-container.launched-from-notification { + background-color: #1abc9c; +} + +.page-container.secret-screen { + background-color: #34495e; +} + +.page-container > img { + display: block; + width: 25%; + max-width: 200px; + height: auto; +} + +.main-content { + display: flex; + display: -webkit-box; + + align-items: center; + -webkit-box-align: center; + + flex: 1; + -webkit-box-flex: 1; + + flex-direction: column; + -webkit-box-orient: vertical; +} + +.main-content > p { + width: 100%; + text-align: center; +} + +/** Handle the animations from left to right **/ +.animate-to-left { + -webkit-animation: moveToLeft .5s ease both; + animation: moveToLeft .5s ease both; +} + +.animate-to-right { + -webkit-animation: moveToRight .5s ease both; + animation: moveToRight .5s ease both; +} + +.animate-from-right { + -webkit-animation: moveFromRight .5s ease both; + animation: moveFromRight .5s ease both; +} + +.animate-from-left { + -webkit-animation: moveFromLeft .5s ease both; + animation: moveFromLeft .5s ease both; +} + +@-webkit-keyframes moveToLeft { + to { + -webkit-transform: translateX(-100%); + } +} + +@keyframes moveToLeft { + to { + -webkit-transform: translateX(-100%); + transform: translateX(-100%); + } +} + +@-webkit-keyframes moveToRight { + to { -webkit-transform: translateX(100%); } +} + +@keyframes moveToRight { + to { + -webkit-transform: translateX(100%); + transform: translateX(100%); + } +} + +@-webkit-keyframes moveFromRight { + from { -webkit-transform: translateX(100%); } +} + +@keyframes moveFromRight { + from { + -webkit-transform: translateX(100%); + transform: translateX(100%); + } +} + +@-webkit-keyframes moveFromLeft { + from { -webkit-transform: translateX(-100%); } +} + +@keyframes moveFromLeft { + from { + -webkit-transform: translateX(-100%); + transform: translateX(-100%); + } +} \ No newline at end of file diff --git "a/\346\272\220\347\240\201/webview/input-file-example/build.gradle" "b/\346\272\220\347\240\201/webview/input-file-example/build.gradle" new file mode 100644 index 00000000..9b8abe4f --- /dev/null +++ "b/\346\272\220\347\240\201/webview/input-file-example/build.gradle" @@ -0,0 +1,19 @@ +// Top-level build file where you can add configuration options common to all sub-projects/modules. + +buildscript { + repositories { + jcenter() + } + dependencies { + classpath 'com.android.tools.build:gradle:0.12.2' + + // NOTE: Do not place your application dependencies here; they belong + // in the individual module build.gradle files + } +} + +allprojects { + repositories { + jcenter() + } +} diff --git "a/\346\272\220\347\240\201/webview/input-file-example/gradle.properties" "b/\346\272\220\347\240\201/webview/input-file-example/gradle.properties" new file mode 100644 index 00000000..5d08ba75 --- /dev/null +++ "b/\346\272\220\347\240\201/webview/input-file-example/gradle.properties" @@ -0,0 +1,18 @@ +# Project-wide Gradle settings. + +# IDE (e.g. Android Studio) users: +# Settings specified in this file will override any Gradle settings +# configured through the IDE. + +# For more details on how to configure your build environment visit +# http://www.gradle.org/docs/current/userguide/build_environment.html + +# Specifies the JVM arguments used for the daemon process. +# The setting is particularly useful for tweaking memory settings. +# Default value: -Xmx10248m -XX:MaxPermSize=256m +# org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 + +# When configured, Gradle will run in incubating parallel mode. +# This option should only be used with decoupled projects. More details, visit +# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects +# org.gradle.parallel=true \ No newline at end of file diff --git "a/\346\272\220\347\240\201/webview/input-file-example/gradle/wrapper/gradle-wrapper.jar" "b/\346\272\220\347\240\201/webview/input-file-example/gradle/wrapper/gradle-wrapper.jar" new file mode 100644 index 00000000..8c0fb64a Binary files /dev/null and "b/\346\272\220\347\240\201/webview/input-file-example/gradle/wrapper/gradle-wrapper.jar" differ diff --git "a/\346\272\220\347\240\201/webview/input-file-example/gradle/wrapper/gradle-wrapper.properties" "b/\346\272\220\347\240\201/webview/input-file-example/gradle/wrapper/gradle-wrapper.properties" new file mode 100644 index 00000000..1e61d1fd --- /dev/null +++ "b/\346\272\220\347\240\201/webview/input-file-example/gradle/wrapper/gradle-wrapper.properties" @@ -0,0 +1,6 @@ +#Wed Apr 10 15:27:10 PDT 2013 +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists +distributionUrl=http\://services.gradle.org/distributions/gradle-1.12-all.zip diff --git "a/\346\272\220\347\240\201/webview/input-file-example/gradlew" "b/\346\272\220\347\240\201/webview/input-file-example/gradlew" new file mode 100755 index 00000000..91a7e269 --- /dev/null +++ "b/\346\272\220\347\240\201/webview/input-file-example/gradlew" @@ -0,0 +1,164 @@ +#!/usr/bin/env bash + +############################################################################## +## +## Gradle start up script for UN*X +## +############################################################################## + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS="" + +APP_NAME="Gradle" +APP_BASE_NAME=`basename "$0"` + +# Use the maximum available, or set MAX_FD != -1 to use that value. +MAX_FD="maximum" + +warn ( ) { + echo "$*" +} + +die ( ) { + echo + echo "$*" + echo + exit 1 +} + +# OS specific support (must be 'true' or 'false'). +cygwin=false +msys=false +darwin=false +case "`uname`" in + CYGWIN* ) + cygwin=true + ;; + Darwin* ) + darwin=true + ;; + MINGW* ) + msys=true + ;; +esac + +# For Cygwin, ensure paths are in UNIX format before anything is touched. +if $cygwin ; then + [ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"` +fi + +# Attempt to set APP_HOME +# Resolve links: $0 may be a link +PRG="$0" +# Need this for relative symlinks. +while [ -h "$PRG" ] ; do + ls=`ls -ld "$PRG"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + PRG="$link" + else + PRG=`dirname "$PRG"`"/$link" + fi +done +SAVED="`pwd`" +cd "`dirname \"$PRG\"`/" >&- +APP_HOME="`pwd -P`" +cd "$SAVED" >&- + +CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar + +# Determine the Java command to use to start the JVM. +if [ -n "$JAVA_HOME" ] ; then + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD="$JAVA_HOME/jre/sh/java" + else + JAVACMD="$JAVA_HOME/bin/java" + fi + if [ ! -x "$JAVACMD" ] ; then + die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + fi +else + JAVACMD="java" + which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." +fi + +# Increase the maximum file descriptors if we can. +if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then + MAX_FD_LIMIT=`ulimit -H -n` + if [ $? -eq 0 ] ; then + if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then + MAX_FD="$MAX_FD_LIMIT" + fi + ulimit -n $MAX_FD + if [ $? -ne 0 ] ; then + warn "Could not set maximum file descriptor limit: $MAX_FD" + fi + else + warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" + fi +fi + +# For Darwin, add options to specify how the application appears in the dock +if $darwin; then + GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" +fi + +# For Cygwin, switch paths to Windows format before running java +if $cygwin ; then + APP_HOME=`cygpath --path --mixed "$APP_HOME"` + CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` + + # We build the pattern for arguments to be converted via cygpath + ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` + SEP="" + for dir in $ROOTDIRSRAW ; do + ROOTDIRS="$ROOTDIRS$SEP$dir" + SEP="|" + done + OURCYGPATTERN="(^($ROOTDIRS))" + # Add a user-defined pattern to the cygpath arguments + if [ "$GRADLE_CYGPATTERN" != "" ] ; then + OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" + fi + # Now convert the arguments - kludge to limit ourselves to /bin/sh + i=0 + for arg in "$@" ; do + CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` + CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option + + if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition + eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` + else + eval `echo args$i`="\"$arg\"" + fi + i=$((i+1)) + done + case $i in + (0) set -- ;; + (1) set -- "$args0" ;; + (2) set -- "$args0" "$args1" ;; + (3) set -- "$args0" "$args1" "$args2" ;; + (4) set -- "$args0" "$args1" "$args2" "$args3" ;; + (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; + (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; + (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; + (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; + (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; + esac +fi + +# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules +function splitJvmOpts() { + JVM_OPTS=("$@") +} +eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS +JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME" + +exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@" diff --git "a/\346\272\220\347\240\201/webview/input-file-example/gradlew.bat" "b/\346\272\220\347\240\201/webview/input-file-example/gradlew.bat" new file mode 100644 index 00000000..8a0b282a --- /dev/null +++ "b/\346\272\220\347\240\201/webview/input-file-example/gradlew.bat" @@ -0,0 +1,90 @@ +@if "%DEBUG%" == "" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS= + +set DIRNAME=%~dp0 +if "%DIRNAME%" == "" set DIRNAME=. +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if "%ERRORLEVEL%" == "0" goto init + +echo. +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto init + +echo. +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:init +@rem Get command-line arguments, handling Windowz variants + +if not "%OS%" == "Windows_NT" goto win9xME_args +if "%@eval[2+2]" == "4" goto 4NT_args + +:win9xME_args +@rem Slurp the command line arguments. +set CMD_LINE_ARGS= +set _SKIP=2 + +:win9xME_args_slurp +if "x%~1" == "x" goto execute + +set CMD_LINE_ARGS=%* +goto execute + +:4NT_args +@rem Get arguments from the 4NT Shell from JP Software +set CMD_LINE_ARGS=%$ + +:execute +@rem Setup the command line + +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% + +:end +@rem End local scope for the variables with windows NT shell +if "%ERRORLEVEL%"=="0" goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 +exit /b 1 + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git "a/\346\272\220\347\240\201/webview/input-file-example/settings.gradle" "b/\346\272\220\347\240\201/webview/input-file-example/settings.gradle" new file mode 100644 index 00000000..e7b4def4 --- /dev/null +++ "b/\346\272\220\347\240\201/webview/input-file-example/settings.gradle" @@ -0,0 +1 @@ +include ':app' diff --git "a/\346\272\220\347\240\201/webview/jsinterface-example/.gitignore" "b/\346\272\220\347\240\201/webview/jsinterface-example/.gitignore" new file mode 100644 index 00000000..afbdab33 --- /dev/null +++ "b/\346\272\220\347\240\201/webview/jsinterface-example/.gitignore" @@ -0,0 +1,6 @@ +.gradle +/local.properties +/.idea/workspace.xml +/.idea/libraries +.DS_Store +/build diff --git "a/\346\272\220\347\240\201/webview/jsinterface-example/app/.gitignore" "b/\346\272\220\347\240\201/webview/jsinterface-example/app/.gitignore" new file mode 100644 index 00000000..796b96d1 --- /dev/null +++ "b/\346\272\220\347\240\201/webview/jsinterface-example/app/.gitignore" @@ -0,0 +1 @@ +/build diff --git "a/\346\272\220\347\240\201/webview/jsinterface-example/app/build.gradle" "b/\346\272\220\347\240\201/webview/jsinterface-example/app/build.gradle" new file mode 100644 index 00000000..c4d9e2ea --- /dev/null +++ "b/\346\272\220\347\240\201/webview/jsinterface-example/app/build.gradle" @@ -0,0 +1,26 @@ +apply plugin: 'com.android.application' + +android { + compileSdkVersion 21 + buildToolsVersion "21.0.0" + + defaultConfig { + applicationId "jsinterfacesample.android.chrome.google.com.jsinterface_example" + minSdkVersion 19 + targetSdkVersion 21 + versionCode 1 + versionName "1.0" + } + buildTypes { + release { + runProguard false + proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' + } + } +} + +dependencies { + compile fileTree(dir: 'libs', include: ['*.jar']) + // You must install or update the Support Repository through the SDK manager to use this dependency. + compile 'com.android.support:support-v4:21.0.0' +} diff --git "a/\346\272\220\347\240\201/webview/jsinterface-example/app/proguard-rules.pro" "b/\346\272\220\347\240\201/webview/jsinterface-example/app/proguard-rules.pro" new file mode 100644 index 00000000..c7e91516 --- /dev/null +++ "b/\346\272\220\347\240\201/webview/jsinterface-example/app/proguard-rules.pro" @@ -0,0 +1,17 @@ +# Add project specific ProGuard rules here. +# By default, the flags in this file are appended to flags specified +# in /Users/mattgaunt/Programming/Tools/android-sdk_1518674_mac-x86/tools/proguard/proguard-android.txt +# You can edit the include path and order by changing the proguardFiles +# directive in build.gradle. +# +# For more details, see +# http://developer.android.com/guide/developing/tools/proguard.html + +# Add any project specific keep options here: + +# If your project uses WebView with JS, uncomment the following +# and specify the fully qualified class name to the JavaScript interface +# class: +#-keepclassmembers class fqcn.of.javascript.interface.for.webview { +# public *; +#} diff --git "a/\346\272\220\347\240\201/webview/jsinterface-example/app/src/androidTest/java/jsinterfacesample/android/chrome/google/com/jsinterface_example/ApplicationTest.java" "b/\346\272\220\347\240\201/webview/jsinterface-example/app/src/androidTest/java/jsinterfacesample/android/chrome/google/com/jsinterface_example/ApplicationTest.java" new file mode 100644 index 00000000..e37dd627 --- /dev/null +++ "b/\346\272\220\347\240\201/webview/jsinterface-example/app/src/androidTest/java/jsinterfacesample/android/chrome/google/com/jsinterface_example/ApplicationTest.java" @@ -0,0 +1,13 @@ +package jsinterfacesample.android.chrome.google.com.jsinterface_example; + +import android.app.Application; +import android.test.ApplicationTestCase; + +/** + * Testing Fundamentals + */ +public class ApplicationTest extends ApplicationTestCase { + public ApplicationTest() { + super(Application.class); + } +} \ No newline at end of file diff --git "a/\346\272\220\347\240\201/webview/jsinterface-example/app/src/main/AndroidManifest.xml" "b/\346\272\220\347\240\201/webview/jsinterface-example/app/src/main/AndroidManifest.xml" new file mode 100644 index 00000000..20b6d163 --- /dev/null +++ "b/\346\272\220\347\240\201/webview/jsinterface-example/app/src/main/AndroidManifest.xml" @@ -0,0 +1,21 @@ + + + + + + + + + + + + + + diff --git "a/\346\272\220\347\240\201/webview/jsinterface-example/app/src/main/assets/www/bower_components/modernizr/modernizr.custom.72986.js" "b/\346\272\220\347\240\201/webview/jsinterface-example/app/src/main/assets/www/bower_components/modernizr/modernizr.custom.72986.js" new file mode 100644 index 00000000..5ef0bd8d --- /dev/null +++ "b/\346\272\220\347\240\201/webview/jsinterface-example/app/src/main/assets/www/bower_components/modernizr/modernizr.custom.72986.js" @@ -0,0 +1,4 @@ +/* Modernizr 2.6.2 (Custom Build) | MIT & BSD + * Build: http://modernizr.com/download/#-shiv-cssclasses-prefixed-testprop-testallprops-domprefixes-load + */ +;window.Modernizr=function(a,b,c){function x(a){j.cssText=a}function y(a,b){return x(prefixes.join(a+";")+(b||""))}function z(a,b){return typeof a===b}function A(a,b){return!!~(""+a).indexOf(b)}function B(a,b){for(var d in a){var e=a[d];if(!A(e,"-")&&j[e]!==c)return b=="pfx"?e:!0}return!1}function C(a,b,d){for(var e in a){var f=b[a[e]];if(f!==c)return d===!1?a[e]:z(f,"function")?f.bind(d||b):f}return!1}function D(a,b,c){var d=a.charAt(0).toUpperCase()+a.slice(1),e=(a+" "+n.join(d+" ")+d).split(" ");return z(b,"string")||z(b,"undefined")?B(e,b):(e=(a+" "+o.join(d+" ")+d).split(" "),C(e,b,c))}var d="2.6.2",e={},f=!0,g=b.documentElement,h="modernizr",i=b.createElement(h),j=i.style,k,l={}.toString,m="Webkit Moz O ms",n=m.split(" "),o=m.toLowerCase().split(" "),p={},q={},r={},s=[],t=s.slice,u,v={}.hasOwnProperty,w;!z(v,"undefined")&&!z(v.call,"undefined")?w=function(a,b){return v.call(a,b)}:w=function(a,b){return b in a&&z(a.constructor.prototype[b],"undefined")},Function.prototype.bind||(Function.prototype.bind=function(b){var c=this;if(typeof c!="function")throw new TypeError;var d=t.call(arguments,1),e=function(){if(this instanceof e){var a=function(){};a.prototype=c.prototype;var f=new a,g=c.apply(f,d.concat(t.call(arguments)));return Object(g)===g?g:f}return c.apply(b,d.concat(t.call(arguments)))};return e});for(var E in p)w(p,E)&&(u=E.toLowerCase(),e[u]=p[E](),s.push((e[u]?"":"no-")+u));return e.addTest=function(a,b){if(typeof a=="object")for(var d in a)w(a,d)&&e.addTest(d,a[d]);else{a=a.toLowerCase();if(e[a]!==c)return e;b=typeof b=="function"?b():b,typeof f!="undefined"&&f&&(g.className+=" "+(b?"":"no-")+a),e[a]=b}return e},x(""),i=k=null,function(a,b){function k(a,b){var c=a.createElement("p"),d=a.getElementsByTagName("head")[0]||a.documentElement;return c.innerHTML="x",d.insertBefore(c.lastChild,d.firstChild)}function l(){var a=r.elements;return typeof a=="string"?a.split(" "):a}function m(a){var b=i[a[g]];return b||(b={},h++,a[g]=h,i[h]=b),b}function n(a,c,f){c||(c=b);if(j)return c.createElement(a);f||(f=m(c));var g;return f.cache[a]?g=f.cache[a].cloneNode():e.test(a)?g=(f.cache[a]=f.createElem(a)).cloneNode():g=f.createElem(a),g.canHaveChildren&&!d.test(a)?f.frag.appendChild(g):g}function o(a,c){a||(a=b);if(j)return a.createDocumentFragment();c=c||m(a);var d=c.frag.cloneNode(),e=0,f=l(),g=f.length;for(;e",f="hidden"in a,j=a.childNodes.length==1||function(){b.createElement("a");var a=b.createDocumentFragment();return typeof a.cloneNode=="undefined"||typeof a.createDocumentFragment=="undefined"||typeof a.createElement=="undefined"}()}catch(c){f=!0,j=!0}})();var r={elements:c.elements||"abbr article aside audio bdi canvas data datalist details figcaption figure footer header hgroup mark meter nav output progress section summary time video",shivCSS:c.shivCSS!==!1,supportsUnknownElements:j,shivMethods:c.shivMethods!==!1,type:"default",shivDocument:q,createElement:n,createDocumentFragment:o};a.html5=r,q(b)}(this,b),e._version=d,e._domPrefixes=o,e._cssomPrefixes=n,e.testProp=function(a){return B([a])},e.testAllProps=D,e.prefixed=function(a,b,c){return b?D(a,b,c):D(a,"pfx")},g.className=g.className.replace(/(^|\s)no-js(\s|$)/,"$1$2")+(f?" js "+s.join(" "):""),e}(this,this.document),function(a,b,c){function d(a){return"[object Function]"==o.call(a)}function e(a){return"string"==typeof a}function f(){}function g(a){return!a||"loaded"==a||"complete"==a||"uninitialized"==a}function h(){var a=p.shift();q=1,a?a.t?m(function(){("c"==a.t?B.injectCss:B.injectJs)(a.s,0,a.a,a.x,a.e,1)},0):(a(),h()):q=0}function i(a,c,d,e,f,i,j){function k(b){if(!o&&g(l.readyState)&&(u.r=o=1,!q&&h(),l.onload=l.onreadystatechange=null,b)){"img"!=a&&m(function(){t.removeChild(l)},50);for(var d in y[c])y[c].hasOwnProperty(d)&&y[c][d].onload()}}var j=j||B.errorTimeout,l=b.createElement(a),o=0,r=0,u={t:d,s:c,e:f,a:i,x:j};1===y[c]&&(r=1,y[c]=[]),"object"==a?l.data=c:(l.src=c,l.type=a),l.width=l.height="0",l.onerror=l.onload=l.onreadystatechange=function(){k.call(this,r)},p.splice(e,0,u),"img"!=a&&(r||2===y[c]?(t.insertBefore(l,s?null:n),m(k,j)):y[c].push(l))}function j(a,b,c,d,f){return q=0,b=b||"j",e(a)?i("c"==b?v:u,a,b,this.i++,c,d,f):(p.splice(this.i++,0,a),1==p.length&&h()),this}function k(){var a=B;return a.loader={load:j,i:0},a}var l=b.documentElement,m=a.setTimeout,n=b.getElementsByTagName("script")[0],o={}.toString,p=[],q=0,r="MozAppearance"in l.style,s=r&&!!b.createRange().compareNode,t=s?l:n.parentNode,l=a.opera&&"[object Opera]"==o.call(a.opera),l=!!b.attachEvent&&!l,u=r?"object":l?"script":"img",v=l?"script":u,w=Array.isArray||function(a){return"[object Array]"==o.call(a)},x=[],y={},z={timeout:function(a,b){return b.length&&(a.timeout=b[0]),a}},A,B;B=function(a){function b(a){var a=a.split("!"),b=x.length,c=a.pop(),d=a.length,c={url:c,origUrl:c,prefixes:a},e,f,g;for(f=0;f + + + + + JS Interface Demo + + + + + + + +
+
+

Notify Me of Awesome

+
+ + +
+ +
+ + +
+
+

Notification Time

+
+ +

There should be a notification waiting for you...

+
+
+ +
+
+

You Clicked the Notification

+
+
+

There is only so much I can do with a notification you know...

+
+
+ +
+
+

Ssshhhhh

+
+ +
+

Secret Spot in the app, congrats :)

+
+
+ + + + diff --git "a/\346\272\220\347\240\201/webview/jsinterface-example/app/src/main/assets/www/scripts/main.js" "b/\346\272\220\347\240\201/webview/jsinterface-example/app/src/main/assets/www/scripts/main.js" new file mode 100644 index 00000000..2191dc6c --- /dev/null +++ "b/\346\272\220\347\240\201/webview/jsinterface-example/app/src/main/assets/www/scripts/main.js" @@ -0,0 +1,189 @@ +/* + * Copyright (C) 2010 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * From this point onwards, the Javascript is managing UI and + * application state + */ +var animEndEventNames = { + 'WebkitAnimation' : 'webkitAnimationEnd', + 'OAnimation' : 'oAnimationEnd', + 'msAnimation' : 'MSAnimationEnd', + 'animation' : 'animationend' +}; + +// animation end event name +var animEndEventName = animEndEventNames[ Modernizr.prefixed( 'animation' ) ]; + +var NOTIFICATION_SHOWN = 0; +var LAUNCH_FROM_NOTIFICATION = 1; +var DEFAULT = 2; +var SECRET_SCREEN = 3; + +var exports = {}; + +var currentState; +var animating = false; + +function changeState(newState, animateForward) { + console.log('changeState()'); + + if(animating || (newState == currentState)) { + return; + } + + var currentPage = document.querySelector('.current-page'); + var newUI; + + var animCurrent = animateForward ? 'animate-to-left' : 'animate-to-right'; + var animNew = animateForward ? 'animate-from-right' : 'animate-from-left'; + + var hash; + + switch(newState) { + case NOTIFICATION_SHOWN: + newUI = getNotifcationArrow(); + hash = 'notification-shown'; + break; + case LAUNCH_FROM_NOTIFICATION: + newUI = getLaunchFromNotificationUI(); + hash = 'notification-launch'; + break; + case DEFAULT: + newUI = getDefaultUI(); + hash = ''; + break; + case SECRET_SCREEN: + animCurrent = 'animate-to-right'; + animNew = 'animate-from-left'; + newUI = getSecretUI(); + hash = 'secret'; + break; + } + + newUI.classList.add('current-page'); + + if(currentPage) { + // We need to animate + animating = true; + + currentPage.classList.add(animCurrent); + newUI.classList.add(animNew); + + currentPage.addEventListener(animEndEventName, pageAnimationEnd(currentPage, newUI, animCurrent, animNew), false); + } + + currentState = newState; + + pushState({}, "", hash); +} + +function pageAnimationEnd(currentPage, newPage, animCurrent, animNew) { + var animEndFunc = function() { + currentPage.removeEventListener(animEndEventName, animEndFunc, false); + + currentPage.classList.remove(animCurrent); + newPage.classList.remove(animNew); + + currentPage.classList.remove('current-page'); + + animating = false; + }; + return animEndFunc; +} + +function getNotifcationArrow() { + return document.querySelector('.notification-opened'); +} + +function getLaunchFromNotificationUI() { + return document.querySelector('.launched-from-notification'); +} + +function getDefaultUI() { + return document.querySelector('.init-screen'); +} + +function getSecretUI() { + return document.querySelector('.secret-screen'); +} + +function updateUI(animateForward) { + console.log('updateUI()'); + var identifier = window.location.hash; + var state; + + if(identifier == '#notification-launch') { + state = LAUNCH_FROM_NOTIFICATION; + } else if(identifier == '#notification-shown') { + state = NOTIFICATION_SHOWN; + } else if(identifier == '#secret') { + state = SECRET_SCREEN; + } else { + state = DEFAULT; + } + + changeState(state, animateForward); +} + +function showSecretMessage() { + var ui = getSecretUI(); + if(ui.classList.contains('current-page')) { + if(animating) { + return; + } + window.history.back(); + } else { + changeState(SECRET_SCREEN); + + return 'You Found the Secret'; + } +} + +function pushState(state, title, path) { + if(!path) { + return; + } + + window.location.hash = path; +} + +window.onpopstate = function(event) { + console.log('onpopstate()'); + var popped = document.querySelector('.current-page') ? true : false; + if(popped && currentState == SECRET_SCREEN) { + popped = false; + } + updateUI(!popped); +}; + +/** + * When the window loads, connect the showNotificationBtn to the Javascript + * interface "window.NotificationBind" + */ +window.onload = function() { + console.log('window.onload'); + var showNotificationBtn = document.querySelector('#show-notification-btn'); + showNotificationBtn.addEventListener('click', function() { + if(window.NotificationBind) { + NotificationBind.showNotification('This is an Awesome notification'); + } + + changeState(NOTIFICATION_SHOWN, true); + }); + + updateUI(true); +}; \ No newline at end of file diff --git "a/\346\272\220\347\240\201/webview/jsinterface-example/app/src/main/assets/www/styles/main.css" "b/\346\272\220\347\240\201/webview/jsinterface-example/app/src/main/assets/www/styles/main.css" new file mode 100644 index 00000000..8433978b --- /dev/null +++ "b/\346\272\220\347\240\201/webview/jsinterface-example/app/src/main/assets/www/styles/main.css" @@ -0,0 +1,269 @@ +/* + * Copyright (C) 2010 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** Reference Local Fonts **/ +@font-face { + font-family: 'Lobster Two'; + font-style: normal; + font-weight: 400; + src: local('Lobster Two'), local('LobsterTwo'), url('../fonts/Lobster_Two/LobsterTwo-Regular.ttf') format('truetype'); +} + +@font-face { + font-family: 'Londrina Shadow'; + font-style: normal; + font-weight: 400; + src: local('Londrina Shadow'), local('LondrinaShadow-Regular'), url('../fonts/Londrina_Shadow/LondrinaShadow-Regular.ttf') format('truetype'); +} + +html, body { + width: 100%; + height: 100%; + min-height: 100%; + margin: 0; + padding: 0; + font-size: 26px; + + overflow: hidden; +} + +body { + position: relative; + font-family: 'Lobster Two', cursive; + color: #fefefe; + + overflow: hidden; +} + +h1, h2, h3, h4, h5, h6 { + font-family: 'Londrina Shadow', cursive; +} + +header { + display: flex; + display: -webkit-box; + + align-items: center; + -webkit-box-align: center; + + flex: 1; + -webkit-box-flex: 1; +} + +header > h1 { + width: 100%; + font-size: 60px; + text-align: center; + margin: 16px 0; +} + +@media screen and (orientation: landscape) { + header > h1 { + font-size: 50px; + } +} + +button { + display: block; + width: 100%; + background-color: #f39c12; + color: inherit; + font-family: inherit; + font-size: inherit; + padding: 16px; + margin: 0 auto; + border-radius: 6px; + border-style: none; + border-bottom-style: solid; + border-color: #E68F05; + border-width: 4px; + + /** + * Remove any touch feedback from WebView since + * We handle the :active state + */ + outline: 0; + -webkit-tap-highlight-color: rgba(0,0,0, 0.0); + + -webkit-user-select: none; + user-select: none; + } + + button:focus { + background-color: #E68F05; + border-color: #DA8300; +} + +button:active { + background-color: #FFA91F; + border-color: #E68F05; +} + +@media screen and (min-width: 500px) { + button { + width: 60%; + } +} + +@media screen and (min-width: 750px) { + button { + width: 40%; + max-width: 400px; + } +} + +.page-container { + position: absolute; + left: 0; + top: 0; + + min-width: 100%; + min-height: 100%; + + display: -webkit-box; + display: flex; + + -webkit-box-orient: vertical; + flex-direction: column; + + align-items: center; + + visibility: hidden; + + padding: 20px; + box-sizing: border-box; + background-color: #f1c40f; +} + +.page-container.current-page { + visibility: visible; +} + +.page-container.notification-opened { + background-color: #3498db; +} + +@media screen and (orientation: landscape) { + .page-container.notification-opened { + -webkit-box-orient: horizontal; + flex-direction: row; + } + + .page-container.notification-opened > .notification-arrow { + margin-right: 20px; + } +} + +.page-container.launched-from-notification { + background-color: #1abc9c; +} + +.page-container.secret-screen { + background-color: #34495e; +} + +.page-container > img { + display: block; + width: 25%; + max-width: 200px; + height: auto; +} + +.main-content { + display: flex; + display: -webkit-box; + + align-items: center; + -webkit-box-align: center; + + flex: 1; + -webkit-box-flex: 1; + + flex-direction: column; + -webkit-box-orient: vertical; +} + +.main-content > p { + width: 100%; + text-align: center; +} + +/** Handle the animations from left to right **/ +.animate-to-left { + -webkit-animation: moveToLeft .5s ease both; + animation: moveToLeft .5s ease both; +} + +.animate-to-right { + -webkit-animation: moveToRight .5s ease both; + animation: moveToRight .5s ease both; +} + +.animate-from-right { + -webkit-animation: moveFromRight .5s ease both; + animation: moveFromRight .5s ease both; +} + +.animate-from-left { + -webkit-animation: moveFromLeft .5s ease both; + animation: moveFromLeft .5s ease both; +} + +@-webkit-keyframes moveToLeft { + to { + -webkit-transform: translateX(-100%); + } +} + +@keyframes moveToLeft { + to { + -webkit-transform: translateX(-100%); + transform: translateX(-100%); + } +} + +@-webkit-keyframes moveToRight { + to { -webkit-transform: translateX(100%); } +} + +@keyframes moveToRight { + to { + -webkit-transform: translateX(100%); + transform: translateX(100%); + } +} + +@-webkit-keyframes moveFromRight { + from { -webkit-transform: translateX(100%); } +} + +@keyframes moveFromRight { + from { + -webkit-transform: translateX(100%); + transform: translateX(100%); + } +} + +@-webkit-keyframes moveFromLeft { + from { -webkit-transform: translateX(-100%); } +} + +@keyframes moveFromLeft { + from { + -webkit-transform: translateX(-100%); + transform: translateX(-100%); + } +} \ No newline at end of file diff --git "a/\346\272\220\347\240\201/webview/jsinterface-example/app/src/main/java/jsinterfacesample/android/chrome/google/com/jsinterface_example/MainActivity.java" "b/\346\272\220\347\240\201/webview/jsinterface-example/app/src/main/java/jsinterfacesample/android/chrome/google/com/jsinterface_example/MainActivity.java" new file mode 100644 index 00000000..b72bcd9b --- /dev/null +++ "b/\346\272\220\347\240\201/webview/jsinterface-example/app/src/main/java/jsinterfacesample/android/chrome/google/com/jsinterface_example/MainActivity.java" @@ -0,0 +1,73 @@ +/* + * Copyright (C) 2010 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package jsinterfacesample.android.chrome.google.com.jsinterface_example; + +import android.app.Activity; +import android.app.Fragment; +import android.os.Bundle; +import android.view.Menu; +import android.view.MenuItem; + +public class MainActivity extends Activity { + + private MainFragment mMainFragment; + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_main); + if (savedInstanceState == null) { + mMainFragment = new MainFragment(); + getFragmentManager().beginTransaction() + .add(R.id.activity_main_container, mMainFragment) + .commit(); + } + } + + + @Override + public boolean onCreateOptionsMenu(Menu menu) { + // Inflate the menu; this adds items to the action bar if it is present. + getMenuInflater().inflate(R.menu.main, menu); + return true; + } + + /** + * If the help menu option is selected, show a new + * screen in the WebView + */ + @Override + public boolean onOptionsItemSelected(MenuItem item) { + switch (item.getItemId()) { + case R.id.action_help: + mMainFragment.loadJavascript("showSecretMessage();"); + return true; + default: + return super.onOptionsItemSelected(item); + } + } + + /** + * Go back through the WebView back stack before + * exiting the app + */ + @Override + public void onBackPressed() { + if(!mMainFragment.goBack()) { + super.onBackPressed(); + } + } +} diff --git "a/\346\272\220\347\240\201/webview/jsinterface-example/app/src/main/java/jsinterfacesample/android/chrome/google/com/jsinterface_example/MainFragment.java" "b/\346\272\220\347\240\201/webview/jsinterface-example/app/src/main/java/jsinterfacesample/android/chrome/google/com/jsinterface_example/MainFragment.java" new file mode 100644 index 00000000..ea60c40b --- /dev/null +++ "b/\346\272\220\347\240\201/webview/jsinterface-example/app/src/main/java/jsinterfacesample/android/chrome/google/com/jsinterface_example/MainFragment.java" @@ -0,0 +1,231 @@ +/* + * Copyright (C) 2010 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package jsinterfacesample.android.chrome.google.com.jsinterface_example; + +import android.annotation.TargetApi; +import android.app.Fragment; +import android.content.Intent; +import android.graphics.Color; +import android.os.Build; +import android.os.Bundle; +import android.util.JsonReader; +import android.util.JsonToken; +import android.util.Log; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.webkit.ValueCallback; +import android.webkit.WebSettings; +import android.webkit.WebView; +import android.webkit.WebViewClient; +import android.widget.Toast; + +import java.io.IOException; +import java.io.StringReader; + +/** + * Created by mattgaunt on 10/16/14. + */ +public class MainFragment extends Fragment { + + public static final String EXTRA_FROM_NOTIFICATION = "EXTRA_FROM_NOTIFICATION"; + + private WebView mWebView; + + public MainFragment() { + } + + @Override + public View onCreateView(LayoutInflater inflater, ViewGroup container, + Bundle savedInstanceState) { + View rootView = inflater.inflate(R.layout.fragment_main, container, false); + + // Get reference of WebView from layout/activity_main.xml + mWebView = (WebView) rootView.findViewById(R.id.fragment_main_webview); + + // Add Javascript Interface, this will expose "window.NotificationBind" + // in Javascript + mWebView.addJavascriptInterface( + new NotificationBindObject(getActivity().getApplicationContext()), + "NotificationBind"); + + setUpWebViewDefaults(mWebView); + + // Check whether we're recreating a previously destroyed instance + if (savedInstanceState != null) { + // Restore the previous URL and history stack + mWebView.restoreState(savedInstanceState); + } + + // Prepare the WebView and get the appropriate URL + String url = prepareWebView(mWebView.getUrl()); + + // Load the local index.html file + if(mWebView.getUrl() == null) { + mWebView.loadUrl(url); + } + + return rootView; + } + + /** + * Convenience method to set some generic defaults for a + * given WebView + * + * @param webView + */ + @TargetApi(Build.VERSION_CODES.HONEYCOMB) + private void setUpWebViewDefaults(WebView webView) { + WebSettings settings = webView.getSettings(); + + // Enable Javascript + settings.setJavaScriptEnabled(true); + + // Use WideViewport and Zoom out if there is no viewport defined + settings.setUseWideViewPort(true); + settings.setLoadWithOverviewMode(true); + + // Enable pinch to zoom without the zoom buttons + settings.setBuiltInZoomControls(true); + + if(Build.VERSION.SDK_INT > Build.VERSION_CODES.HONEYCOMB) { + // Hide the zoom controls for HONEYCOMB+ + settings.setDisplayZoomControls(false); + } + + // Enable remote debugging via chrome://inspect + if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) { + WebView.setWebContentsDebuggingEnabled(true); + } + } + + /** + * This is method where specific logic for this application is going to live + * @return url to load + */ + private String prepareWebView(String currentUrl) { + String hash = ""; + int bgColor; + + if(currentUrl != null) { + String[] hashSplit = currentUrl.split("#"); + if(hashSplit.length == 2) { + hash = hashSplit[1]; + } + } else { + Intent intent = getActivity().getIntent(); + if(intent != null && intent.getBooleanExtra(EXTRA_FROM_NOTIFICATION, false)) { + hash = "notification-launch"; + } + } + + if(hash.equals("notification-launch")) { + bgColor = Color.parseColor("#1abc9c"); + } else if(hash.equals("notification-shown")) { + bgColor = Color.parseColor("#3498db"); + } else if(hash.equals("secret")) { + bgColor = Color.parseColor("#34495e"); + } else { + bgColor = Color.parseColor("#f1c40f"); + } + + preventBGColorFlicker(bgColor); + + // We set the WebViewClient to ensure links are consumed by the WebView rather + // than passed to a browser if it can + mWebView.setWebViewClient(new WebViewClient()); + + return "file:///android_asset/www/index.html#"+hash; + } + + /** + * This is a little bit of trickery to make the background color of the UI + * the same as the anticipated UI background color of the web-app. + * + * @param bgColor + */ + private void preventBGColorFlicker(int bgColor) { + ((ViewGroup) getActivity().findViewById(R.id.activity_main_container)).setBackgroundColor(bgColor); + mWebView.setBackgroundColor(bgColor); + } + + /** + * This method is designed to hide how Javascript is injected into + * the WebView. + * + * In KitKat the new evaluateJavascript method has the ability to + * give you access to any return values via the ValueCallback object. + * + * The String passed into onReceiveValue() is a JSON string, so if you + * execute a javascript method which return a javascript object, you can + * parse it as valid JSON. If the method returns a primitive value, it + * will be a valid JSON object, but you should use the setLenient method + * to true and then you can use peek() to test what kind of object it is, + * + * @param javascript + */ + public void loadJavascript(String javascript) { + if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) { + // In KitKat+ you should use the evaluateJavascript method + mWebView.evaluateJavascript(javascript, new ValueCallback() { + @TargetApi(Build.VERSION_CODES.HONEYCOMB) + @Override + public void onReceiveValue(String s) { + JsonReader reader = new JsonReader(new StringReader(s)); + + // Must set lenient to parse single values + reader.setLenient(true); + + try { + if(reader.peek() != JsonToken.NULL) { + if(reader.peek() == JsonToken.STRING) { + String msg = reader.nextString(); + if(msg != null) { + Toast.makeText(getActivity().getApplicationContext(), + msg, Toast.LENGTH_LONG).show(); + } + } + } + } catch (IOException e) { + Log.e("TAG", "MainActivity: IOException", e); + } finally { + try { + reader.close(); + } catch (IOException e) { + // NOOP + } + } + } + }); + } else { + /** + * For pre-KitKat+ you should use loadUrl("javascript:"); + * To then call back to Java you would need to use addJavascriptInterface() + * and have your JS call the interface + **/ + mWebView.loadUrl("javascript:"+javascript); + } + } + + public boolean goBack() { + if(!mWebView.canGoBack()) { + return false; + } + + mWebView.goBack(); + return true; + } +} diff --git "a/\346\272\220\347\240\201/webview/jsinterface-example/app/src/main/java/jsinterfacesample/android/chrome/google/com/jsinterface_example/NotificationBindObject.java" "b/\346\272\220\347\240\201/webview/jsinterface-example/app/src/main/java/jsinterfacesample/android/chrome/google/com/jsinterface_example/NotificationBindObject.java" new file mode 100644 index 00000000..e8506b0a --- /dev/null +++ "b/\346\272\220\347\240\201/webview/jsinterface-example/app/src/main/java/jsinterfacesample/android/chrome/google/com/jsinterface_example/NotificationBindObject.java" @@ -0,0 +1,78 @@ +/* + * Copyright (C) 2010 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package jsinterfacesample.android.chrome.google.com.jsinterface_example; + +import android.app.NotificationManager; +import android.app.PendingIntent; +import android.content.Context; +import android.content.Intent; +import android.support.v4.app.NotificationCompat; +import android.support.v4.app.TaskStackBuilder; +import android.webkit.JavascriptInterface; + +public class NotificationBindObject { + + private Context mContext; + + public NotificationBindObject(Context context) { + mContext = context; + } + + /** + * The '@JavascriptInterface is required to make the method accessible from the Javascript + * layer + * + * The code in this method is based on the documentation here: + * + * http://developer.android.com/training/notify-user/build-notification.html + * + * @param message The message displayed in the notification + */ + @JavascriptInterface + public void showNotification(String message) { + NotificationCompat.Builder mBuilder = + new NotificationCompat.Builder(mContext) + .setSmallIcon(R.drawable.notification_icon) + .setContentTitle(mContext.getString(R.string.notification_title)) + .setContentText(message) + .setAutoCancel(true); + + // Creates an explicit intent for an Activity in your app + Intent resultIntent = new Intent(mContext, MainActivity.class); + resultIntent.putExtra(MainFragment.EXTRA_FROM_NOTIFICATION, true); + + // The stack builder object will contain an artificial back stack for the + // started Activity. + // This ensures that navigating backward from the Activity leads out of + // your application to the Home screen. + TaskStackBuilder stackBuilder = TaskStackBuilder.create(mContext); + // Adds the back stack for the Intent (but not the Intent itself) + stackBuilder.addParentStack(MainActivity.class); + // Adds the Intent that starts the Activity to the top of the stack + stackBuilder.addNextIntent(resultIntent); + PendingIntent resultPendingIntent = + stackBuilder.getPendingIntent( + 0, + PendingIntent.FLAG_UPDATE_CURRENT + ); + mBuilder.setContentIntent(resultPendingIntent); + NotificationManager mNotificationManager = + (NotificationManager) mContext.getSystemService(Context.NOTIFICATION_SERVICE); + // mId allows you to update the notification later on. + mNotificationManager.notify(-1, mBuilder.build()); + } + +} diff --git "a/\346\272\220\347\240\201/webview/jsinterface-example/app/src/main/res/drawable-hdpi/ic_action_help.png" "b/\346\272\220\347\240\201/webview/jsinterface-example/app/src/main/res/drawable-hdpi/ic_action_help.png" new file mode 100755 index 00000000..4c65ab2d Binary files /dev/null and "b/\346\272\220\347\240\201/webview/jsinterface-example/app/src/main/res/drawable-hdpi/ic_action_help.png" differ diff --git "a/\346\272\220\347\240\201/webview/jsinterface-example/app/src/main/res/drawable-hdpi/ic_launcher.png" "b/\346\272\220\347\240\201/webview/jsinterface-example/app/src/main/res/drawable-hdpi/ic_launcher.png" new file mode 100644 index 00000000..96a442e5 Binary files /dev/null and "b/\346\272\220\347\240\201/webview/jsinterface-example/app/src/main/res/drawable-hdpi/ic_launcher.png" differ diff --git "a/\346\272\220\347\240\201/webview/jsinterface-example/app/src/main/res/drawable-mdpi/ic_action_help.png" "b/\346\272\220\347\240\201/webview/jsinterface-example/app/src/main/res/drawable-mdpi/ic_action_help.png" new file mode 100755 index 00000000..50580cf9 Binary files /dev/null and "b/\346\272\220\347\240\201/webview/jsinterface-example/app/src/main/res/drawable-mdpi/ic_action_help.png" differ diff --git "a/\346\272\220\347\240\201/webview/jsinterface-example/app/src/main/res/drawable-mdpi/ic_launcher.png" "b/\346\272\220\347\240\201/webview/jsinterface-example/app/src/main/res/drawable-mdpi/ic_launcher.png" new file mode 100644 index 00000000..359047df Binary files /dev/null and "b/\346\272\220\347\240\201/webview/jsinterface-example/app/src/main/res/drawable-mdpi/ic_launcher.png" differ diff --git "a/\346\272\220\347\240\201/webview/jsinterface-example/app/src/main/res/drawable-xhdpi/ic_action_help.png" "b/\346\272\220\347\240\201/webview/jsinterface-example/app/src/main/res/drawable-xhdpi/ic_action_help.png" new file mode 100755 index 00000000..24370486 Binary files /dev/null and "b/\346\272\220\347\240\201/webview/jsinterface-example/app/src/main/res/drawable-xhdpi/ic_action_help.png" differ diff --git "a/\346\272\220\347\240\201/webview/jsinterface-example/app/src/main/res/drawable-xhdpi/ic_launcher.png" "b/\346\272\220\347\240\201/webview/jsinterface-example/app/src/main/res/drawable-xhdpi/ic_launcher.png" new file mode 100644 index 00000000..71c6d760 Binary files /dev/null and "b/\346\272\220\347\240\201/webview/jsinterface-example/app/src/main/res/drawable-xhdpi/ic_launcher.png" differ diff --git "a/\346\272\220\347\240\201/webview/jsinterface-example/app/src/main/res/drawable-xhdpi/notification_icon.png" "b/\346\272\220\347\240\201/webview/jsinterface-example/app/src/main/res/drawable-xhdpi/notification_icon.png" new file mode 100644 index 00000000..34f350cc Binary files /dev/null and "b/\346\272\220\347\240\201/webview/jsinterface-example/app/src/main/res/drawable-xhdpi/notification_icon.png" differ diff --git "a/\346\272\220\347\240\201/webview/jsinterface-example/app/src/main/res/drawable-xxhdpi/ic_launcher.png" "b/\346\272\220\347\240\201/webview/jsinterface-example/app/src/main/res/drawable-xxhdpi/ic_launcher.png" new file mode 100644 index 00000000..4df18946 Binary files /dev/null and "b/\346\272\220\347\240\201/webview/jsinterface-example/app/src/main/res/drawable-xxhdpi/ic_launcher.png" differ diff --git "a/\346\272\220\347\240\201/webview/jsinterface-example/app/src/main/res/layout/activity_main.xml" "b/\346\272\220\347\240\201/webview/jsinterface-example/app/src/main/res/layout/activity_main.xml" new file mode 100644 index 00000000..a54c1c16 --- /dev/null +++ "b/\346\272\220\347\240\201/webview/jsinterface-example/app/src/main/res/layout/activity_main.xml" @@ -0,0 +1,7 @@ + diff --git "a/\346\272\220\347\240\201/webview/jsinterface-example/app/src/main/res/layout/fragment_main.xml" "b/\346\272\220\347\240\201/webview/jsinterface-example/app/src/main/res/layout/fragment_main.xml" new file mode 100644 index 00000000..8c795739 --- /dev/null +++ "b/\346\272\220\347\240\201/webview/jsinterface-example/app/src/main/res/layout/fragment_main.xml" @@ -0,0 +1,12 @@ + + + + + diff --git "a/\346\272\220\347\240\201/webview/jsinterface-example/app/src/main/res/menu/main.xml" "b/\346\272\220\347\240\201/webview/jsinterface-example/app/src/main/res/menu/main.xml" new file mode 100644 index 00000000..c24256b4 --- /dev/null +++ "b/\346\272\220\347\240\201/webview/jsinterface-example/app/src/main/res/menu/main.xml" @@ -0,0 +1,21 @@ + + + + diff --git "a/\346\272\220\347\240\201/webview/jsinterface-example/app/src/main/res/values-v21/styles.xml" "b/\346\272\220\347\240\201/webview/jsinterface-example/app/src/main/res/values-v21/styles.xml" new file mode 100644 index 00000000..dba3c417 --- /dev/null +++ "b/\346\272\220\347\240\201/webview/jsinterface-example/app/src/main/res/values-v21/styles.xml" @@ -0,0 +1,5 @@ + + + + diff --git "a/\346\272\220\347\240\201/webview/jsinterface-example/app/src/main/res/values-w820dp/dimens.xml" "b/\346\272\220\347\240\201/webview/jsinterface-example/app/src/main/res/values-w820dp/dimens.xml" new file mode 100644 index 00000000..63fc8164 --- /dev/null +++ "b/\346\272\220\347\240\201/webview/jsinterface-example/app/src/main/res/values-w820dp/dimens.xml" @@ -0,0 +1,6 @@ + + + 64dp + diff --git "a/\346\272\220\347\240\201/webview/jsinterface-example/app/src/main/res/values/dimens.xml" "b/\346\272\220\347\240\201/webview/jsinterface-example/app/src/main/res/values/dimens.xml" new file mode 100644 index 00000000..47c82246 --- /dev/null +++ "b/\346\272\220\347\240\201/webview/jsinterface-example/app/src/main/res/values/dimens.xml" @@ -0,0 +1,5 @@ + + + 16dp + 16dp + diff --git "a/\346\272\220\347\240\201/webview/jsinterface-example/app/src/main/res/values/strings.xml" "b/\346\272\220\347\240\201/webview/jsinterface-example/app/src/main/res/values/strings.xml" new file mode 100644 index 00000000..27495fea --- /dev/null +++ "b/\346\272\220\347\240\201/webview/jsinterface-example/app/src/main/res/values/strings.xml" @@ -0,0 +1,9 @@ + + + + JS Interface + Settings + Awesome Notification + Help + + diff --git "a/\346\272\220\347\240\201/webview/jsinterface-example/app/src/main/res/values/styles.xml" "b/\346\272\220\347\240\201/webview/jsinterface-example/app/src/main/res/values/styles.xml" new file mode 100644 index 00000000..ff6c9d2c --- /dev/null +++ "b/\346\272\220\347\240\201/webview/jsinterface-example/app/src/main/res/values/styles.xml" @@ -0,0 +1,8 @@ + + + + + + diff --git "a/\346\272\220\347\240\201/webview/jsinterface-example/build.gradle" "b/\346\272\220\347\240\201/webview/jsinterface-example/build.gradle" new file mode 100644 index 00000000..9b8abe4f --- /dev/null +++ "b/\346\272\220\347\240\201/webview/jsinterface-example/build.gradle" @@ -0,0 +1,19 @@ +// Top-level build file where you can add configuration options common to all sub-projects/modules. + +buildscript { + repositories { + jcenter() + } + dependencies { + classpath 'com.android.tools.build:gradle:0.12.2' + + // NOTE: Do not place your application dependencies here; they belong + // in the individual module build.gradle files + } +} + +allprojects { + repositories { + jcenter() + } +} diff --git "a/\346\272\220\347\240\201/webview/jsinterface-example/gradle.properties" "b/\346\272\220\347\240\201/webview/jsinterface-example/gradle.properties" new file mode 100644 index 00000000..5d08ba75 --- /dev/null +++ "b/\346\272\220\347\240\201/webview/jsinterface-example/gradle.properties" @@ -0,0 +1,18 @@ +# Project-wide Gradle settings. + +# IDE (e.g. Android Studio) users: +# Settings specified in this file will override any Gradle settings +# configured through the IDE. + +# For more details on how to configure your build environment visit +# http://www.gradle.org/docs/current/userguide/build_environment.html + +# Specifies the JVM arguments used for the daemon process. +# The setting is particularly useful for tweaking memory settings. +# Default value: -Xmx10248m -XX:MaxPermSize=256m +# org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 + +# When configured, Gradle will run in incubating parallel mode. +# This option should only be used with decoupled projects. More details, visit +# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects +# org.gradle.parallel=true \ No newline at end of file diff --git "a/\346\272\220\347\240\201/webview/jsinterface-example/gradle/wrapper/gradle-wrapper.jar" "b/\346\272\220\347\240\201/webview/jsinterface-example/gradle/wrapper/gradle-wrapper.jar" new file mode 100644 index 00000000..8c0fb64a Binary files /dev/null and "b/\346\272\220\347\240\201/webview/jsinterface-example/gradle/wrapper/gradle-wrapper.jar" differ diff --git "a/\346\272\220\347\240\201/webview/jsinterface-example/gradle/wrapper/gradle-wrapper.properties" "b/\346\272\220\347\240\201/webview/jsinterface-example/gradle/wrapper/gradle-wrapper.properties" new file mode 100644 index 00000000..1e61d1fd --- /dev/null +++ "b/\346\272\220\347\240\201/webview/jsinterface-example/gradle/wrapper/gradle-wrapper.properties" @@ -0,0 +1,6 @@ +#Wed Apr 10 15:27:10 PDT 2013 +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists +distributionUrl=http\://services.gradle.org/distributions/gradle-1.12-all.zip diff --git "a/\346\272\220\347\240\201/webview/jsinterface-example/gradlew" "b/\346\272\220\347\240\201/webview/jsinterface-example/gradlew" new file mode 100755 index 00000000..91a7e269 --- /dev/null +++ "b/\346\272\220\347\240\201/webview/jsinterface-example/gradlew" @@ -0,0 +1,164 @@ +#!/usr/bin/env bash + +############################################################################## +## +## Gradle start up script for UN*X +## +############################################################################## + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS="" + +APP_NAME="Gradle" +APP_BASE_NAME=`basename "$0"` + +# Use the maximum available, or set MAX_FD != -1 to use that value. +MAX_FD="maximum" + +warn ( ) { + echo "$*" +} + +die ( ) { + echo + echo "$*" + echo + exit 1 +} + +# OS specific support (must be 'true' or 'false'). +cygwin=false +msys=false +darwin=false +case "`uname`" in + CYGWIN* ) + cygwin=true + ;; + Darwin* ) + darwin=true + ;; + MINGW* ) + msys=true + ;; +esac + +# For Cygwin, ensure paths are in UNIX format before anything is touched. +if $cygwin ; then + [ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"` +fi + +# Attempt to set APP_HOME +# Resolve links: $0 may be a link +PRG="$0" +# Need this for relative symlinks. +while [ -h "$PRG" ] ; do + ls=`ls -ld "$PRG"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + PRG="$link" + else + PRG=`dirname "$PRG"`"/$link" + fi +done +SAVED="`pwd`" +cd "`dirname \"$PRG\"`/" >&- +APP_HOME="`pwd -P`" +cd "$SAVED" >&- + +CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar + +# Determine the Java command to use to start the JVM. +if [ -n "$JAVA_HOME" ] ; then + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD="$JAVA_HOME/jre/sh/java" + else + JAVACMD="$JAVA_HOME/bin/java" + fi + if [ ! -x "$JAVACMD" ] ; then + die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + fi +else + JAVACMD="java" + which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." +fi + +# Increase the maximum file descriptors if we can. +if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then + MAX_FD_LIMIT=`ulimit -H -n` + if [ $? -eq 0 ] ; then + if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then + MAX_FD="$MAX_FD_LIMIT" + fi + ulimit -n $MAX_FD + if [ $? -ne 0 ] ; then + warn "Could not set maximum file descriptor limit: $MAX_FD" + fi + else + warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" + fi +fi + +# For Darwin, add options to specify how the application appears in the dock +if $darwin; then + GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" +fi + +# For Cygwin, switch paths to Windows format before running java +if $cygwin ; then + APP_HOME=`cygpath --path --mixed "$APP_HOME"` + CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` + + # We build the pattern for arguments to be converted via cygpath + ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` + SEP="" + for dir in $ROOTDIRSRAW ; do + ROOTDIRS="$ROOTDIRS$SEP$dir" + SEP="|" + done + OURCYGPATTERN="(^($ROOTDIRS))" + # Add a user-defined pattern to the cygpath arguments + if [ "$GRADLE_CYGPATTERN" != "" ] ; then + OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" + fi + # Now convert the arguments - kludge to limit ourselves to /bin/sh + i=0 + for arg in "$@" ; do + CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` + CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option + + if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition + eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` + else + eval `echo args$i`="\"$arg\"" + fi + i=$((i+1)) + done + case $i in + (0) set -- ;; + (1) set -- "$args0" ;; + (2) set -- "$args0" "$args1" ;; + (3) set -- "$args0" "$args1" "$args2" ;; + (4) set -- "$args0" "$args1" "$args2" "$args3" ;; + (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; + (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; + (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; + (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; + (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; + esac +fi + +# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules +function splitJvmOpts() { + JVM_OPTS=("$@") +} +eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS +JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME" + +exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@" diff --git "a/\346\272\220\347\240\201/webview/jsinterface-example/gradlew.bat" "b/\346\272\220\347\240\201/webview/jsinterface-example/gradlew.bat" new file mode 100644 index 00000000..8a0b282a --- /dev/null +++ "b/\346\272\220\347\240\201/webview/jsinterface-example/gradlew.bat" @@ -0,0 +1,90 @@ +@if "%DEBUG%" == "" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS= + +set DIRNAME=%~dp0 +if "%DIRNAME%" == "" set DIRNAME=. +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if "%ERRORLEVEL%" == "0" goto init + +echo. +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto init + +echo. +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:init +@rem Get command-line arguments, handling Windowz variants + +if not "%OS%" == "Windows_NT" goto win9xME_args +if "%@eval[2+2]" == "4" goto 4NT_args + +:win9xME_args +@rem Slurp the command line arguments. +set CMD_LINE_ARGS= +set _SKIP=2 + +:win9xME_args_slurp +if "x%~1" == "x" goto execute + +set CMD_LINE_ARGS=%* +goto execute + +:4NT_args +@rem Get arguments from the 4NT Shell from JP Software +set CMD_LINE_ARGS=%$ + +:execute +@rem Setup the command line + +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% + +:end +@rem End local scope for the variables with windows NT shell +if "%ERRORLEVEL%"=="0" goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 +exit /b 1 + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git "a/\346\272\220\347\240\201/webview/jsinterface-example/settings.gradle" "b/\346\272\220\347\240\201/webview/jsinterface-example/settings.gradle" new file mode 100644 index 00000000..e7b4def4 --- /dev/null +++ "b/\346\272\220\347\240\201/webview/jsinterface-example/settings.gradle" @@ -0,0 +1 @@ +include ':app' diff --git "a/\346\272\220\347\240\201/webview/textautosizing-example/.gitignore" "b/\346\272\220\347\240\201/webview/textautosizing-example/.gitignore" new file mode 100644 index 00000000..afbdab33 --- /dev/null +++ "b/\346\272\220\347\240\201/webview/textautosizing-example/.gitignore" @@ -0,0 +1,6 @@ +.gradle +/local.properties +/.idea/workspace.xml +/.idea/libraries +.DS_Store +/build diff --git "a/\346\272\220\347\240\201/webview/textautosizing-example/.idea/.gitignore" "b/\346\272\220\347\240\201/webview/textautosizing-example/.idea/.gitignore" new file mode 100644 index 00000000..26d33521 --- /dev/null +++ "b/\346\272\220\347\240\201/webview/textautosizing-example/.idea/.gitignore" @@ -0,0 +1,3 @@ +# Default ignored files +/shelf/ +/workspace.xml diff --git "a/\346\272\220\347\240\201/webview/textautosizing-example/.idea/gradle.xml" "b/\346\272\220\347\240\201/webview/textautosizing-example/.idea/gradle.xml" new file mode 100644 index 00000000..3a3b9099 --- /dev/null +++ "b/\346\272\220\347\240\201/webview/textautosizing-example/.idea/gradle.xml" @@ -0,0 +1,13 @@ + + + + + + \ No newline at end of file diff --git "a/\346\272\220\347\240\201/webview/textautosizing-example/.idea/inspectionProfiles/Project_Default.xml" "b/\346\272\220\347\240\201/webview/textautosizing-example/.idea/inspectionProfiles/Project_Default.xml" new file mode 100644 index 00000000..35c3ada1 --- /dev/null +++ "b/\346\272\220\347\240\201/webview/textautosizing-example/.idea/inspectionProfiles/Project_Default.xml" @@ -0,0 +1,8 @@ + + + + \ No newline at end of file diff --git "a/\346\272\220\347\240\201/webview/textautosizing-example/.idea/misc.xml" "b/\346\272\220\347\240\201/webview/textautosizing-example/.idea/misc.xml" new file mode 100644 index 00000000..6921a242 --- /dev/null +++ "b/\346\272\220\347\240\201/webview/textautosizing-example/.idea/misc.xml" @@ -0,0 +1,13 @@ + + + + + + + + + + + + \ No newline at end of file diff --git "a/\346\272\220\347\240\201/webview/textautosizing-example/.idea/modules.xml" "b/\346\272\220\347\240\201/webview/textautosizing-example/.idea/modules.xml" new file mode 100644 index 00000000..7e4e2b50 --- /dev/null +++ "b/\346\272\220\347\240\201/webview/textautosizing-example/.idea/modules.xml" @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git "a/\346\272\220\347\240\201/webview/textautosizing-example/.idea/runConfigurations.xml" "b/\346\272\220\347\240\201/webview/textautosizing-example/.idea/runConfigurations.xml" new file mode 100644 index 00000000..797acea5 --- /dev/null +++ "b/\346\272\220\347\240\201/webview/textautosizing-example/.idea/runConfigurations.xml" @@ -0,0 +1,10 @@ + + + + + + \ No newline at end of file diff --git "a/\346\272\220\347\240\201/webview/textautosizing-example/.idea/vcs.xml" "b/\346\272\220\347\240\201/webview/textautosizing-example/.idea/vcs.xml" new file mode 100644 index 00000000..6c0b8635 --- /dev/null +++ "b/\346\272\220\347\240\201/webview/textautosizing-example/.idea/vcs.xml" @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git "a/\346\272\220\347\240\201/webview/textautosizing-example/app/.gitignore" "b/\346\272\220\347\240\201/webview/textautosizing-example/app/.gitignore" new file mode 100644 index 00000000..796b96d1 --- /dev/null +++ "b/\346\272\220\347\240\201/webview/textautosizing-example/app/.gitignore" @@ -0,0 +1 @@ +/build diff --git "a/\346\272\220\347\240\201/webview/textautosizing-example/app/build.gradle" "b/\346\272\220\347\240\201/webview/textautosizing-example/app/build.gradle" new file mode 100644 index 00000000..9f1baee3 --- /dev/null +++ "b/\346\272\220\347\240\201/webview/textautosizing-example/app/build.gradle" @@ -0,0 +1,24 @@ +apply plugin: 'com.android.application' + +android { + compileSdkVersion 21 + buildToolsVersion "21.0.0" + + defaultConfig { + applicationId "textautosizing.example.android.chrome.google.com.textautosizing_example" + minSdkVersion 19 + targetSdkVersion 21 + versionCode 1 + versionName "1.0" + } + buildTypes { + release { + runProguard false + proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' + } + } +} + +dependencies { + compile fileTree(dir: 'libs', include: ['*.jar']) +} diff --git "a/\346\272\220\347\240\201/webview/textautosizing-example/app/proguard-rules.pro" "b/\346\272\220\347\240\201/webview/textautosizing-example/app/proguard-rules.pro" new file mode 100644 index 00000000..c7e91516 --- /dev/null +++ "b/\346\272\220\347\240\201/webview/textautosizing-example/app/proguard-rules.pro" @@ -0,0 +1,17 @@ +# Add project specific ProGuard rules here. +# By default, the flags in this file are appended to flags specified +# in /Users/mattgaunt/Programming/Tools/android-sdk_1518674_mac-x86/tools/proguard/proguard-android.txt +# You can edit the include path and order by changing the proguardFiles +# directive in build.gradle. +# +# For more details, see +# http://developer.android.com/guide/developing/tools/proguard.html + +# Add any project specific keep options here: + +# If your project uses WebView with JS, uncomment the following +# and specify the fully qualified class name to the JavaScript interface +# class: +#-keepclassmembers class fqcn.of.javascript.interface.for.webview { +# public *; +#} diff --git "a/\346\272\220\347\240\201/webview/textautosizing-example/app/src/androidTest/java/textautosizing/example/android/chrome/google/com/textautosizing_example/ApplicationTest.java" "b/\346\272\220\347\240\201/webview/textautosizing-example/app/src/androidTest/java/textautosizing/example/android/chrome/google/com/textautosizing_example/ApplicationTest.java" new file mode 100644 index 00000000..c73c6542 --- /dev/null +++ "b/\346\272\220\347\240\201/webview/textautosizing-example/app/src/androidTest/java/textautosizing/example/android/chrome/google/com/textautosizing_example/ApplicationTest.java" @@ -0,0 +1,13 @@ +package textautosizing.example.android.chrome.google.com.textautosizing_example; + +import android.app.Application; +import android.test.ApplicationTestCase; + +/** + * Testing Fundamentals + */ +public class ApplicationTest extends ApplicationTestCase { + public ApplicationTest() { + super(Application.class); + } +} \ No newline at end of file diff --git "a/\346\272\220\347\240\201/webview/textautosizing-example/app/src/main/AndroidManifest.xml" "b/\346\272\220\347\240\201/webview/textautosizing-example/app/src/main/AndroidManifest.xml" new file mode 100644 index 00000000..5d9abd7e --- /dev/null +++ "b/\346\272\220\347\240\201/webview/textautosizing-example/app/src/main/AndroidManifest.xml" @@ -0,0 +1,21 @@ + + + + + + + + + + + + + + diff --git "a/\346\272\220\347\240\201/webview/textautosizing-example/app/src/main/assets/www/favicon.ico" "b/\346\272\220\347\240\201/webview/textautosizing-example/app/src/main/assets/www/favicon.ico" new file mode 100644 index 00000000..65279053 Binary files /dev/null and "b/\346\272\220\347\240\201/webview/textautosizing-example/app/src/main/assets/www/favicon.ico" differ diff --git "a/\346\272\220\347\240\201/webview/textautosizing-example/app/src/main/assets/www/index.html" "b/\346\272\220\347\240\201/webview/textautosizing-example/app/src/main/assets/www/index.html" new file mode 100644 index 00000000..68b1cec7 --- /dev/null +++ "b/\346\272\220\347\240\201/webview/textautosizing-example/app/src/main/assets/www/index.html" @@ -0,0 +1,49 @@ + + + + + + + TextAutoSizing Demo + + + + + +

Let's Try Out Text Auto Sizing

+ +

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi et dui et urna cursus tristique quis vel nisi. Mauris tincidunt tortor non malesuada rutrum. Donec bibendum elit in leo commodo malesuada. Sed tincidunt ante commodo nisl ornare elementum. Nulla facilisi. Ut a odio at enim blandit condimentum. Lorem ipsum dolor sit amet, consectetur adipiscing elit. In hac habitasse platea dictumst. Aenean lobortis velit vitae ipsum pellentesque placerat. Ut ut odio nec nisi dignissim dictum.

+ +

Morbi aliquam nibh et nisi sagittis, a fermentum felis tempus. Aliquam erat volutpat. Vestibulum elementum sagittis justo, sit amet ullamcorper quam pellentesque sed. Nullam adipiscing est id diam porta, non mattis mi imperdiet. Morbi congue dui sit amet orci gravida, ac ornare libero malesuada. Cras cursus placerat magna. Nunc vitae sem quis mauris posuere iaculis id sit amet felis. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Etiam at quam aliquet est feugiat pellentesque. Aenean faucibus eu tellus nec aliquet.

+ +

What About Flexbox

+ +
+

Proin faucibus, libero nec semper sollicitudin, dolor neque aliquet ipsum, pharetra eleifend purus nibh vitae massa. Praesent nec tincidunt metus. Phasellus ultricies elit vel augue euismod, ac adipiscing lectus facilisis. In id velit quam. Aliquam est turpis, molestie sit amet euismod quis, egestas ut lectus. Cras sollicitudin condimentum eros ut tristique. Pellentesque vitae iaculis lorem. Maecenas convallis vulputate ligula non venenatis. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam non orci ac nibh malesuada rhoncus. In tempus imperdiet arcu, vel hendrerit nisl sollicitudin id. Morbi at massa in augue luctus consequat. Donec ac massa tellus.

+ +

Donec a nisi vitae lectus vulputate fringilla nec placerat odio. Suspendisse sed elit varius, mattis nunc ut, eleifend dolor. Sed cursus enim non neque luctus semper. Aenean rhoncus leo vestibulum eros vehicula elementum nec nec mi. Vestibulum condimentum, leo nec consectetur mollis, urna nibh consectetur nunc, vitae semper nisi felis vitae est. Sed at turpis magna. Fusce vitae facilisis tellus. Vivamus non tempus ligula. Aenean condimentum fermentum augue sed lobortis. Aliquam lobortis pellentesque porttitor. Pellentesque dapibus felis quis ante varius, eu tincidunt erat facilisis. Morbi in purus mauris. Vivamus sed orci ut massa ornare pretium eget in eros. Proin at vulputate dolor.

+
+ +

And Now Floats

+ +
+

Pellentesque nec ligula felis. Proin eu euismod quam. Aenean at malesuada mi, ut ornare risus. Ut in mauris in elit porta sodales quis quis magna. Phasellus sit amet nibh ut est gravida mollis vitae non augue. Aenean fermentum nunc mi, in auctor ligula porta ut. Aenean at elit convallis, viverra purus sed, sollicitudin mauris. Sed vel velit tristique, feugiat tortor ut, sollicitudin est. Duis interdum vulputate ante vel vestibulum. Praesent sit amet lacus non sem tincidunt euismod.

+ +

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi et dui et urna cursus tristique quis vel nisi. Mauris tincidunt tortor non malesuada rutrum. Donec bibendum elit in leo commodo malesuada. Sed tincidunt ante commodo nisl ornare elementum. Nulla facilisi. Ut a odio at enim blandit condimentum. Lorem ipsum dolor sit amet, consectetur adipiscing elit. In hac habitasse platea dictumst. Aenean lobortis velit vitae ipsum pellentesque placerat. Ut ut odio nec nisi dignissim dictum.

+
+ + \ No newline at end of file diff --git "a/\346\272\220\347\240\201/webview/textautosizing-example/app/src/main/assets/www/styles/main.css" "b/\346\272\220\347\240\201/webview/textautosizing-example/app/src/main/assets/www/styles/main.css" new file mode 100644 index 00000000..67c09d42 --- /dev/null +++ "b/\346\272\220\347\240\201/webview/textautosizing-example/app/src/main/assets/www/styles/main.css" @@ -0,0 +1,53 @@ +/** +Copyright 2013 Google Inc. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + +http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +**/ +html,body{ + padding:0; + margin:0; +} + +body{ + width:1200px; + background:#fafafa; + font-family:"Helvetica Neue",Helvetica,Arial,sans-serif; + color:#333; + margin:0 auto; + padding:20px; +} + +.flexbox-section{ + display:-webkit-box; + display:-webkit-flex; + display:-ms-flexbox; + display:flex; + + -webkit-box-orient:horizontal; + -webkit-box-direction:normal; + -webkit-flex-direction:row; + -ms-flex-direction:row; + flex-direction:row; +} + +.float-section p{ + width:49%; +} + +.float-section p:first-child{ + float:left; +} + +.float-section p:last-child{ + float:right; +} \ No newline at end of file diff --git "a/\346\272\220\347\240\201/webview/textautosizing-example/app/src/main/java/textautosizing/example/android/chrome/google/com/textautosizing_example/MainActivity.java" "b/\346\272\220\347\240\201/webview/textautosizing-example/app/src/main/java/textautosizing/example/android/chrome/google/com/textautosizing_example/MainActivity.java" new file mode 100644 index 00000000..a6506a8f --- /dev/null +++ "b/\346\272\220\347\240\201/webview/textautosizing-example/app/src/main/java/textautosizing/example/android/chrome/google/com/textautosizing_example/MainActivity.java" @@ -0,0 +1,103 @@ +package textautosizing.example.android.chrome.google.com.textautosizing_example; + +import android.annotation.SuppressLint; +import android.annotation.TargetApi; +import android.app.Activity; +import android.os.Build; +import android.os.Bundle; +import android.view.Menu; +import android.view.MenuItem; +import android.view.View; +import android.webkit.WebSettings; +import android.webkit.WebView; +import android.webkit.WebViewClient; +import android.widget.Button; + + +@SuppressLint("SetJavaScriptEnabled") +public class MainActivity extends Activity implements View.OnClickListener { + + private WebView mWebView; + private Button mToggleButton; + + private boolean mUseTextAutoSize = false; + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_main); + + mWebView = (WebView) findViewById(R.id.activity_main_webview); + mToggleButton = (Button) findViewById(R.id.activity_main_toggle_btn); + + // Apply the click listener + mToggleButton.setOnClickListener(this); + + // Apply defaults including useWideViewport which us required + // to make the text auto size to work + setUpWebViewDefaults(mWebView); + + // Ensure we are using the default TextAutoSize + setUseTextAutoSize(mUseTextAutoSize); + + // Make the WebView handle all loaded URLs + mWebView.setWebViewClient(new WebViewClient()); + + mWebView.loadUrl("file:///android_asset/www/index.html"); + } + + @Override + public void onClick(View v) { + switch(v.getId()) { + case R.id.activity_main_toggle_btn: + // On toggle click, switch the auto size boolean + // and set the layout algorithm + mUseTextAutoSize = !mUseTextAutoSize; + setUseTextAutoSize(mUseTextAutoSize); + break; + } + } + + /** + * Convenience method to set some generic defaults for a + * given WebView + * + * @param webView + */ + @TargetApi(Build.VERSION_CODES.HONEYCOMB) + private void setUpWebViewDefaults(WebView webView) { + WebSettings settings = webView.getSettings(); + + // Enable Javascript + settings.setJavaScriptEnabled(true); + + // Use WideViewport and Zoom out if there is no viewport defined + settings.setUseWideViewPort(true); + settings.setLoadWithOverviewMode(true); + + // Enable pinch to zoom without the zoom buttons + settings.setBuiltInZoomControls(true); + + if(Build.VERSION.SDK_INT > Build.VERSION_CODES.HONEYCOMB) { + // Hide the zoom controls for HONEYCOMB+ + settings.setDisplayZoomControls(false); + } + + // Enable remote debugging via chrome://inspect + if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) { + WebView.setWebContentsDebuggingEnabled(true); + } + } + + // Change the layout algorithm used in the WebView + private void setUseTextAutoSize(boolean useAlgorithm) { + WebSettings settings = mWebView.getSettings(); + + WebSettings.LayoutAlgorithm layoutAlgorithm = WebSettings.LayoutAlgorithm.NORMAL; + if(useAlgorithm) { + layoutAlgorithm = WebSettings.LayoutAlgorithm.TEXT_AUTOSIZING; + } + + settings.setLayoutAlgorithm(layoutAlgorithm); + } +} diff --git "a/\346\272\220\347\240\201/webview/textautosizing-example/app/src/main/res/drawable-hdpi/ic_launcher.png" "b/\346\272\220\347\240\201/webview/textautosizing-example/app/src/main/res/drawable-hdpi/ic_launcher.png" new file mode 100644 index 00000000..96a442e5 Binary files /dev/null and "b/\346\272\220\347\240\201/webview/textautosizing-example/app/src/main/res/drawable-hdpi/ic_launcher.png" differ diff --git "a/\346\272\220\347\240\201/webview/textautosizing-example/app/src/main/res/drawable-mdpi/ic_launcher.png" "b/\346\272\220\347\240\201/webview/textautosizing-example/app/src/main/res/drawable-mdpi/ic_launcher.png" new file mode 100644 index 00000000..359047df Binary files /dev/null and "b/\346\272\220\347\240\201/webview/textautosizing-example/app/src/main/res/drawable-mdpi/ic_launcher.png" differ diff --git "a/\346\272\220\347\240\201/webview/textautosizing-example/app/src/main/res/drawable-xhdpi/ic_launcher.png" "b/\346\272\220\347\240\201/webview/textautosizing-example/app/src/main/res/drawable-xhdpi/ic_launcher.png" new file mode 100644 index 00000000..71c6d760 Binary files /dev/null and "b/\346\272\220\347\240\201/webview/textautosizing-example/app/src/main/res/drawable-xhdpi/ic_launcher.png" differ diff --git "a/\346\272\220\347\240\201/webview/textautosizing-example/app/src/main/res/drawable-xxhdpi/ic_launcher.png" "b/\346\272\220\347\240\201/webview/textautosizing-example/app/src/main/res/drawable-xxhdpi/ic_launcher.png" new file mode 100644 index 00000000..4df18946 Binary files /dev/null and "b/\346\272\220\347\240\201/webview/textautosizing-example/app/src/main/res/drawable-xxhdpi/ic_launcher.png" differ diff --git "a/\346\272\220\347\240\201/webview/textautosizing-example/app/src/main/res/layout/activity_main.xml" "b/\346\272\220\347\240\201/webview/textautosizing-example/app/src/main/res/layout/activity_main.xml" new file mode 100644 index 00000000..8d646bc0 --- /dev/null +++ "b/\346\272\220\347\240\201/webview/textautosizing-example/app/src/main/res/layout/activity_main.xml" @@ -0,0 +1,36 @@ + + + + + + + + + + + + diff --git "a/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day05/day05/06.HelloWorld.html" "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day05/day05/06.HelloWorld.html" new file mode 100644 index 00000000..0e8be40d --- /dev/null +++ "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day05/day05/06.HelloWorld.html" @@ -0,0 +1,38 @@ + + + + + + + + + + + diff --git "a/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day05/day05/07.JS\347\274\226\345\206\231\344\275\215\347\275\256.html" "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day05/day05/07.JS\347\274\226\345\206\231\344\275\215\347\275\256.html" new file mode 100644 index 00000000..548de480 --- /dev/null +++ "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day05/day05/07.JS\347\274\226\345\206\231\344\275\215\347\275\256.html" @@ -0,0 +1,47 @@ + + + + + + + + + + + + + + + + + + + + 你也点我一下 + 你也点我一下 + + + diff --git "a/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day05/day05/08.\345\237\272\346\234\254\350\257\255\346\263\225.html" "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day05/day05/08.\345\237\272\346\234\254\350\257\255\346\263\225.html" new file mode 100644 index 00000000..1ff61f86 --- /dev/null +++ "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day05/day05/08.\345\237\272\346\234\254\350\257\255\346\263\225.html" @@ -0,0 +1,38 @@ + + + + + + + + + + + diff --git "a/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day05/day05/09.\345\255\227\351\235\242\351\207\217\345\222\214\345\217\230\351\207\217.html" "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day05/day05/09.\345\255\227\351\235\242\351\207\217\345\222\214\345\217\230\351\207\217.html" new file mode 100644 index 00000000..3f58e5aa --- /dev/null +++ "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day05/day05/09.\345\255\227\351\235\242\351\207\217\345\222\214\345\217\230\351\207\217.html" @@ -0,0 +1,41 @@ + + + + + + + + + + diff --git "a/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day05/day05/10.\346\240\207\350\257\206\347\254\246.html" "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day05/day05/10.\346\240\207\350\257\206\347\254\246.html" new file mode 100644 index 00000000..6d760821 --- /dev/null +++ "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day05/day05/10.\346\240\207\350\257\206\347\254\246.html" @@ -0,0 +1,37 @@ + + + + + + + + + + diff --git "a/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day05/day05/js/script.js" "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day05/day05/js/script.js" new file mode 100644 index 00000000..35dd3329 --- /dev/null +++ "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day05/day05/js/script.js" @@ -0,0 +1 @@ +alert("我是外部JS文件中的代码"); \ No newline at end of file diff --git "a/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day05/day05/target.html" "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day05/day05/target.html" new file mode 100644 index 00000000..a9c561ad --- /dev/null +++ "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day05/day05/target.html" @@ -0,0 +1,10 @@ + + + + + + + +

恭喜您,表单提交成功了~~~

+ + diff --git "a/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day06/source/day06/.project" "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day06/source/day06/.project" new file mode 100644 index 00000000..34bb331f --- /dev/null +++ "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day06/source/day06/.project" @@ -0,0 +1,37 @@ + + + day06 + Create By HBuilder + + + + + com.aptana.ide.core.unifiedBuilder + + + + + + com.aptana.projects.webnature + + + + 1479865799841 + + 10 + + org.eclipse.ui.ide.orFilterMatcher + + + org.eclipse.ui.ide.multiFilter + 1.0-projectRelativePath-matches-false-false-bin + + + org.eclipse.ui.ide.multiFilter + 1.0-projectRelativePath-matches-false-false-setting + + + + + + diff --git "a/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day06/source/day06/01.\346\225\260\346\215\256\347\261\273\345\236\213.html" "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day06/source/day06/01.\346\225\260\346\215\256\347\261\273\345\236\213.html" new file mode 100644 index 00000000..a86177f3 --- /dev/null +++ "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day06/source/day06/01.\346\225\260\346\215\256\347\261\273\345\236\213.html" @@ -0,0 +1,68 @@ + + + + + + + + + + diff --git "a/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day06/source/day06/02.Number.html" "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day06/source/day06/02.Number.html" new file mode 100644 index 00000000..d5f411cc --- /dev/null +++ "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day06/source/day06/02.Number.html" @@ -0,0 +1,69 @@ + + + + + + + + + + diff --git "a/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day06/source/day06/03.Boolean.html" "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day06/source/day06/03.Boolean.html" new file mode 100644 index 00000000..a00feac3 --- /dev/null +++ "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day06/source/day06/03.Boolean.html" @@ -0,0 +1,29 @@ + + + + + + + + + + diff --git "a/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day06/source/day06/04.Null\345\222\214Undefined.html" "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day06/source/day06/04.Null\345\222\214Undefined.html" new file mode 100644 index 00000000..836a610b --- /dev/null +++ "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day06/source/day06/04.Null\345\222\214Undefined.html" @@ -0,0 +1,27 @@ + + + + + + + + + + diff --git "a/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day06/source/day06/05.\345\274\272\345\210\266\347\261\273\345\236\213\350\275\254\346\215\242.html" "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day06/source/day06/05.\345\274\272\345\210\266\347\261\273\345\236\213\350\275\254\346\215\242.html" new file mode 100644 index 00000000..1870bc31 --- /dev/null +++ "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day06/source/day06/05.\345\274\272\345\210\266\347\261\273\345\236\213\350\275\254\346\215\242.html" @@ -0,0 +1,72 @@ + + + + + + + + + + diff --git "a/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day06/source/day06/06.\350\275\254\346\215\242\344\270\272Number.html" "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day06/source/day06/06.\350\275\254\346\215\242\344\270\272Number.html" new file mode 100644 index 00000000..0017580d --- /dev/null +++ "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day06/source/day06/06.\350\275\254\346\215\242\344\270\272Number.html" @@ -0,0 +1,97 @@ + + + + + + + + + + diff --git "a/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day06/source/day06/07.\345\205\266\344\273\226\347\232\204\350\277\233\345\210\266\347\232\204\346\225\260\345\255\227.html" "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day06/source/day06/07.\345\205\266\344\273\226\347\232\204\350\277\233\345\210\266\347\232\204\346\225\260\345\255\227.html" new file mode 100644 index 00000000..f2e3f741 --- /dev/null +++ "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day06/source/day06/07.\345\205\266\344\273\226\347\232\204\350\277\233\345\210\266\347\232\204\346\225\260\345\255\227.html" @@ -0,0 +1,42 @@ + + + + + + + + + + diff --git "a/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day06/source/day06/08.\350\275\254\346\215\242\344\270\272Boolean.html" "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day06/source/day06/08.\350\275\254\346\215\242\344\270\272Boolean.html" new file mode 100644 index 00000000..affe7f52 --- /dev/null +++ "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day06/source/day06/08.\350\275\254\346\215\242\344\270\272Boolean.html" @@ -0,0 +1,49 @@ + + + + + + + + + + diff --git "a/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day06/source/day06/09.\350\277\220\347\256\227\347\254\246.html" "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day06/source/day06/09.\350\277\220\347\256\227\347\254\246.html" new file mode 100644 index 00000000..43c04747 --- /dev/null +++ "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day06/source/day06/09.\350\277\220\347\256\227\347\254\246.html" @@ -0,0 +1,131 @@ + + + + + + + + + + diff --git "a/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day06/source/day06/10.\344\270\200\345\205\203\350\277\220\347\256\227\347\254\246.html" "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day06/source/day06/10.\344\270\200\345\205\203\350\277\220\347\256\227\347\254\246.html" new file mode 100644 index 00000000..3a3c0e26 --- /dev/null +++ "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day06/source/day06/10.\344\270\200\345\205\203\350\277\220\347\256\227\347\254\246.html" @@ -0,0 +1,44 @@ + + + + + + + + + + diff --git "a/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day06/source/day06/11.\350\207\252\345\242\236\345\222\214\350\207\252\345\207\217.html" "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day06/source/day06/11.\350\207\252\345\242\236\345\222\214\350\207\252\345\207\217.html" new file mode 100644 index 00000000..dbe19d65 --- /dev/null +++ "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day06/source/day06/11.\350\207\252\345\242\236\345\222\214\350\207\252\345\207\217.html" @@ -0,0 +1,89 @@ + + + + + + + + + + + diff --git "a/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day07/source/day07/.project" "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day07/source/day07/.project" new file mode 100644 index 00000000..427a27ec --- /dev/null +++ "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day07/source/day07/.project" @@ -0,0 +1,37 @@ + + + day07 + Create By HBuilder + + + + + com.aptana.ide.core.unifiedBuilder + + + + + + com.aptana.projects.webnature + + + + 1480036263603 + + 10 + + org.eclipse.ui.ide.orFilterMatcher + + + org.eclipse.ui.ide.multiFilter + 1.0-projectRelativePath-matches-false-false-bin + + + org.eclipse.ui.ide.multiFilter + 1.0-projectRelativePath-matches-false-false-setting + + + + + + diff --git "a/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day07/source/day07/01.\345\244\215\344\271\240.html" "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day07/source/day07/01.\345\244\215\344\271\240.html" new file mode 100644 index 00000000..ca39cf6d --- /dev/null +++ "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day07/source/day07/01.\345\244\215\344\271\240.html" @@ -0,0 +1,22 @@ + + + + + + + + + + + diff --git "a/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day07/source/day07/02.\347\273\203\344\271\240.html" "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day07/source/day07/02.\347\273\203\344\271\240.html" new file mode 100644 index 00000000..6a7bbe87 --- /dev/null +++ "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day07/source/day07/02.\347\273\203\344\271\240.html" @@ -0,0 +1,33 @@ + + + + + + + + + + diff --git "a/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day07/source/day07/03.\351\200\273\350\276\221\350\277\220\347\256\227\347\254\246.html" "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day07/source/day07/03.\351\200\273\350\276\221\350\277\220\347\256\227\347\254\246.html" new file mode 100644 index 00000000..a8562fb5 --- /dev/null +++ "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day07/source/day07/03.\351\200\273\350\276\221\350\277\220\347\256\227\347\254\246.html" @@ -0,0 +1,88 @@ + + + + + + + + + + diff --git "a/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day07/source/day07/04.\351\200\273\350\276\221\350\277\220\347\256\227\347\254\246.html" "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day07/source/day07/04.\351\200\273\350\276\221\350\277\220\347\256\227\347\254\246.html" new file mode 100644 index 00000000..19e4ac0b --- /dev/null +++ "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day07/source/day07/04.\351\200\273\350\276\221\350\277\220\347\256\227\347\254\246.html" @@ -0,0 +1,59 @@ + + + + + + + + + + + + diff --git "a/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day07/source/day07/05.\350\265\213\345\200\274\350\277\220\347\256\227\347\254\246.html" "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day07/source/day07/05.\350\265\213\345\200\274\350\277\220\347\256\227\347\254\246.html" new file mode 100644 index 00000000..6da05180 --- /dev/null +++ "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day07/source/day07/05.\350\265\213\345\200\274\350\277\220\347\256\227\347\254\246.html" @@ -0,0 +1,40 @@ + + + + + + + + + + diff --git "a/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day07/source/day07/06.\345\205\263\347\263\273\350\277\220\347\256\227\347\254\246.html" "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day07/source/day07/06.\345\205\263\347\263\273\350\277\220\347\256\227\347\254\246.html" new file mode 100644 index 00000000..374feed6 --- /dev/null +++ "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day07/source/day07/06.\345\205\263\347\263\273\350\277\220\347\256\227\347\254\246.html" @@ -0,0 +1,71 @@ + + + + + + + + + + diff --git "a/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day07/source/day07/07.\347\274\226\347\240\201.html" "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day07/source/day07/07.\347\274\226\347\240\201.html" new file mode 100644 index 00000000..7ea0ea74 --- /dev/null +++ "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day07/source/day07/07.\347\274\226\347\240\201.html" @@ -0,0 +1,25 @@ + + + + + + + + + + +

+

+ + + diff --git "a/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day07/source/day07/08.\347\233\270\347\255\211\350\277\220\347\256\227\347\254\246.html" "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day07/source/day07/08.\347\233\270\347\255\211\350\277\220\347\256\227\347\254\246.html" new file mode 100644 index 00000000..76212350 --- /dev/null +++ "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day07/source/day07/08.\347\233\270\347\255\211\350\277\220\347\256\227\347\254\246.html" @@ -0,0 +1,80 @@ + + + + + + + + + + diff --git "a/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day07/source/day07/09.\346\235\241\344\273\266\350\277\220\347\256\227\347\254\246.html" "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day07/source/day07/09.\346\235\241\344\273\266\350\277\220\347\256\227\347\254\246.html" new file mode 100644 index 00000000..0e83acec --- /dev/null +++ "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day07/source/day07/09.\346\235\241\344\273\266\350\277\220\347\256\227\347\254\246.html" @@ -0,0 +1,44 @@ + + + + + + + + + + diff --git "a/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day07/source/day07/10.\350\277\220\347\256\227\347\254\246\347\232\204\344\274\230\345\205\210\347\272\247.html" "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day07/source/day07/10.\350\277\220\347\256\227\347\254\246\347\232\204\344\274\230\345\205\210\347\272\247.html" new file mode 100644 index 00000000..61dd4128 --- /dev/null +++ "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day07/source/day07/10.\350\277\220\347\256\227\347\254\246\347\232\204\344\274\230\345\205\210\347\272\247.html" @@ -0,0 +1,44 @@ + + + + + + + + + + diff --git "a/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day07/source/day07/11.\344\273\243\347\240\201\345\235\227.html" "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day07/source/day07/11.\344\273\243\347\240\201\345\235\227.html" new file mode 100644 index 00000000..a4b29558 --- /dev/null +++ "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day07/source/day07/11.\344\273\243\347\240\201\345\235\227.html" @@ -0,0 +1,37 @@ + + + + + + + + + + diff --git "a/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day07/source/day07/12.\346\265\201\347\250\213\346\216\247\345\210\266\350\257\255\345\217\245.html" "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day07/source/day07/12.\346\265\201\347\250\213\346\216\247\345\210\266\350\257\255\345\217\245.html" new file mode 100644 index 00000000..a4d5b51c --- /dev/null +++ "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day07/source/day07/12.\346\265\201\347\250\213\346\216\247\345\210\266\350\257\255\345\217\245.html" @@ -0,0 +1,49 @@ + + + + + + + + + + diff --git "a/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day07/source/day07/13.if\350\257\255\345\217\245.html" "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day07/source/day07/13.if\350\257\255\345\217\245.html" new file mode 100644 index 00000000..7a4cc5cc --- /dev/null +++ "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day07/source/day07/13.if\350\257\255\345\217\245.html" @@ -0,0 +1,82 @@ + + + + + + + + + + diff --git "a/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day07/source/day07/if/if-exer1.html" "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day07/source/day07/if/if-exer1.html" new file mode 100644 index 00000000..8b3a0772 --- /dev/null +++ "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day07/source/day07/if/if-exer1.html" @@ -0,0 +1,31 @@ + + + + + if练习1 + + + + + + diff --git "a/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day07/source/day07/if/if-exer2.html" "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day07/source/day07/if/if-exer2.html" new file mode 100644 index 00000000..9f68ff70 --- /dev/null +++ "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day07/source/day07/if/if-exer2.html" @@ -0,0 +1,19 @@ + + + + + if练习2 + + + + + + diff --git "a/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day07/source/day07/if/if-exer3.html" "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day07/source/day07/if/if-exer3.html" new file mode 100644 index 00000000..e96bfaaa --- /dev/null +++ "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day07/source/day07/if/if-exer3.html" @@ -0,0 +1,16 @@ + + + + + if练习3 + + + + + + diff --git "a/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day08/source/day08/.project" "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day08/source/day08/.project" new file mode 100644 index 00000000..6bbe30db --- /dev/null +++ "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day08/source/day08/.project" @@ -0,0 +1,37 @@ + + + day08 + Create By HBuilder + + + + + com.aptana.ide.core.unifiedBuilder + + + + + + com.aptana.projects.webnature + + + + 1480124050404 + + 10 + + org.eclipse.ui.ide.orFilterMatcher + + + org.eclipse.ui.ide.multiFilter + 1.0-projectRelativePath-matches-false-false-bin + + + org.eclipse.ui.ide.multiFilter + 1.0-projectRelativePath-matches-false-false-setting + + + + + + diff --git "a/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day08/source/day08/01.if.html" "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day08/source/day08/01.if.html" new file mode 100644 index 00000000..ba4d5c40 --- /dev/null +++ "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day08/source/day08/01.if.html" @@ -0,0 +1,22 @@ + + + + + + + + + + + diff --git "a/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day08/source/day08/02.\346\235\241\344\273\266\345\210\206\346\224\257\350\257\255\345\217\245.html" "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day08/source/day08/02.\346\235\241\344\273\266\345\210\206\346\224\257\350\257\255\345\217\245.html" new file mode 100644 index 00000000..724cab21 --- /dev/null +++ "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day08/source/day08/02.\346\235\241\344\273\266\345\210\206\346\224\257\350\257\255\345\217\245.html" @@ -0,0 +1,69 @@ + + + + + + + + + + diff --git "a/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day08/source/day08/03.\345\276\252\347\216\257\350\257\255\345\217\245.html" "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day08/source/day08/03.\345\276\252\347\216\257\350\257\255\345\217\245.html" new file mode 100644 index 00000000..1adcca9c --- /dev/null +++ "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day08/source/day08/03.\345\276\252\347\216\257\350\257\255\345\217\245.html" @@ -0,0 +1,89 @@ + + + + + + + + + + diff --git "a/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day08/source/day08/04.while\347\273\203\344\271\240.html" "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day08/source/day08/04.while\347\273\203\344\271\240.html" new file mode 100644 index 00000000..aea6cade --- /dev/null +++ "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day08/source/day08/04.while\347\273\203\344\271\240.html" @@ -0,0 +1,39 @@ + + + + + + + + + + diff --git "a/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day08/source/day08/05.while\347\273\203\344\271\240.html" "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day08/source/day08/05.while\347\273\203\344\271\240.html" new file mode 100644 index 00000000..2a5df74f --- /dev/null +++ "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day08/source/day08/05.while\347\273\203\344\271\240.html" @@ -0,0 +1,66 @@ + + + + + if练习1 + + + + + + diff --git "a/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day08/source/day08/06.for\345\276\252\347\216\257.html" "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day08/source/day08/06.for\345\276\252\347\216\257.html" new file mode 100644 index 00000000..4985922a --- /dev/null +++ "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day08/source/day08/06.for\345\276\252\347\216\257.html" @@ -0,0 +1,61 @@ + + + + + + + + + + diff --git "a/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day08/source/day08/07.for\345\276\252\347\216\257\347\232\204\347\273\203\344\271\240.html" "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day08/source/day08/07.for\345\276\252\347\216\257\347\232\204\347\273\203\344\271\240.html" new file mode 100644 index 00000000..61124bfa --- /dev/null +++ "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day08/source/day08/07.for\345\276\252\347\216\257\347\232\204\347\273\203\344\271\240.html" @@ -0,0 +1,33 @@ + + + + + + + + + + diff --git "a/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day08/source/day08/08.for\347\273\203\344\271\240.html" "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day08/source/day08/08.for\347\273\203\344\271\240.html" new file mode 100644 index 00000000..64e3ab21 --- /dev/null +++ "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day08/source/day08/08.for\347\273\203\344\271\240.html" @@ -0,0 +1,41 @@ + + + + + + + + + + diff --git "a/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day08/source/day08/09.for\347\273\203\344\271\240.html" "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day08/source/day08/09.for\347\273\203\344\271\240.html" new file mode 100644 index 00000000..d69ef801 --- /dev/null +++ "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day08/source/day08/09.for\347\273\203\344\271\240.html" @@ -0,0 +1,39 @@ + + + + + + + + + + diff --git "a/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day08/source/day08/10.for\347\273\203\344\271\240.html" "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day08/source/day08/10.for\347\273\203\344\271\240.html" new file mode 100644 index 00000000..73ce8bbc --- /dev/null +++ "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day08/source/day08/10.for\347\273\203\344\271\240.html" @@ -0,0 +1,51 @@ + + + + + + + + + + diff --git "a/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day08/source/day08/if/if-exer1.html" "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day08/source/day08/if/if-exer1.html" new file mode 100644 index 00000000..c17c7a33 --- /dev/null +++ "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day08/source/day08/if/if-exer1.html" @@ -0,0 +1,55 @@ + + + + + if练习1 + + + + + + diff --git "a/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day08/source/day08/if/if-exer2.html" "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day08/source/day08/if/if-exer2.html" new file mode 100644 index 00000000..d40211a0 --- /dev/null +++ "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day08/source/day08/if/if-exer2.html" @@ -0,0 +1,37 @@ + + + + + if练习2 + + + + + + diff --git "a/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day08/source/day08/if/if-exer3.html" "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day08/source/day08/if/if-exer3.html" new file mode 100644 index 00000000..b64cf9a2 --- /dev/null +++ "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day08/source/day08/if/if-exer3.html" @@ -0,0 +1,60 @@ + + + + + if练习3 + + + + + + diff --git "a/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day08/source/day08/switch/switch-exer1.html" "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day08/source/day08/switch/switch-exer1.html" new file mode 100644 index 00000000..f25c4e41 --- /dev/null +++ "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day08/source/day08/switch/switch-exer1.html" @@ -0,0 +1,46 @@ + + + + + switch练习1 + + + + diff --git "a/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day08/source/day08/switch/switch-exer2.html" "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day08/source/day08/switch/switch-exer2.html" new file mode 100644 index 00000000..1b073233 --- /dev/null +++ "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day08/source/day08/switch/switch-exer2.html" @@ -0,0 +1,13 @@ + + + + + switch练习2 + + + + diff --git "a/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day08/\347\273\203\344\271\240/for.txt" "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day08/\347\273\203\344\271\240/for.txt" new file mode 100644 index 00000000..369a249d --- /dev/null +++ "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day08/\347\273\203\344\271\240/for.txt" @@ -0,0 +1,13 @@ +1.ӡ1-100֮֮ + + +2.ӡ1-100֮7ıĸܺ + + +3.ˮɻ +ˮɻָһ3λÿλϵֵ3 ֮͵ +磺1^3 + 5^3 + 3^3 = 153,ӡеˮɻ + +4. +ҳнһû֣жϸǷ +ֻܱ11ҲǺǴ1Ȼ diff --git "a/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day08/\347\273\203\344\271\240/if/if-exer1.html" "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day08/\347\273\203\344\271\240/if/if-exer1.html" new file mode 100644 index 00000000..92862bea --- /dev/null +++ "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day08/\347\273\203\344\271\240/if/if-exer1.html" @@ -0,0 +1,19 @@ + + + + + if练习1 + + + + + + diff --git "a/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day08/\347\273\203\344\271\240/if/if-exer2.html" "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day08/\347\273\203\344\271\240/if/if-exer2.html" new file mode 100644 index 00000000..9f68ff70 --- /dev/null +++ "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day08/\347\273\203\344\271\240/if/if-exer2.html" @@ -0,0 +1,19 @@ + + + + + if练习2 + + + + + + diff --git "a/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day08/\347\273\203\344\271\240/if/if-exer3.html" "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day08/\347\273\203\344\271\240/if/if-exer3.html" new file mode 100644 index 00000000..e96bfaaa --- /dev/null +++ "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day08/\347\273\203\344\271\240/if/if-exer3.html" @@ -0,0 +1,16 @@ + + + + + if练习3 + + + + + + diff --git "a/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day08/\347\273\203\344\271\240/switch/switch-exer1.html" "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day08/\347\273\203\344\271\240/switch/switch-exer1.html" new file mode 100644 index 00000000..d19457a8 --- /dev/null +++ "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day08/\347\273\203\344\271\240/switch/switch-exer1.html" @@ -0,0 +1,13 @@ + + + + + switch练习1 + + + + diff --git "a/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day08/\347\273\203\344\271\240/switch/switch-exer2.html" "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day08/\347\273\203\344\271\240/switch/switch-exer2.html" new file mode 100644 index 00000000..1b073233 --- /dev/null +++ "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day08/\347\273\203\344\271\240/switch/switch-exer2.html" @@ -0,0 +1,13 @@ + + + + + switch练习2 + + + + diff --git "a/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day08/\347\273\203\344\271\240/while.txt" "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day08/\347\273\203\344\271\240/while.txt" new file mode 100644 index 00000000..beaf1d1d --- /dev/null +++ "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day08/\347\273\203\344\271\240/while.txt" @@ -0,0 +1 @@ +ͶʵΪ5%10005000飬ҪѶ diff --git "a/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day09/source/day09/.project" "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day09/source/day09/.project" new file mode 100644 index 00000000..80c3c19c --- /dev/null +++ "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day09/source/day09/.project" @@ -0,0 +1,37 @@ + + + day09 + Create By HBuilder + + + + + com.aptana.ide.core.unifiedBuilder + + + + + + com.aptana.projects.webnature + + + + 1480295845660 + + 10 + + org.eclipse.ui.ide.orFilterMatcher + + + org.eclipse.ui.ide.multiFilter + 1.0-projectRelativePath-matches-false-false-bin + + + org.eclipse.ui.ide.multiFilter + 1.0-projectRelativePath-matches-false-false-setting + + + + + + diff --git "a/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day09/source/day09/01.\345\265\214\345\245\227\347\232\204for\345\276\252\347\216\257.html" "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day09/source/day09/01.\345\265\214\345\245\227\347\232\204for\345\276\252\347\216\257.html" new file mode 100644 index 00000000..8f6ab43c --- /dev/null +++ "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day09/source/day09/01.\345\265\214\345\245\227\347\232\204for\345\276\252\347\216\257.html" @@ -0,0 +1,66 @@ + + + + + + + + + + + diff --git "a/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day09/source/day09/02.99\344\271\230\346\263\225\350\241\250.html" "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day09/source/day09/02.99\344\271\230\346\263\225\350\241\250.html" new file mode 100644 index 00000000..50733b24 --- /dev/null +++ "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day09/source/day09/02.99\344\271\230\346\263\225\350\241\250.html" @@ -0,0 +1,48 @@ + + + + + + + + + + + diff --git "a/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day09/source/day09/03.\350\264\250\346\225\260\347\273\203\344\271\240.html" "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day09/source/day09/03.\350\264\250\346\225\260\347\273\203\344\271\240.html" new file mode 100644 index 00000000..93ab837c --- /dev/null +++ "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day09/source/day09/03.\350\264\250\346\225\260\347\273\203\344\271\240.html" @@ -0,0 +1,43 @@ + + + + + + + + + + diff --git "a/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day09/source/day09/04.break\345\222\214continue.html" "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day09/source/day09/04.break\345\222\214continue.html" new file mode 100644 index 00000000..46fbf309 --- /dev/null +++ "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day09/source/day09/04.break\345\222\214continue.html" @@ -0,0 +1,82 @@ + + + + + + + + + + diff --git "a/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day09/source/day09/05.\350\264\250\346\225\260\347\273\203\344\271\240\350\241\245\345\205\205.html" "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day09/source/day09/05.\350\264\250\346\225\260\347\273\203\344\271\240\350\241\245\345\205\205.html" new file mode 100644 index 00000000..39ecbb27 --- /dev/null +++ "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day09/source/day09/05.\350\264\250\346\225\260\347\273\203\344\271\240\350\241\245\345\205\205.html" @@ -0,0 +1,60 @@ + + + + + + + + + + diff --git "a/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day09/source/day09/06.\345\257\271\350\261\241.html" "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day09/source/day09/06.\345\257\271\350\261\241.html" new file mode 100644 index 00000000..2397b7bd --- /dev/null +++ "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day09/source/day09/06.\345\257\271\350\261\241.html" @@ -0,0 +1,99 @@ + + + + + + + + + + diff --git "a/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day09/source/day09/07.\345\261\236\346\200\247\345\220\215\345\222\214\345\261\236\346\200\247\345\200\274.html" "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day09/source/day09/07.\345\261\236\346\200\247\345\220\215\345\222\214\345\261\236\346\200\247\345\200\274.html" new file mode 100644 index 00000000..b08b4992 --- /dev/null +++ "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day09/source/day09/07.\345\261\236\346\200\247\345\220\215\345\222\214\345\261\236\346\200\247\345\200\274.html" @@ -0,0 +1,74 @@ + + + + + + + + + + diff --git "a/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day09/source/day09/08.\345\237\272\346\234\254\345\222\214\345\274\225\347\224\250\346\225\260\346\215\256\347\261\273\345\236\213.html" "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day09/source/day09/08.\345\237\272\346\234\254\345\222\214\345\274\225\347\224\250\346\225\260\346\215\256\347\261\273\345\236\213.html" new file mode 100644 index 00000000..749cfa08 --- /dev/null +++ "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day09/source/day09/08.\345\237\272\346\234\254\345\222\214\345\274\225\347\224\250\346\225\260\346\215\256\347\261\273\345\236\213.html" @@ -0,0 +1,74 @@ + + + + + + + + + + diff --git "a/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day09/source/day09/09.\345\257\271\350\261\241\345\255\227\351\235\242\351\207\217.html" "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day09/source/day09/09.\345\257\271\350\261\241\345\255\227\351\235\242\351\207\217.html" new file mode 100644 index 00000000..07c2a758 --- /dev/null +++ "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day09/source/day09/09.\345\257\271\350\261\241\345\255\227\351\235\242\351\207\217.html" @@ -0,0 +1,47 @@ + + + + + + + + + + diff --git "a/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day09/source/day09/10.\345\207\275\346\225\260.html" "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day09/source/day09/10.\345\207\275\346\225\260.html" new file mode 100644 index 00000000..15f60cef --- /dev/null +++ "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day09/source/day09/10.\345\207\275\346\225\260.html" @@ -0,0 +1,63 @@ + + + + + + + + + + diff --git "a/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day09/source/day09/11.\345\207\275\346\225\260\347\232\204\345\217\202\346\225\260.html" "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day09/source/day09/11.\345\207\275\346\225\260\347\232\204\345\217\202\346\225\260.html" new file mode 100644 index 00000000..94b29dd5 --- /dev/null +++ "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day09/source/day09/11.\345\207\275\346\225\260\347\232\204\345\217\202\346\225\260.html" @@ -0,0 +1,48 @@ + + + + + + + + + + diff --git "a/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day10/source/day10/.project" "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day10/source/day10/.project" new file mode 100644 index 00000000..c02a7c29 --- /dev/null +++ "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day10/source/day10/.project" @@ -0,0 +1,37 @@ + + + day10 + Create By HBuilder + + + + + com.aptana.ide.core.unifiedBuilder + + + + + + com.aptana.projects.webnature + + + + 1480382536985 + + 10 + + org.eclipse.ui.ide.orFilterMatcher + + + org.eclipse.ui.ide.multiFilter + 1.0-projectRelativePath-matches-false-false-bin + + + org.eclipse.ui.ide.multiFilter + 1.0-projectRelativePath-matches-false-false-setting + + + + + + diff --git "a/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day10/source/day10/01.\350\277\224\345\233\236\345\200\274.html" "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day10/source/day10/01.\350\277\224\345\233\236\345\200\274.html" new file mode 100644 index 00000000..dc3a5698 --- /dev/null +++ "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day10/source/day10/01.\350\277\224\345\233\236\345\200\274.html" @@ -0,0 +1,52 @@ + + + + + + + + + + + diff --git "a/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day10/source/day10/02.\347\273\203\344\271\240.html" "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day10/source/day10/02.\347\273\203\344\271\240.html" new file mode 100644 index 00000000..a027d0b7 --- /dev/null +++ "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day10/source/day10/02.\347\273\203\344\271\240.html" @@ -0,0 +1,90 @@ + + + + + + + + + + diff --git "a/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day10/source/day10/03.return.html" "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day10/source/day10/03.return.html" new file mode 100644 index 00000000..5b589cc9 --- /dev/null +++ "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day10/source/day10/03.return.html" @@ -0,0 +1,67 @@ + + + + + + + + + + diff --git "a/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day10/source/day10/04.\347\253\213\345\215\263\346\211\247\350\241\214\345\207\275\346\225\260.html" "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day10/source/day10/04.\347\253\213\345\215\263\346\211\247\350\241\214\345\207\275\346\225\260.html" new file mode 100644 index 00000000..187e7fe4 --- /dev/null +++ "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day10/source/day10/04.\347\253\213\345\215\263\346\211\247\350\241\214\345\207\275\346\225\260.html" @@ -0,0 +1,28 @@ + + + + + + + + + + diff --git "a/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day10/source/day10/05.\345\257\271\350\261\241.html" "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day10/source/day10/05.\345\257\271\350\261\241.html" new file mode 100644 index 00000000..257d2a14 --- /dev/null +++ "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day10/source/day10/05.\345\257\271\350\261\241.html" @@ -0,0 +1,60 @@ + + + + + + + + + + diff --git "a/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day10/source/day10/06.\346\236\232\344\270\276\345\257\271\350\261\241\344\270\255\347\232\204\345\261\236\346\200\247.html" "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day10/source/day10/06.\346\236\232\344\270\276\345\257\271\350\261\241\344\270\255\347\232\204\345\261\236\346\200\247.html" new file mode 100644 index 00000000..51bc815e --- /dev/null +++ "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day10/source/day10/06.\346\236\232\344\270\276\345\257\271\350\261\241\344\270\255\347\232\204\345\261\236\346\200\247.html" @@ -0,0 +1,39 @@ + + + + + + + + + + diff --git "a/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day10/source/day10/07.\344\275\234\347\224\250\345\237\237\357\274\210Scope\357\274\211.html" "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day10/source/day10/07.\344\275\234\347\224\250\345\237\237\357\274\210Scope\357\274\211.html" new file mode 100644 index 00000000..afc8335b --- /dev/null +++ "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day10/source/day10/07.\344\275\234\347\224\250\345\237\237\357\274\210Scope\357\274\211.html" @@ -0,0 +1,48 @@ + + + + + + + + + + diff --git "a/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day10/source/day10/08.\345\217\230\351\207\217\347\232\204\345\243\260\346\230\216\346\217\220\345\211\215.html" "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day10/source/day10/08.\345\217\230\351\207\217\347\232\204\345\243\260\346\230\216\346\217\220\345\211\215.html" new file mode 100644 index 00000000..2cc717ef --- /dev/null +++ "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day10/source/day10/08.\345\217\230\351\207\217\347\232\204\345\243\260\346\230\216\346\217\220\345\211\215.html" @@ -0,0 +1,44 @@ + + + + + + + + + + diff --git "a/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day10/source/day10/09.\345\207\275\346\225\260\344\275\234\347\224\250\345\237\237.html" "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day10/source/day10/09.\345\207\275\346\225\260\344\275\234\347\224\250\345\237\237.html" new file mode 100644 index 00000000..9db5b97f --- /dev/null +++ "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day10/source/day10/09.\345\207\275\346\225\260\344\275\234\347\224\250\345\237\237.html" @@ -0,0 +1,99 @@ + + + + + + + + + + diff --git "a/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day10/source/day10/10.debug.html" "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day10/source/day10/10.debug.html" new file mode 100644 index 00000000..f0bd5c79 --- /dev/null +++ "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day10/source/day10/10.debug.html" @@ -0,0 +1,26 @@ + + + + + + + + + + diff --git "a/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day10/source/day10/11.this.html" "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day10/source/day10/11.this.html" new file mode 100644 index 00000000..c3c0d39e --- /dev/null +++ "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day10/source/day10/11.this.html" @@ -0,0 +1,49 @@ + + + + + + + + + + diff --git "a/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day10/source/day10/12.this.html" "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day10/source/day10/12.this.html" new file mode 100644 index 00000000..6f8fc53d --- /dev/null +++ "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day10/source/day10/12.this.html" @@ -0,0 +1,38 @@ + + + + + + + + + + diff --git "a/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day10/source/day10/13.\345\257\271\350\261\241.html" "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day10/source/day10/13.\345\257\271\350\261\241.html" new file mode 100644 index 00000000..fca00da6 --- /dev/null +++ "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day10/source/day10/13.\345\257\271\350\261\241.html" @@ -0,0 +1,71 @@ + + + + + + + + + + diff --git "a/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day10/source/day10/14.\346\236\204\351\200\240\345\207\275\346\225\260.html" "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day10/source/day10/14.\346\236\204\351\200\240\345\207\275\346\225\260.html" new file mode 100644 index 00000000..8feed985 --- /dev/null +++ "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day10/source/day10/14.\346\236\204\351\200\240\345\207\275\346\225\260.html" @@ -0,0 +1,73 @@ + + + + + + + + + + diff --git "a/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day11/source/day11/.project" "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day11/source/day11/.project" new file mode 100644 index 00000000..5210359f --- /dev/null +++ "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day11/source/day11/.project" @@ -0,0 +1,37 @@ + + + day11 + Create By HBuilder + + + + + com.aptana.ide.core.unifiedBuilder + + + + + + com.aptana.projects.webnature + + + + 1480468397039 + + 10 + + org.eclipse.ui.ide.orFilterMatcher + + + org.eclipse.ui.ide.multiFilter + 1.0-projectRelativePath-matches-false-false-bin + + + org.eclipse.ui.ide.multiFilter + 1.0-projectRelativePath-matches-false-false-setting + + + + + + diff --git "a/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day11/source/day11/01.\345\244\215\344\271\240.html" "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day11/source/day11/01.\345\244\215\344\271\240.html" new file mode 100644 index 00000000..844a0312 --- /dev/null +++ "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day11/source/day11/01.\345\244\215\344\271\240.html" @@ -0,0 +1,39 @@ + + + + + + + + + + + diff --git "a/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day11/source/day11/02.\346\236\204\351\200\240\345\207\275\346\225\260.html" "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day11/source/day11/02.\346\236\204\351\200\240\345\207\275\346\225\260.html" new file mode 100644 index 00000000..5e75f8f9 --- /dev/null +++ "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day11/source/day11/02.\346\236\204\351\200\240\345\207\275\346\225\260.html" @@ -0,0 +1,51 @@ + + + + + + + + + + diff --git "a/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day11/source/day11/03.\345\216\237\345\236\213.html" "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day11/source/day11/03.\345\216\237\345\236\213.html" new file mode 100644 index 00000000..5ab0be47 --- /dev/null +++ "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day11/source/day11/03.\345\216\237\345\236\213.html" @@ -0,0 +1,57 @@ + + + + + + + + + + diff --git "a/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day11/source/day11/04.\345\216\237\345\236\213.html" "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day11/source/day11/04.\345\216\237\345\236\213.html" new file mode 100644 index 00000000..6935f71e --- /dev/null +++ "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day11/source/day11/04.\345\216\237\345\236\213.html" @@ -0,0 +1,55 @@ + + + + + + + + + + diff --git "a/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day11/source/day11/05.toString.html" "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day11/source/day11/05.toString.html" new file mode 100644 index 00000000..83e19134 --- /dev/null +++ "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day11/source/day11/05.toString.html" @@ -0,0 +1,42 @@ + + + + + + + + + + diff --git "a/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day11/source/day11/06.\345\236\203\345\234\276\345\233\236\346\224\266.html" "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day11/source/day11/06.\345\236\203\345\234\276\345\233\236\346\224\266.html" new file mode 100644 index 00000000..e9c002ed --- /dev/null +++ "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day11/source/day11/06.\345\236\203\345\234\276\345\233\236\346\224\266.html" @@ -0,0 +1,33 @@ + + + + + + + + + + diff --git "a/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day11/source/day11/07.\346\225\260\347\273\204.html" "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day11/source/day11/07.\346\225\260\347\273\204.html" new file mode 100644 index 00000000..9685f15a --- /dev/null +++ "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day11/source/day11/07.\346\225\260\347\273\204.html" @@ -0,0 +1,87 @@ + + + + + + + + + + diff --git "a/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day11/source/day11/08.\346\225\260\347\273\204.html" "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day11/source/day11/08.\346\225\260\347\273\204.html" new file mode 100644 index 00000000..9e9db415 --- /dev/null +++ "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day11/source/day11/08.\346\225\260\347\273\204.html" @@ -0,0 +1,56 @@ + + + + + + + + + + diff --git "a/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day11/source/day11/09.\346\225\260\347\273\204\347\232\204\346\226\271\346\263\225.html" "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day11/source/day11/09.\346\225\260\347\273\204\347\232\204\346\226\271\346\263\225.html" new file mode 100644 index 00000000..dcd8fab0 --- /dev/null +++ "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day11/source/day11/09.\346\225\260\347\273\204\347\232\204\346\226\271\346\263\225.html" @@ -0,0 +1,59 @@ + + + + + + + + + + diff --git "a/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day11/source/day11/10.\346\225\260\347\273\204\347\232\204\351\201\215\345\216\206.html" "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day11/source/day11/10.\346\225\260\347\273\204\347\232\204\351\201\215\345\216\206.html" new file mode 100644 index 00000000..8c6dc06b --- /dev/null +++ "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day11/source/day11/10.\346\225\260\347\273\204\347\232\204\351\201\215\345\216\206.html" @@ -0,0 +1,25 @@ + + + + + + + + + + diff --git "a/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day11/source/day11/11.\347\273\203\344\271\240.html" "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day11/source/day11/11.\347\273\203\344\271\240.html" new file mode 100644 index 00000000..92cdfee1 --- /dev/null +++ "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day11/source/day11/11.\347\273\203\344\271\240.html" @@ -0,0 +1,64 @@ + + + + + + + + + + diff --git "a/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day11/source/day11/12.forEach.html" "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day11/source/day11/12.forEach.html" new file mode 100644 index 00000000..e2e761a0 --- /dev/null +++ "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day11/source/day11/12.forEach.html" @@ -0,0 +1,40 @@ + + + + + + + + + + diff --git "a/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day11/source/day11/13.\346\225\260\347\273\204\347\232\204\346\226\271\346\263\225.html" "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day11/source/day11/13.\346\225\260\347\273\204\347\232\204\346\226\271\346\263\225.html" new file mode 100644 index 00000000..daa69fbd --- /dev/null +++ "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day11/source/day11/13.\346\225\260\347\273\204\347\232\204\346\226\271\346\263\225.html" @@ -0,0 +1,55 @@ + + + + + + + + + + diff --git "a/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day11/source/day11/14.\347\273\203\344\271\240.html" "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day11/source/day11/14.\347\273\203\344\271\240.html" new file mode 100644 index 00000000..a3bb7f8f --- /dev/null +++ "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day11/source/day11/14.\347\273\203\344\271\240.html" @@ -0,0 +1,37 @@ + + + + + + + + + + diff --git "a/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day12/source/day12/.project" "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day12/source/day12/.project" new file mode 100644 index 00000000..488caf76 --- /dev/null +++ "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day12/source/day12/.project" @@ -0,0 +1,37 @@ + + + day12 + Create By HBuilder + + + + + com.aptana.ide.core.unifiedBuilder + + + + + + com.aptana.projects.webnature + + + + 1480642554141 + + 10 + + org.eclipse.ui.ide.orFilterMatcher + + + org.eclipse.ui.ide.multiFilter + 1.0-projectRelativePath-matches-false-false-bin + + + org.eclipse.ui.ide.multiFilter + 1.0-projectRelativePath-matches-false-false-setting + + + + + + diff --git "a/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day12/source/day12/01.\346\225\260\347\273\204\347\232\204\345\211\251\344\275\231\346\226\271\346\263\225.html" "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day12/source/day12/01.\346\225\260\347\273\204\347\232\204\345\211\251\344\275\231\346\226\271\346\263\225.html" new file mode 100644 index 00000000..cdfc76c4 --- /dev/null +++ "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day12/source/day12/01.\346\225\260\347\273\204\347\232\204\345\211\251\344\275\231\346\226\271\346\263\225.html" @@ -0,0 +1,93 @@ + + + + + + + + + + + diff --git "a/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day12/source/day12/02.\345\207\275\346\225\260\347\232\204\346\226\271\346\263\225.html" "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day12/source/day12/02.\345\207\275\346\225\260\347\232\204\346\226\271\346\263\225.html" new file mode 100644 index 00000000..280f70bc --- /dev/null +++ "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day12/source/day12/02.\345\207\275\346\225\260\347\232\204\346\226\271\346\263\225.html" @@ -0,0 +1,62 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git "a/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day12/source/day12/03.arguments.html" "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day12/source/day12/03.arguments.html" new file mode 100644 index 00000000..0e0b9225 --- /dev/null +++ "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day12/source/day12/03.arguments.html" @@ -0,0 +1,37 @@ + + + + + + + + + + diff --git "a/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day12/source/day12/04.Date.html" "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day12/source/day12/04.Date.html" new file mode 100644 index 00000000..7751a965 --- /dev/null +++ "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day12/source/day12/04.Date.html" @@ -0,0 +1,94 @@ + + + + + + + + + + diff --git "a/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day12/source/day12/05.Math.html" "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day12/source/day12/05.Math.html" new file mode 100644 index 00000000..29c57ba0 --- /dev/null +++ "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day12/source/day12/05.Math.html" @@ -0,0 +1,82 @@ + + + + + + + + + + diff --git "a/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day12/source/day12/06.\345\214\205\350\243\205\347\261\273.html" "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day12/source/day12/06.\345\214\205\350\243\205\347\261\273.html" new file mode 100644 index 00000000..bbbd0745 --- /dev/null +++ "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day12/source/day12/06.\345\214\205\350\243\205\347\261\273.html" @@ -0,0 +1,64 @@ + + + + + + + + + + diff --git "a/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day12/source/day12/07.\345\255\227\347\254\246\344\270\262\347\232\204\347\233\270\345\205\263\346\226\271\346\263\225.html" "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day12/source/day12/07.\345\255\227\347\254\246\344\270\262\347\232\204\347\233\270\345\205\263\346\226\271\346\263\225.html" new file mode 100644 index 00000000..2e0db138 --- /dev/null +++ "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day12/source/day12/07.\345\255\227\347\254\246\344\270\262\347\232\204\347\233\270\345\205\263\346\226\271\346\263\225.html" @@ -0,0 +1,154 @@ + + + + + + + + + + diff --git "a/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day12/source/day12/08.\346\255\243\345\210\231\350\241\250\350\276\276\345\274\217.html" "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day12/source/day12/08.\346\255\243\345\210\231\350\241\250\350\276\276\345\274\217.html" new file mode 100644 index 00000000..9efd08ca --- /dev/null +++ "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day12/source/day12/08.\346\255\243\345\210\231\350\241\250\350\276\276\345\274\217.html" @@ -0,0 +1,53 @@ + + + + + + + + + + diff --git "a/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day12/source/day12/09.\346\255\243\345\210\231\350\241\250\350\276\276\345\274\217.html" "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day12/source/day12/09.\346\255\243\345\210\231\350\241\250\350\276\276\345\274\217.html" new file mode 100644 index 00000000..09c66b21 --- /dev/null +++ "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day12/source/day12/09.\346\255\243\345\210\231\350\241\250\350\276\276\345\274\217.html" @@ -0,0 +1,59 @@ + + + + + + + + + + diff --git "a/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day12/source/day12/10.\345\255\227\347\254\246\344\270\262\345\222\214\346\255\243\345\210\231\347\233\270\345\205\263\347\232\204\346\226\271\346\263\225.html" "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day12/source/day12/10.\345\255\227\347\254\246\344\270\262\345\222\214\346\255\243\345\210\231\347\233\270\345\205\263\347\232\204\346\226\271\346\263\225.html" new file mode 100644 index 00000000..8b402fa0 --- /dev/null +++ "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day12/source/day12/10.\345\255\227\347\254\246\344\270\262\345\222\214\346\255\243\345\210\231\347\233\270\345\205\263\347\232\204\346\226\271\346\263\225.html" @@ -0,0 +1,73 @@ + + + + + + + + + + diff --git "a/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day13/source/day13/.project" "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day13/source/day13/.project" new file mode 100644 index 00000000..87335f9a --- /dev/null +++ "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day13/source/day13/.project" @@ -0,0 +1,37 @@ + + + day13 + Create By HBuilder + + + + + com.aptana.ide.core.unifiedBuilder + + + + + + com.aptana.projects.webnature + + + + 1480726560811 + + 10 + + org.eclipse.ui.ide.orFilterMatcher + + + org.eclipse.ui.ide.multiFilter + 1.0-projectRelativePath-matches-false-false-bin + + + org.eclipse.ui.ide.multiFilter + 1.0-projectRelativePath-matches-false-false-setting + + + + + + diff --git "a/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day13/source/day13/01.\345\244\215\344\271\240.html" "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day13/source/day13/01.\345\244\215\344\271\240.html" new file mode 100644 index 00000000..9e59a300 --- /dev/null +++ "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day13/source/day13/01.\345\244\215\344\271\240.html" @@ -0,0 +1,25 @@ + + + + + + + + + + + diff --git "a/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day13/source/day13/02.\346\255\243\345\210\231\350\241\250\350\276\276\345\274\217.html" "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day13/source/day13/02.\346\255\243\345\210\231\350\241\250\350\276\276\345\274\217.html" new file mode 100644 index 00000000..c75715cb --- /dev/null +++ "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day13/source/day13/02.\346\255\243\345\210\231\350\241\250\350\276\276\345\274\217.html" @@ -0,0 +1,84 @@ + + + + + + + + + + diff --git "a/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day13/source/day13/03.\346\255\243\345\210\231\350\241\250\350\276\276\345\274\217.html" "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day13/source/day13/03.\346\255\243\345\210\231\350\241\250\350\276\276\345\274\217.html" new file mode 100644 index 00000000..f42c013a --- /dev/null +++ "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day13/source/day13/03.\346\255\243\345\210\231\350\241\250\350\276\276\345\274\217.html" @@ -0,0 +1,86 @@ + + + + + + + + + + diff --git "a/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day13/source/day13/04.\351\202\256\344\273\266\347\232\204\346\255\243\345\210\231.html" "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day13/source/day13/04.\351\202\256\344\273\266\347\232\204\346\255\243\345\210\231.html" new file mode 100644 index 00000000..4ab9c44d --- /dev/null +++ "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day13/source/day13/04.\351\202\256\344\273\266\347\232\204\346\255\243\345\210\231.html" @@ -0,0 +1,28 @@ + + + + + + + + + + diff --git "a/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day13/source/day13/05.DOM.html" "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day13/source/day13/05.DOM.html" new file mode 100644 index 00000000..58807b06 --- /dev/null +++ "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day13/source/day13/05.DOM.html" @@ -0,0 +1,26 @@ + + + + + + + + + + + diff --git "a/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day13/source/day13/06.\344\272\213\344\273\266.html" "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day13/source/day13/06.\344\272\213\344\273\266.html" new file mode 100644 index 00000000..3b0ef38a --- /dev/null +++ "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day13/source/day13/06.\344\272\213\344\273\266.html" @@ -0,0 +1,42 @@ + + + + + + + + + + + + + diff --git "a/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day13/source/day13/07.\346\226\207\346\241\243\347\232\204\345\212\240\350\275\275.html" "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day13/source/day13/07.\346\226\207\346\241\243\347\232\204\345\212\240\350\275\275.html" new file mode 100644 index 00000000..a3f8591c --- /dev/null +++ "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day13/source/day13/07.\346\226\207\346\241\243\347\232\204\345\212\240\350\275\275.html" @@ -0,0 +1,55 @@ + + + + + + + + + + + + + + + diff --git "a/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day13/source/day13/08.dom\346\237\245\350\257\242.html" "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day13/source/day13/08.dom\346\237\245\350\257\242.html" new file mode 100644 index 00000000..ea9f06c0 --- /dev/null +++ "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day13/source/day13/08.dom\346\237\245\350\257\242.html" @@ -0,0 +1,146 @@ + + + + + Untitled Document + + + + +
+
+

+ 你喜欢哪个城市? +

+ +
    +
  • 北京
  • +
  • 上海
  • +
  • 东京
  • +
  • 首尔
  • +
+ +
+
+ +

+ 你喜欢哪款单机游戏? +

+ +
    +
  • 红警
  • +
  • 实况
  • +
  • 极品飞车
  • +
  • 魔兽
  • +
+ +
+
+ +

+ 你手机的操作系统是? +

+ +
  • IOS
  • Android
  • Windows Phone
+
+ +
+ gender: + + Male + + Female +
+
+ name: + +
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ + diff --git "a/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day13/source/day13/09.\347\273\203\344\271\240.html" "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day13/source/day13/09.\347\273\203\344\271\240.html" new file mode 100644 index 00000000..12d68de4 --- /dev/null +++ "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day13/source/day13/09.\347\273\203\344\271\240.html" @@ -0,0 +1,111 @@ + + + + + + + + + + +
+ +

+ + 冰棍 + + + + +
+ + diff --git "a/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day13/source/day13/img/1.jpg" "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day13/source/day13/img/1.jpg" new file mode 100644 index 00000000..03afb30c Binary files /dev/null and "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day13/source/day13/img/1.jpg" differ diff --git "a/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day13/source/day13/img/2.jpg" "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day13/source/day13/img/2.jpg" new file mode 100644 index 00000000..b88750dc Binary files /dev/null and "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day13/source/day13/img/2.jpg" differ diff --git "a/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day13/source/day13/img/3.jpg" "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day13/source/day13/img/3.jpg" new file mode 100644 index 00000000..eb0d14e8 Binary files /dev/null and "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day13/source/day13/img/3.jpg" differ diff --git "a/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day13/source/day13/img/4.jpg" "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day13/source/day13/img/4.jpg" new file mode 100644 index 00000000..018c9a16 Binary files /dev/null and "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day13/source/day13/img/4.jpg" differ diff --git "a/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day13/source/day13/img/5.jpg" "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day13/source/day13/img/5.jpg" new file mode 100644 index 00000000..95136fd2 Binary files /dev/null and "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day13/source/day13/img/5.jpg" differ diff --git "a/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day13/source/day13/style/css.css" "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day13/source/day13/style/css.css" new file mode 100644 index 00000000..107e0a88 --- /dev/null +++ "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day13/source/day13/style/css.css" @@ -0,0 +1,45 @@ +@CHARSET "UTF-8"; + +body { + width: 800px; + margin-left: auto; + margin-right: auto; +} + +button { + width: 300px; + margin-bottom: 10px; +} + +#btnList { + float:left; +} + +#total{ + width: 450px; + float:left; +} + +ul{ + list-style-type: none; + margin: 0px; + padding: 0px; +} + +.inner li{ + border-style: solid; + border-width: 1px; + padding: 5px; + margin: 5px; + background-color: #99ff99; + float:left; +} + +.inner{ + width:400px; + border-style: solid; + border-width: 1px; + margin-bottom: 10px; + padding: 10px; + float: left; +} diff --git "a/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day14/source/day14/.project" "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day14/source/day14/.project" new file mode 100644 index 00000000..5cd492a5 --- /dev/null +++ "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day14/source/day14/.project" @@ -0,0 +1,37 @@ + + + day14 + Create By HBuilder + + + + + com.aptana.ide.core.unifiedBuilder + + + + + + com.aptana.projects.webnature + + + + 1480901150361 + + 10 + + org.eclipse.ui.ide.orFilterMatcher + + + org.eclipse.ui.ide.multiFilter + 1.0-projectRelativePath-matches-false-false-bin + + + org.eclipse.ui.ide.multiFilter + 1.0-projectRelativePath-matches-false-false-setting + + + + + + diff --git "a/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day14/source/day14/01.dom\346\237\245\350\257\242.html" "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day14/source/day14/01.dom\346\237\245\350\257\242.html" new file mode 100644 index 00000000..6040538d --- /dev/null +++ "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day14/source/day14/01.dom\346\237\245\350\257\242.html" @@ -0,0 +1,284 @@ + + + + + Untitled Document + + + + +
+
+

+ 你喜欢哪个城市? +

+ +
    +
  • 北京
  • +
  • 上海
  • +
  • 东京
  • +
  • 首尔
  • +
+ +
+
+ +

+ 你喜欢哪款单机游戏? +

+ +
    +
  • 红警
  • +
  • 实况
  • +
  • 极品飞车
  • +
  • 魔兽
  • +
+ +
+
+ +

+ 你手机的操作系统是? +

+ +
  • IOS
  • Android
  • Windows Phone
+
+ +
+ gender: + + Male + + Female +
+
+ name: + +
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ + diff --git "a/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day14/source/day14/02.\345\205\250\351\200\211\347\273\203\344\271\240.html" "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day14/source/day14/02.\345\205\250\351\200\211\347\273\203\344\271\240.html" new file mode 100644 index 00000000..b494477f --- /dev/null +++ "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day14/source/day14/02.\345\205\250\351\200\211\347\273\203\344\271\240.html" @@ -0,0 +1,191 @@ + + + + +全选练习 + + + + +
+ 你爱好的运动是?全选/全不选 + +
+ 足球 + 篮球 + 羽毛球 + 乒乓球 +
+ + + + +
+ + \ No newline at end of file diff --git "a/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day14/source/day14/03.dom\346\237\245\350\257\242\347\232\204\345\205\266\344\273\226\347\232\204\346\226\271\346\263\225.html" "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day14/source/day14/03.dom\346\237\245\350\257\242\347\232\204\345\205\266\344\273\226\347\232\204\346\226\271\346\263\225.html" new file mode 100644 index 00000000..a331a04d --- /dev/null +++ "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day14/source/day14/03.dom\346\237\245\350\257\242\347\232\204\345\205\266\344\273\226\347\232\204\346\226\271\346\263\225.html" @@ -0,0 +1,98 @@ + + + + + + + + +
+
+ 我是第一个box1 +
我是box1中的div
+
+
+
我是box1中的div
+
+
+
我是box1中的div
+
+
+
我是box1中的div
+
+ +
+ + diff --git "a/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day14/source/day14/04.dom\345\242\236\345\210\240\346\224\271.html" "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day14/source/day14/04.dom\345\242\236\345\210\240\346\224\271.html" new file mode 100644 index 00000000..1405c00a --- /dev/null +++ "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day14/source/day14/04.dom\345\242\236\345\210\240\346\224\271.html" @@ -0,0 +1,189 @@ + + + + + Untitled Document + + + + + +
+
+

+ 你喜欢哪个城市? +

+ +
    +
  • 北京
  • +
  • 上海
  • +
  • 东京
  • +
  • 首尔
  • +
+ +
+
+
+
+
+
+
+
+
+
+
+ + diff --git "a/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day14/source/day14/05.\347\273\203\344\271\240.html" "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day14/source/day14/05.\347\273\203\344\271\240.html" new file mode 100644 index 00000000..90875a3b --- /dev/null +++ "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day14/source/day14/05.\347\273\203\344\271\240.html" @@ -0,0 +1,122 @@ + + + + +添加删除记录练习 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameEmailSalary 
Tomtom@tom.com5000Delete
Jerryjerry@sohu.com8000Delete
Bobbob@tom.com10000Delete
+ +
+ +

添加新员工

+ + + + + + + + + + + + + + + + + +
name: + +
email: + +
salary: + +
+ +
+ +
+ + + diff --git "a/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day14/source/day14/ex_2_style/css.css" "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day14/source/day14/ex_2_style/css.css" new file mode 100644 index 00000000..b89411a1 --- /dev/null +++ "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day14/source/day14/ex_2_style/css.css" @@ -0,0 +1,58 @@ +@CHARSET "UTF-8"; +#total { + width: 450px; + margin-left: auto; + margin-right: auto; +} + +ul { + list-style-type: none; +} + +li { + border-style: solid; + border-width: 1px; + padding: 5px; + margin: 5px; + background-color: #99ff99; + float: left; +} + +.inner { + width: 400px; + border-style: solid; + border-width: 1px; + margin: 10px; + padding: 10px; + float: left; +} + +#employeeTable { + border-spacing: 1px; + background-color: black; + margin: 80px auto 10px auto; +} + +th,td { + background-color: white; +} + +#formDiv { + width: 250px; + border-style: solid; + border-width: 1px; + margin: 50px auto 10px auto; + padding: 10px; +} + +#formDiv input { + width: 100%; +} + +.word { + width: 40px; +} + +.inp { + width: 200px; +} \ No newline at end of file diff --git "a/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day14/source/day14/style/css.css" "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day14/source/day14/style/css.css" new file mode 100644 index 00000000..107e0a88 --- /dev/null +++ "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day14/source/day14/style/css.css" @@ -0,0 +1,45 @@ +@CHARSET "UTF-8"; + +body { + width: 800px; + margin-left: auto; + margin-right: auto; +} + +button { + width: 300px; + margin-bottom: 10px; +} + +#btnList { + float:left; +} + +#total{ + width: 450px; + float:left; +} + +ul{ + list-style-type: none; + margin: 0px; + padding: 0px; +} + +.inner li{ + border-style: solid; + border-width: 1px; + padding: 5px; + margin: 5px; + background-color: #99ff99; + float:left; +} + +.inner{ + width:400px; + border-style: solid; + border-width: 1px; + margin-bottom: 10px; + padding: 10px; + float: left; +} diff --git "a/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day15/source/day15/.project" "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day15/source/day15/.project" new file mode 100644 index 00000000..c4511c09 --- /dev/null +++ "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day15/source/day15/.project" @@ -0,0 +1,37 @@ + + + day15 + Create By HBuilder + + + + + com.aptana.ide.core.unifiedBuilder + + + + + + com.aptana.projects.webnature + + + + 1480987077534 + + 10 + + org.eclipse.ui.ide.orFilterMatcher + + + org.eclipse.ui.ide.multiFilter + 1.0-projectRelativePath-matches-false-false-bin + + + org.eclipse.ui.ide.multiFilter + 1.0-projectRelativePath-matches-false-false-setting + + + + + + diff --git "a/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day15/source/day15/01.\347\273\203\344\271\240.html" "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day15/source/day15/01.\347\273\203\344\271\240.html" new file mode 100644 index 00000000..f05eaa11 --- /dev/null +++ "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day15/source/day15/01.\347\273\203\344\271\240.html" @@ -0,0 +1,210 @@ + + + + + + 添加删除记录练习 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameEmailSalary 
Tomtom@tom.com5000 + Delete +
Jerryjerry@sohu.com8000 + Delete +
Bobbob@tom.com10000 + Delete +
+ +
+ +

添加新员工

+ + + + + + + + + + + + + + + + + +
name: + +
email: + +
salary: + +
+ +
+ +
+ + + + \ No newline at end of file diff --git "a/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day15/source/day15/02.\347\273\203\344\271\240.html" "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day15/source/day15/02.\347\273\203\344\271\240.html" new file mode 100644 index 00000000..fa6ca616 --- /dev/null +++ "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day15/source/day15/02.\347\273\203\344\271\240.html" @@ -0,0 +1,191 @@ + + + + + + 添加删除记录练习 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameEmailSalary 
Tomtom@tom.com5000 + Delete +
Jerryjerry@sohu.com8000 + Delete +
Bobbob@tom.com10000 + Delete +
+ +
+ +

添加新员工

+ + + + + + + + + + + + + + + + + +
name: + +
email: + +
salary: + +
+ +
+ +
+ + + + \ No newline at end of file diff --git "a/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day15/source/day15/03.\347\273\203\344\271\240.html" "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day15/source/day15/03.\347\273\203\344\271\240.html" new file mode 100644 index 00000000..9c0d2de4 --- /dev/null +++ "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day15/source/day15/03.\347\273\203\344\271\240.html" @@ -0,0 +1,108 @@ + + + + +添加删除记录练习 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameEmailSalary 
Tomtom@tom.com5000Delete
Jerryjerry@sohu.com8000Delete
Bobbob@tom.com10000Delete
+ +
+ +

添加新员工

+ + + + + + + + + + + + + + + + + +
name: + +
email: + +
salary: + +
+ +
+ +
+ + + diff --git "a/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day15/source/day15/04.\344\275\277\347\224\250DOM\346\223\215\344\275\234CSS.html" "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day15/source/day15/04.\344\275\277\347\224\250DOM\346\223\215\344\275\234CSS.html" new file mode 100644 index 00000000..582f39c4 --- /dev/null +++ "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day15/source/day15/04.\344\275\277\347\224\250DOM\346\223\215\344\275\234CSS.html" @@ -0,0 +1,84 @@ + + + + + + + + + + + + + + +

+ +
+ + + diff --git "a/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day15/source/day15/05.\350\257\273\345\217\226\345\205\203\347\264\240\347\232\204\346\240\267\345\274\217.html" "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day15/source/day15/05.\350\257\273\345\217\226\345\205\203\347\264\240\347\232\204\346\240\267\345\274\217.html" new file mode 100644 index 00000000..51395d8c --- /dev/null +++ "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day15/source/day15/05.\350\257\273\345\217\226\345\205\203\347\264\240\347\232\204\346\240\267\345\274\217.html" @@ -0,0 +1,106 @@ + + + + + + + + + + + +

+
+ + diff --git "a/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day15/source/day15/06.\345\205\266\344\273\226\346\240\267\345\274\217\346\223\215\344\275\234\347\232\204\345\261\236\346\200\247.html" "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day15/source/day15/06.\345\205\266\344\273\226\346\240\267\345\274\217\346\223\215\344\275\234\347\232\204\345\261\236\346\200\247.html" new file mode 100644 index 00000000..7ee08a6e --- /dev/null +++ "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day15/source/day15/06.\345\205\266\344\273\226\346\240\267\345\274\217\346\223\215\344\275\234\347\232\204\345\261\236\346\200\247.html" @@ -0,0 +1,137 @@ + + + + + + + + + + +

+ +
+
+
+ + + +

+ +
+
+
+
+
+ + + + diff --git "a/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day15/source/day15/07.\347\273\203\344\271\240.html" "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day15/source/day15/07.\347\273\203\344\271\240.html" new file mode 100644 index 00000000..7ca5220a --- /dev/null +++ "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day15/source/day15/07.\347\273\203\344\271\240.html" @@ -0,0 +1,169 @@ + + + + + + + + + +

欢迎亲爱的用户注册

+

+ 亲爱的用户,请仔细阅读以下协议,如果你不仔细阅读你就别注册 + 亲爱的用户,请仔细阅读以下协议,如果你不仔细阅读你就别注册 + 亲爱的用户,请仔细阅读以下协议,如果你不仔细阅读你就别注册 + 亲爱的用户,请仔细阅读以下协议,如果你不仔细阅读你就别注册 + 亲爱的用户,请仔细阅读以下协议,如果你不仔细阅读你就别注册 + 亲爱的用户,请仔细阅读以下协议,如果你不仔细阅读你就别注册 + 亲爱的用户,请仔细阅读以下协议,如果你不仔细阅读你就别注册 + 亲爱的用户,请仔细阅读以下协议,如果你不仔细阅读你就别注册 + 亲爱的用户,请仔细阅读以下协议,如果你不仔细阅读你就别注册 + 亲爱的用户,请仔细阅读以下协议,如果你不仔细阅读你就别注册 + 亲爱的用户,请仔细阅读以下协议,如果你不仔细阅读你就别注册 + 亲爱的用户,请仔细阅读以下协议,如果你不仔细阅读你就别注册 + 亲爱的用户,请仔细阅读以下协议,如果你不仔细阅读你就别注册 + 亲爱的用户,请仔细阅读以下协议,如果你不仔细阅读你就别注册 + 亲爱的用户,请仔细阅读以下协议,如果你不仔细阅读你就别注册 + 亲爱的用户,请仔细阅读以下协议,如果你不仔细阅读你就别注册 + 亲爱的用户,请仔细阅读以下协议,如果你不仔细阅读你就别注册 + 亲爱的用户,请仔细阅读以下协议,如果你不仔细阅读你就别注册 + 亲爱的用户,请仔细阅读以下协议,如果你不仔细阅读你就别注册 + 亲爱的用户,请仔细阅读以下协议,如果你不仔细阅读你就别注册 + 亲爱的用户,请仔细阅读以下协议,如果你不仔细阅读你就别注册 + 亲爱的用户,请仔细阅读以下协议,如果你不仔细阅读你就别注册 + 亲爱的用户,请仔细阅读以下协议,如果你不仔细阅读你就别注册 + 亲爱的用户,请仔细阅读以下协议,如果你不仔细阅读你就别注册 + 亲爱的用户,请仔细阅读以下协议,如果你不仔细阅读你就别注册 + 亲爱的用户,请仔细阅读以下协议,如果你不仔细阅读你就别注册 + 亲爱的用户,请仔细阅读以下协议,如果你不仔细阅读你就别注册 + 亲爱的用户,请仔细阅读以下协议,如果你不仔细阅读你就别注册 + 亲爱的用户,请仔细阅读以下协议,如果你不仔细阅读你就别注册 + 亲爱的用户,请仔细阅读以下协议,如果你不仔细阅读你就别注册 + 亲爱的用户,请仔细阅读以下协议,如果你不仔细阅读你就别注册 + 亲爱的用户,请仔细阅读以下协议,如果你不仔细阅读你就别注册 + 亲爱的用户,请仔细阅读以下协议,如果你不仔细阅读你就别注册 + 亲爱的用户,请仔细阅读以下协议,如果你不仔细阅读你就别注册 + 亲爱的用户,请仔细阅读以下协议,如果你不仔细阅读你就别注册 + 亲爱的用户,请仔细阅读以下协议,如果你不仔细阅读你就别注册 + 亲爱的用户,请仔细阅读以下协议,如果你不仔细阅读你就别注册 + 亲爱的用户,请仔细阅读以下协议,如果你不仔细阅读你就别注册 + 亲爱的用户,请仔细阅读以下协议,如果你不仔细阅读你就别注册 + 亲爱的用户,请仔细阅读以下协议,如果你不仔细阅读你就别注册 + 亲爱的用户,请仔细阅读以下协议,如果你不仔细阅读你就别注册 + 亲爱的用户,请仔细阅读以下协议,如果你不仔细阅读你就别注册 + 亲爱的用户,请仔细阅读以下协议,如果你不仔细阅读你就别注册 + 亲爱的用户,请仔细阅读以下协议,如果你不仔细阅读你就别注册 + 亲爱的用户,请仔细阅读以下协议,如果你不仔细阅读你就别注册 + 亲爱的用户,请仔细阅读以下协议,如果你不仔细阅读你就别注册 + 亲爱的用户,请仔细阅读以下协议,如果你不仔细阅读你就别注册 + 亲爱的用户,请仔细阅读以下协议,如果你不仔细阅读你就别注册 + 亲爱的用户,请仔细阅读以下协议,如果你不仔细阅读你就别注册 + 亲爱的用户,请仔细阅读以下协议,如果你不仔细阅读你就别注册 + 亲爱的用户,请仔细阅读以下协议,如果你不仔细阅读你就别注册 + 亲爱的用户,请仔细阅读以下协议,如果你不仔细阅读你就别注册 + 亲爱的用户,请仔细阅读以下协议,如果你不仔细阅读你就别注册 + 亲爱的用户,请仔细阅读以下协议,如果你不仔细阅读你就别注册 + 亲爱的用户,请仔细阅读以下协议,如果你不仔细阅读你就别注册 + 亲爱的用户,请仔细阅读以下协议,如果你不仔细阅读你就别注册 + 亲爱的用户,请仔细阅读以下协议,如果你不仔细阅读你就别注册 + 亲爱的用户,请仔细阅读以下协议,如果你不仔细阅读你就别注册 + 亲爱的用户,请仔细阅读以下协议,如果你不仔细阅读你就别注册 + 亲爱的用户,请仔细阅读以下协议,如果你不仔细阅读你就别注册 + 亲爱的用户,请仔细阅读以下协议,如果你不仔细阅读你就别注册 + 亲爱的用户,请仔细阅读以下协议,如果你不仔细阅读你就别注册 + 亲爱的用户,请仔细阅读以下协议,如果你不仔细阅读你就别注册 + 亲爱的用户,请仔细阅读以下协议,如果你不仔细阅读你就别注册 + 亲爱的用户,请仔细阅读以下协议,如果你不仔细阅读你就别注册 + 亲爱的用户,请仔细阅读以下协议,如果你不仔细阅读你就别注册 + 亲爱的用户,请仔细阅读以下协议,如果你不仔细阅读你就别注册 + 亲爱的用户,请仔细阅读以下协议,如果你不仔细阅读你就别注册 + 亲爱的用户,请仔细阅读以下协议,如果你不仔细阅读你就别注册 + 亲爱的用户,请仔细阅读以下协议,如果你不仔细阅读你就别注册 + 亲爱的用户,请仔细阅读以下协议,如果你不仔细阅读你就别注册 + 亲爱的用户,请仔细阅读以下协议,如果你不仔细阅读你就别注册 + 亲爱的用户,请仔细阅读以下协议,如果你不仔细阅读你就别注册 + 亲爱的用户,请仔细阅读以下协议,如果你不仔细阅读你就别注册 + 亲爱的用户,请仔细阅读以下协议,如果你不仔细阅读你就别注册 + 亲爱的用户,请仔细阅读以下协议,如果你不仔细阅读你就别注册 + 亲爱的用户,请仔细阅读以下协议,如果你不仔细阅读你就别注册 + 亲爱的用户,请仔细阅读以下协议,如果你不仔细阅读你就别注册 + 亲爱的用户,请仔细阅读以下协议,如果你不仔细阅读你就别注册 + 亲爱的用户,请仔细阅读以下协议,如果你不仔细阅读你就别注册 + 亲爱的用户,请仔细阅读以下协议,如果你不仔细阅读你就别注册 + 亲爱的用户,请仔细阅读以下协议,如果你不仔细阅读你就别注册 + 亲爱的用户,请仔细阅读以下协议,如果你不仔细阅读你就别注册 + 亲爱的用户,请仔细阅读以下协议,如果你不仔细阅读你就别注册 + 亲爱的用户,请仔细阅读以下协议,如果你不仔细阅读你就别注册 + 亲爱的用户,请仔细阅读以下协议,如果你不仔细阅读你就别注册 + 亲爱的用户,请仔细阅读以下协议,如果你不仔细阅读你就别注册 + 亲爱的用户,请仔细阅读以下协议,如果你不仔细阅读你就别注册 + 亲爱的用户,请仔细阅读以下协议,如果你不仔细阅读你就别注册 + 亲爱的用户,请仔细阅读以下协议,如果你不仔细阅读你就别注册 + 亲爱的用户,请仔细阅读以下协议,如果你不仔细阅读你就别注册 + 亲爱的用户,请仔细阅读以下协议,如果你不仔细阅读你就别注册 + 亲爱的用户,请仔细阅读以下协议,如果你不仔细阅读你就别注册 + 亲爱的用户,请仔细阅读以下协议,如果你不仔细阅读你就别注册 + 亲爱的用户,请仔细阅读以下协议,如果你不仔细阅读你就别注册 + 亲爱的用户,请仔细阅读以下协议,如果你不仔细阅读你就别注册 + 亲爱的用户,请仔细阅读以下协议,如果你不仔细阅读你就别注册 + 亲爱的用户,请仔细阅读以下协议,如果你不仔细阅读你就别注册 + 亲爱的用户,请仔细阅读以下协议,如果你不仔细阅读你就别注册 + 亲爱的用户,请仔细阅读以下协议,如果你不仔细阅读你就别注册 + 亲爱的用户,请仔细阅读以下协议,如果你不仔细阅读你就别注册 + 亲爱的用户,请仔细阅读以下协议,如果你不仔细阅读你就别注册 + 亲爱的用户,请仔细阅读以下协议,如果你不仔细阅读你就别注册 + 亲爱的用户,请仔细阅读以下协议,如果你不仔细阅读你就别注册 + 亲爱的用户,请仔细阅读以下协议,如果你不仔细阅读你就别注册 + 亲爱的用户,请仔细阅读以下协议,如果你不仔细阅读你就别注册 + 亲爱的用户,请仔细阅读以下协议,如果你不仔细阅读你就别注册 + 亲爱的用户,请仔细阅读以下协议,如果你不仔细阅读你就别注册 + 亲爱的用户,请仔细阅读以下协议,如果你不仔细阅读你就别注册 + 亲爱的用户,请仔细阅读以下协议,如果你不仔细阅读你就别注册 +

+ + 我已仔细阅读协议,一定遵守 + + + diff --git "a/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day15/source/day15/08.\344\272\213\344\273\266\345\257\271\350\261\241.html" "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day15/source/day15/08.\344\272\213\344\273\266\345\257\271\350\261\241.html" new file mode 100644 index 00000000..f1a3def1 --- /dev/null +++ "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day15/source/day15/08.\344\272\213\344\273\266\345\257\271\350\261\241.html" @@ -0,0 +1,77 @@ + + + + +Insert title here + + + + + +
+
+ + + \ No newline at end of file diff --git "a/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day15/source/day15/09.\347\273\203\344\271\240.html" "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day15/source/day15/09.\347\273\203\344\271\240.html" new file mode 100644 index 00000000..046c8dd9 --- /dev/null +++ "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day15/source/day15/09.\347\273\203\344\271\240.html" @@ -0,0 +1,71 @@ + + + + + + + + + + +
+ + diff --git "a/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day15/source/day15/10.\345\206\222\346\263\241.html" "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day15/source/day15/10.\345\206\222\346\263\241.html" new file mode 100644 index 00000000..bc8c1559 --- /dev/null +++ "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day15/source/day15/10.\345\206\222\346\263\241.html" @@ -0,0 +1,69 @@ + + + + + + + + + + +
+ 我是box1 + 我是span +
+ + + diff --git "a/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day15/source/day15/11.\345\206\222\346\263\241.html" "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day15/source/day15/11.\345\206\222\346\263\241.html" new file mode 100644 index 00000000..68d90a86 --- /dev/null +++ "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day15/source/day15/11.\345\206\222\346\263\241.html" @@ -0,0 +1,80 @@ + + + + + + + + + + +
+
+ + diff --git "a/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day15/source/day15/ex_2_style/css.css" "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day15/source/day15/ex_2_style/css.css" new file mode 100644 index 00000000..b89411a1 --- /dev/null +++ "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day15/source/day15/ex_2_style/css.css" @@ -0,0 +1,58 @@ +@CHARSET "UTF-8"; +#total { + width: 450px; + margin-left: auto; + margin-right: auto; +} + +ul { + list-style-type: none; +} + +li { + border-style: solid; + border-width: 1px; + padding: 5px; + margin: 5px; + background-color: #99ff99; + float: left; +} + +.inner { + width: 400px; + border-style: solid; + border-width: 1px; + margin: 10px; + padding: 10px; + float: left; +} + +#employeeTable { + border-spacing: 1px; + background-color: black; + margin: 80px auto 10px auto; +} + +th,td { + background-color: white; +} + +#formDiv { + width: 250px; + border-style: solid; + border-width: 1px; + margin: 50px auto 10px auto; + padding: 10px; +} + +#formDiv input { + width: 100%; +} + +.word { + width: 40px; +} + +.inp { + width: 200px; +} \ No newline at end of file diff --git "a/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day16/source/day16/.project" "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day16/source/day16/.project" new file mode 100644 index 00000000..729919da --- /dev/null +++ "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day16/source/day16/.project" @@ -0,0 +1,37 @@ + + + day16 + Create By HBuilder + + + + + com.aptana.ide.core.unifiedBuilder + + + + + + com.aptana.projects.webnature + + + + 1481073892970 + + 10 + + org.eclipse.ui.ide.orFilterMatcher + + + org.eclipse.ui.ide.multiFilter + 1.0-projectRelativePath-matches-false-false-bin + + + org.eclipse.ui.ide.multiFilter + 1.0-projectRelativePath-matches-false-false-setting + + + + + + diff --git "a/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day16/source/day16/01.\344\272\213\344\273\266\347\232\204\345\247\224\346\264\276.html" "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day16/source/day16/01.\344\272\213\344\273\266\347\232\204\345\247\224\346\264\276.html" new file mode 100644 index 00000000..7cca86f4 --- /dev/null +++ "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day16/source/day16/01.\344\272\213\344\273\266\347\232\204\345\247\224\346\264\276.html" @@ -0,0 +1,83 @@ + + + + + + + + + + + + + + diff --git "a/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day16/source/day16/02.\344\272\213\344\273\266\347\232\204\347\273\221\345\256\232.html" "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day16/source/day16/02.\344\272\213\344\273\266\347\232\204\347\273\221\345\256\232.html" new file mode 100644 index 00000000..59e89142 --- /dev/null +++ "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day16/source/day16/02.\344\272\213\344\273\266\347\232\204\347\273\221\345\256\232.html" @@ -0,0 +1,129 @@ + + + + + + + + + + + + diff --git "a/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day16/source/day16/03.\344\272\213\344\273\266\347\232\204\344\274\240\346\222\255.html" "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day16/source/day16/03.\344\272\213\344\273\266\347\232\204\344\274\240\346\222\255.html" new file mode 100644 index 00000000..2b0af301 --- /dev/null +++ "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day16/source/day16/03.\344\272\213\344\273\266\347\232\204\344\274\240\346\222\255.html" @@ -0,0 +1,104 @@ + + + + + + + + + + + + +
+
+
+
+
+ + + diff --git "a/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day16/source/day16/04.\346\213\226\346\213\275.html" "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day16/source/day16/04.\346\213\226\346\213\275.html" new file mode 100644 index 00000000..27ba6ab7 --- /dev/null +++ "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day16/source/day16/04.\346\213\226\346\213\275.html" @@ -0,0 +1,87 @@ + + + + + + + + + + +
+ +
+ + diff --git "a/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day16/source/day16/05.\346\213\226\346\213\2752.html" "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day16/source/day16/05.\346\213\226\346\213\2752.html" new file mode 100644 index 00000000..97e99a79 --- /dev/null +++ "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day16/source/day16/05.\346\213\226\346\213\2752.html" @@ -0,0 +1,115 @@ + + + + + + + + + + + + 我是一段文字 + +
+ +
+ + diff --git "a/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day16/source/day16/06.\346\265\213\350\257\225IE8.html" "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day16/source/day16/06.\346\265\213\350\257\225IE8.html" new file mode 100644 index 00000000..058b1b93 --- /dev/null +++ "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day16/source/day16/06.\346\265\213\350\257\225IE8.html" @@ -0,0 +1,32 @@ + + + + + + + + + + + + diff --git "a/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day16/source/day16/07.\346\213\226\346\213\2753.html" "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day16/source/day16/07.\346\213\226\346\213\2753.html" new file mode 100644 index 00000000..7125fcef --- /dev/null +++ "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day16/source/day16/07.\346\213\226\346\213\2753.html" @@ -0,0 +1,132 @@ + + + + + + + + + + + + 我是一段文字 + +
+ +
+ + + + diff --git "a/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day16/source/day16/08.\346\273\232\350\275\256\344\272\213\344\273\266.html" "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day16/source/day16/08.\346\273\232\350\275\256\344\272\213\344\273\266.html" new file mode 100644 index 00000000..9947144c --- /dev/null +++ "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day16/source/day16/08.\346\273\232\350\275\256\344\272\213\344\273\266.html" @@ -0,0 +1,114 @@ + + + + + + + + + + +
+ + + diff --git "a/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day16/source/day16/09.\351\224\256\347\233\230\344\272\213\344\273\266.html" "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day16/source/day16/09.\351\224\256\347\233\230\344\272\213\344\273\266.html" new file mode 100644 index 00000000..67e01d0a --- /dev/null +++ "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day16/source/day16/09.\351\224\256\347\233\230\344\272\213\344\273\266.html" @@ -0,0 +1,80 @@ + + + + + + + + + + + + + diff --git "a/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day16/source/day16/10.\347\273\203\344\271\240.html" "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day16/source/day16/10.\347\273\203\344\271\240.html" new file mode 100644 index 00000000..4307be6d --- /dev/null +++ "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day16/source/day16/10.\347\273\203\344\271\240.html" @@ -0,0 +1,74 @@ + + + + + + + + + + +
+ + diff --git "a/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day16/source/day16/img/an.jpg" "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day16/source/day16/img/an.jpg" new file mode 100644 index 00000000..2066ef80 Binary files /dev/null and "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day16/source/day16/img/an.jpg" differ diff --git "a/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day17/source/day17/.project" "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day17/source/day17/.project" new file mode 100644 index 00000000..61f44374 --- /dev/null +++ "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day17/source/day17/.project" @@ -0,0 +1,37 @@ + + + day17 + Create By HBuilder + + + + + com.aptana.ide.core.unifiedBuilder + + + + + + com.aptana.projects.webnature + + + + 1481244016777 + + 10 + + org.eclipse.ui.ide.orFilterMatcher + + + org.eclipse.ui.ide.multiFilter + 1.0-projectRelativePath-matches-false-false-bin + + + org.eclipse.ui.ide.multiFilter + 1.0-projectRelativePath-matches-false-false-setting + + + + + + diff --git "a/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day17/source/day17/01.BOM.html" "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day17/source/day17/01.BOM.html" new file mode 100644 index 00000000..7305265d --- /dev/null +++ "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day17/source/day17/01.BOM.html" @@ -0,0 +1,100 @@ + + + + + + + + + + + diff --git "a/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day17/source/day17/02.History.html" "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day17/source/day17/02.History.html" new file mode 100644 index 00000000..af7e1c73 --- /dev/null +++ "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day17/source/day17/02.History.html" @@ -0,0 +1,59 @@ + + + + + + + + + + + +

History

+ + 去BOM + + diff --git "a/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day17/source/day17/03.Location.html" "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day17/source/day17/03.Location.html" new file mode 100644 index 00000000..92c53a71 --- /dev/null +++ "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day17/source/day17/03.Location.html" @@ -0,0 +1,63 @@ + + + + + + + + + + + +

Location

+ + + 去BOM + + diff --git "a/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day17/source/day17/04.\345\256\232\346\227\266\350\260\203\347\224\250.html" "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day17/source/day17/04.\345\256\232\346\227\266\350\260\203\347\224\250.html" new file mode 100644 index 00000000..3753eebb --- /dev/null +++ "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day17/source/day17/04.\345\256\232\346\227\266\350\260\203\347\224\250.html" @@ -0,0 +1,63 @@ + + + + + + + + +

+ + diff --git "a/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day17/source/day17/05.\347\273\203\344\271\240.html" "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day17/source/day17/05.\347\273\203\344\271\240.html" new file mode 100644 index 00000000..890b5e56 --- /dev/null +++ "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day17/source/day17/05.\347\273\203\344\271\240.html" @@ -0,0 +1,82 @@ + + + + + + + + + + +

+ + + + diff --git "a/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day17/source/day17/06.\347\247\273\345\212\250div\347\273\203\344\271\240.html" "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day17/source/day17/06.\347\247\273\345\212\250div\347\273\203\344\271\240.html" new file mode 100644 index 00000000..31348dba --- /dev/null +++ "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day17/source/day17/06.\347\247\273\345\212\250div\347\273\203\344\271\240.html" @@ -0,0 +1,94 @@ + + + + + + + + + + +
+ + diff --git "a/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day17/source/day17/07.\345\273\266\346\227\266\350\260\203\347\224\250.html" "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day17/source/day17/07.\345\273\266\346\227\266\350\260\203\347\224\250.html" new file mode 100644 index 00000000..b90fa6f8 --- /dev/null +++ "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day17/source/day17/07.\345\273\266\346\227\266\350\260\203\347\224\250.html" @@ -0,0 +1,35 @@ + + + + + + + + + + diff --git "a/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day17/source/day17/08.\345\256\232\346\227\266\345\231\250.html" "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day17/source/day17/08.\345\256\232\346\227\266\345\231\250.html" new file mode 100644 index 00000000..d25451fe --- /dev/null +++ "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day17/source/day17/08.\345\256\232\346\227\266\345\231\250.html" @@ -0,0 +1,105 @@ + + + + + + + + + + + + + +

+ +
+ +
+ + + diff --git "a/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day17/source/day17/09.\345\256\232\346\227\266\345\231\2502.html" "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day17/source/day17/09.\345\256\232\346\227\266\345\231\2502.html" new file mode 100644 index 00000000..73ea6964 --- /dev/null +++ "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day17/source/day17/09.\345\256\232\346\227\266\345\231\2502.html" @@ -0,0 +1,138 @@ + + + + + + + + + + + + + + +

+ +
+ +
+ + + diff --git "a/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day17/source/day17/10.\345\256\232\346\227\266\345\231\2503.html" "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day17/source/day17/10.\345\256\232\346\227\266\345\231\2503.html" new file mode 100644 index 00000000..35bf368c --- /dev/null +++ "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day17/source/day17/10.\345\256\232\346\227\266\345\231\2503.html" @@ -0,0 +1,108 @@ + + + + + + + + + + + + + + + + +

+ +
+
+ +
+ + + diff --git "a/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day17/source/day17/11.\350\275\256\346\222\255\345\233\276.html" "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day17/source/day17/11.\350\275\256\346\222\255\345\233\276.html" new file mode 100644 index 00000000..05fc6f0c --- /dev/null +++ "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day17/source/day17/11.\350\275\256\346\222\255\345\233\276.html" @@ -0,0 +1,191 @@ + + + + + + + + + + + + + + +
+ +
    +
  • +
  • +
  • +
  • +
  • +
+ + +
+ + diff --git "a/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day17/source/day17/img/1.jpg" "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day17/source/day17/img/1.jpg" new file mode 100644 index 00000000..03afb30c Binary files /dev/null and "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day17/source/day17/img/1.jpg" differ diff --git "a/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day17/source/day17/img/2.jpg" "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day17/source/day17/img/2.jpg" new file mode 100644 index 00000000..b88750dc Binary files /dev/null and "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day17/source/day17/img/2.jpg" differ diff --git "a/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day17/source/day17/img/3.jpg" "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day17/source/day17/img/3.jpg" new file mode 100644 index 00000000..eb0d14e8 Binary files /dev/null and "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day17/source/day17/img/3.jpg" differ diff --git "a/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day17/source/day17/img/4.jpg" "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day17/source/day17/img/4.jpg" new file mode 100644 index 00000000..018c9a16 Binary files /dev/null and "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day17/source/day17/img/4.jpg" differ diff --git "a/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day17/source/day17/img/5.jpg" "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day17/source/day17/img/5.jpg" new file mode 100644 index 00000000..95136fd2 Binary files /dev/null and "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day17/source/day17/img/5.jpg" differ diff --git "a/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day17/source/day17/js/tools.js" "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day17/source/day17/js/tools.js" new file mode 100644 index 00000000..bfb2940b --- /dev/null +++ "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day17/source/day17/js/tools.js" @@ -0,0 +1,73 @@ +//尝试创建一个可以执行简单动画的函数 +/* + * 参数: + * obj:要执行动画的对象 + * attr:要执行动画的样式,比如:left top width height + * target:执行动画的目标位置 + * speed:移动的速度(正数向右移动,负数向左移动) + * callback:回调函数,这个函数将会在动画执行完毕以后执行 + */ +function move(obj, attr, target, speed, callback) { + //关闭上一个定时器 + clearInterval(obj.timer); + + //获取元素目前的位置 + var current = parseInt(getStyle(obj, attr)); + + //判断速度的正负值 + //如果从0 向 800移动,则speed为正 + //如果从800向0移动,则speed为负 + if(current > target) { + //此时速度应为负值 + speed = -speed; + } + + //开启一个定时器,用来执行动画效果 + //向执行动画的对象中添加一个timer属性,用来保存它自己的定时器的标识 + obj.timer = setInterval(function() { + + //获取box1的原来的left值 + var oldValue = parseInt(getStyle(obj, attr)); + + //在旧值的基础上增加 + var newValue = oldValue + speed; + + //判断newValue是否大于800 + //从800 向 0移动 + //向左移动时,需要判断newValue是否小于target + //向右移动时,需要判断newValue是否大于target + if((speed < 0 && newValue < target) || (speed > 0 && newValue > target)) { + newValue = target; + } + + //将新值设置给box1 + obj.style[attr] = newValue + "px"; + + //当元素移动到0px时,使其停止执行动画 + if(newValue == target) { + //达到目标,关闭定时器 + clearInterval(obj.timer); + //动画执行完毕,调用回调函数 + callback && callback(); + } + + }, 30); +} + +/* + * 定义一个函数,用来获取指定元素的当前的样式 + * 参数: + * obj 要获取样式的元素 + * name 要获取的样式名 + */ +function getStyle(obj, name) { + + if(window.getComputedStyle) { + //正常浏览器的方式,具有getComputedStyle()方法 + return getComputedStyle(obj, null)[name]; + } else { + //IE8的方式,没有getComputedStyle()方法 + return obj.currentStyle[name]; + } + +} \ No newline at end of file diff --git "a/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day17/source/day17/test01.html" "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day17/source/day17/test01.html" new file mode 100644 index 00000000..70be3b45 --- /dev/null +++ "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day17/source/day17/test01.html" @@ -0,0 +1,11 @@ + + + + + + + +

TEST01

+ 去test02 + + diff --git "a/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day17/source/day17/test02.html" "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day17/source/day17/test02.html" new file mode 100644 index 00000000..df217949 --- /dev/null +++ "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day17/source/day17/test02.html" @@ -0,0 +1,11 @@ + + + + + + + +

TEST02

+ 去02.History.html + + diff --git "a/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day18/source/day18/.project" "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day18/source/day18/.project" new file mode 100644 index 00000000..ef873032 --- /dev/null +++ "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day18/source/day18/.project" @@ -0,0 +1,37 @@ + + + day18 + Create By HBuilder + + + + + com.aptana.ide.core.unifiedBuilder + + + + + + com.aptana.projects.webnature + + + + 1481330647630 + + 10 + + org.eclipse.ui.ide.orFilterMatcher + + + org.eclipse.ui.ide.multiFilter + 1.0-projectRelativePath-matches-false-false-bin + + + org.eclipse.ui.ide.multiFilter + 1.0-projectRelativePath-matches-false-false-setting + + + + + + diff --git "a/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day18/source/day18/01.\350\275\256\346\222\255\345\233\276.html" "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day18/source/day18/01.\350\275\256\346\222\255\345\233\276.html" new file mode 100644 index 00000000..0292f93b --- /dev/null +++ "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day18/source/day18/01.\350\275\256\346\222\255\345\233\276.html" @@ -0,0 +1,235 @@ + + + + + + + + + + + + + + +
+ +
    +
  • +
  • +
  • +
  • +
  • +
  • +
+ + +
+ + diff --git "a/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day18/source/day18/02.\347\261\273\347\232\204\346\223\215\344\275\234.html" "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day18/source/day18/02.\347\261\273\347\232\204\346\223\215\344\275\234.html" new file mode 100644 index 00000000..8aaec661 --- /dev/null +++ "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day18/source/day18/02.\347\261\273\347\232\204\346\223\215\344\275\234.html" @@ -0,0 +1,135 @@ + + + + + + + + + + + + + +

+ +
+ + diff --git "a/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day18/source/day18/03.\344\272\214\347\272\247\350\217\234\345\215\225.html" "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day18/source/day18/03.\344\272\214\347\272\247\350\217\234\345\215\225.html" new file mode 100644 index 00000000..d6d43ce2 --- /dev/null +++ "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day18/source/day18/03.\344\272\214\347\272\247\350\217\234\345\215\225.html" @@ -0,0 +1,142 @@ + + + + + + 二级菜单 + + + + + + + + + + + + + + \ No newline at end of file diff --git "a/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day18/source/day18/04.JSON.html" "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day18/source/day18/04.JSON.html" new file mode 100644 index 00000000..418c2336 --- /dev/null +++ "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day18/source/day18/04.JSON.html" @@ -0,0 +1,94 @@ + + + + + + + + + + + + + diff --git "a/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day18/source/day18/05.JSON.html" "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day18/source/day18/05.JSON.html" new file mode 100644 index 00000000..56211dbe --- /dev/null +++ "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day18/source/day18/05.JSON.html" @@ -0,0 +1,32 @@ + + + + + + + + + + diff --git "a/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day18/source/day18/css/bottom.gif" "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day18/source/day18/css/bottom.gif" new file mode 100644 index 00000000..2636fce8 Binary files /dev/null and "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day18/source/day18/css/bottom.gif" differ diff --git "a/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day18/source/day18/css/collapsed.gif" "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day18/source/day18/css/collapsed.gif" new file mode 100644 index 00000000..6d87881b Binary files /dev/null and "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day18/source/day18/css/collapsed.gif" differ diff --git "a/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day18/source/day18/css/expanded.gif" "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day18/source/day18/css/expanded.gif" new file mode 100644 index 00000000..f1d588e4 Binary files /dev/null and "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day18/source/day18/css/expanded.gif" differ diff --git "a/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day18/source/day18/css/linkarrow.gif" "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day18/source/day18/css/linkarrow.gif" new file mode 100644 index 00000000..059a0def Binary files /dev/null and "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day18/source/day18/css/linkarrow.gif" differ diff --git "a/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day18/source/day18/css/sdmenu.css" "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day18/source/day18/css/sdmenu.css" new file mode 100644 index 00000000..e2aafd70 --- /dev/null +++ "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day18/source/day18/css/sdmenu.css" @@ -0,0 +1,61 @@ +@charset "utf-8"; + +/* sdmenu */ + +div.sdmenu { + width: 150px; + margin: 0 auto; + font-family: Arial, sans-serif; + font-size: 12px; + padding-bottom: 10px; + background: url(bottom.gif) no-repeat right bottom; + color: #fff; +} + +div.sdmenu div { + background: url(title.gif) repeat-x; + overflow: hidden; +} + +div.sdmenu div:first-child { + background: url(toptitle.gif) no-repeat; +} + +div.sdmenu div.collapsed { + height: 25px; +} + +div.sdmenu div span { + display: block; + height: 15px; + line-height: 15px; + overflow: hidden; + padding: 5px 25px; + font-weight: bold; + color: white; + background: url(expanded.gif) no-repeat 10px center; + cursor: pointer; + border-bottom: 1px solid #ddd; +} + +div.sdmenu div.collapsed span { + background-image: url(collapsed.gif); +} + +div.sdmenu div a { + padding: 5px 10px; + background: #eee; + display: block; + border-bottom: 1px solid #ddd; + color: #066; +} + +div.sdmenu div a.current { + background: #ccc; +} + +div.sdmenu div a:hover { + background: #066 url(linkarrow.gif) no-repeat right center; + color: #fff; + text-decoration: none; +} \ No newline at end of file diff --git "a/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day18/source/day18/css/title.gif" "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day18/source/day18/css/title.gif" new file mode 100644 index 00000000..f18be197 Binary files /dev/null and "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day18/source/day18/css/title.gif" differ diff --git "a/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day18/source/day18/css/toptitle.gif" "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day18/source/day18/css/toptitle.gif" new file mode 100644 index 00000000..3079490c Binary files /dev/null and "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day18/source/day18/css/toptitle.gif" differ diff --git "a/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day18/source/day18/img/1.jpg" "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day18/source/day18/img/1.jpg" new file mode 100644 index 00000000..03afb30c Binary files /dev/null and "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day18/source/day18/img/1.jpg" differ diff --git "a/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day18/source/day18/img/2.jpg" "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day18/source/day18/img/2.jpg" new file mode 100644 index 00000000..b88750dc Binary files /dev/null and "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day18/source/day18/img/2.jpg" differ diff --git "a/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day18/source/day18/img/3.jpg" "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day18/source/day18/img/3.jpg" new file mode 100644 index 00000000..eb0d14e8 Binary files /dev/null and "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day18/source/day18/img/3.jpg" differ diff --git "a/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day18/source/day18/img/4.jpg" "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day18/source/day18/img/4.jpg" new file mode 100644 index 00000000..018c9a16 Binary files /dev/null and "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day18/source/day18/img/4.jpg" differ diff --git "a/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day18/source/day18/img/5.jpg" "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day18/source/day18/img/5.jpg" new file mode 100644 index 00000000..95136fd2 Binary files /dev/null and "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day18/source/day18/img/5.jpg" differ diff --git "a/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day18/source/day18/js/json2.js" "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day18/source/day18/js/json2.js" new file mode 100644 index 00000000..d4720c0f --- /dev/null +++ "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day18/source/day18/js/json2.js" @@ -0,0 +1,506 @@ +// json2.js +// 2016-05-01 +// Public Domain. +// NO WARRANTY EXPRESSED OR IMPLIED. USE AT YOUR OWN RISK. +// See http://www.JSON.org/js.html +// This code should be minified before deployment. +// See http://javascript.crockford.com/jsmin.html + +// USE YOUR OWN COPY. IT IS EXTREMELY UNWISE TO LOAD CODE FROM SERVERS YOU DO +// NOT CONTROL. + +// This file creates a global JSON object containing two methods: stringify +// and parse. This file is provides the ES5 JSON capability to ES3 systems. +// If a project might run on IE8 or earlier, then this file should be included. +// This file does nothing on ES5 systems. + +// JSON.stringify(value, replacer, space) +// value any JavaScript value, usually an object or array. +// replacer an optional parameter that determines how object +// values are stringified for objects. It can be a +// function or an array of strings. +// space an optional parameter that specifies the indentation +// of nested structures. If it is omitted, the text will +// be packed without extra whitespace. If it is a number, +// it will specify the number of spaces to indent at each +// level. If it is a string (such as "\t" or " "), +// it contains the characters used to indent at each level. +// This method produces a JSON text from a JavaScript value. +// When an object value is found, if the object contains a toJSON +// method, its toJSON method will be called and the result will be +// stringified. A toJSON method does not serialize: it returns the +// value represented by the name/value pair that should be serialized, +// or undefined if nothing should be serialized. The toJSON method +// will be passed the key associated with the value, and this will be +// bound to the value. + +// For example, this would serialize Dates as ISO strings. + +// Date.prototype.toJSON = function (key) { +// function f(n) { +// // Format integers to have at least two digits. +// return (n < 10) +// ? "0" + n +// : n; +// } +// return this.getUTCFullYear() + "-" + +// f(this.getUTCMonth() + 1) + "-" + +// f(this.getUTCDate()) + "T" + +// f(this.getUTCHours()) + ":" + +// f(this.getUTCMinutes()) + ":" + +// f(this.getUTCSeconds()) + "Z"; +// }; + +// You can provide an optional replacer method. It will be passed the +// key and value of each member, with this bound to the containing +// object. The value that is returned from your method will be +// serialized. If your method returns undefined, then the member will +// be excluded from the serialization. + +// If the replacer parameter is an array of strings, then it will be +// used to select the members to be serialized. It filters the results +// such that only members with keys listed in the replacer array are +// stringified. + +// Values that do not have JSON representations, such as undefined or +// functions, will not be serialized. Such values in objects will be +// dropped; in arrays they will be replaced with null. You can use +// a replacer function to replace those with JSON values. + +// JSON.stringify(undefined) returns undefined. + +// The optional space parameter produces a stringification of the +// value that is filled with line breaks and indentation to make it +// easier to read. + +// If the space parameter is a non-empty string, then that string will +// be used for indentation. If the space parameter is a number, then +// the indentation will be that many spaces. + +// Example: + +// text = JSON.stringify(["e", {pluribus: "unum"}]); +// // text is '["e",{"pluribus":"unum"}]' + +// text = JSON.stringify(["e", {pluribus: "unum"}], null, "\t"); +// // text is '[\n\t"e",\n\t{\n\t\t"pluribus": "unum"\n\t}\n]' + +// text = JSON.stringify([new Date()], function (key, value) { +// return this[key] instanceof Date +// ? "Date(" + this[key] + ")" +// : value; +// }); +// // text is '["Date(---current time---)"]' + +// JSON.parse(text, reviver) +// This method parses a JSON text to produce an object or array. +// It can throw a SyntaxError exception. + +// The optional reviver parameter is a function that can filter and +// transform the results. It receives each of the keys and values, +// and its return value is used instead of the original value. +// If it returns what it received, then the structure is not modified. +// If it returns undefined then the member is deleted. + +// Example: + +// // Parse the text. Values that look like ISO date strings will +// // be converted to Date objects. + +// myData = JSON.parse(text, function (key, value) { +// var a; +// if (typeof value === "string") { +// a = +// /^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2}(?:\.\d*)?)Z$/.exec(value); +// if (a) { +// return new Date(Date.UTC(+a[1], +a[2] - 1, +a[3], +a[4], +// +a[5], +a[6])); +// } +// } +// return value; +// }); + +// myData = JSON.parse('["Date(09/09/2001)"]', function (key, value) { +// var d; +// if (typeof value === "string" && +// value.slice(0, 5) === "Date(" && +// value.slice(-1) === ")") { +// d = new Date(value.slice(5, -1)); +// if (d) { +// return d; +// } +// } +// return value; +// }); + +// This is a reference implementation. You are free to copy, modify, or +// redistribute. + +/*jslint + eval, for, this +*/ + +/*property + JSON, apply, call, charCodeAt, getUTCDate, getUTCFullYear, getUTCHours, + getUTCMinutes, getUTCMonth, getUTCSeconds, hasOwnProperty, join, + lastIndex, length, parse, prototype, push, replace, slice, stringify, + test, toJSON, toString, valueOf +*/ + + +// Create a JSON object only if one does not already exist. We create the +// methods in a closure to avoid creating global variables. + +if (typeof JSON !== "object") { + JSON = {}; +} + +(function () { + "use strict"; + + var rx_one = /^[\],:{}\s]*$/; + var rx_two = /\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g; + var rx_three = /"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g; + var rx_four = /(?:^|:|,)(?:\s*\[)+/g; + var rx_escapable = /[\\\"\u0000-\u001f\u007f-\u009f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g; + var rx_dangerous = /[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g; + + function f(n) { + // Format integers to have at least two digits. + return n < 10 + ? "0" + n + : n; + } + + function this_value() { + return this.valueOf(); + } + + if (typeof Date.prototype.toJSON !== "function") { + + Date.prototype.toJSON = function () { + + return isFinite(this.valueOf()) + ? this.getUTCFullYear() + "-" + + f(this.getUTCMonth() + 1) + "-" + + f(this.getUTCDate()) + "T" + + f(this.getUTCHours()) + ":" + + f(this.getUTCMinutes()) + ":" + + f(this.getUTCSeconds()) + "Z" + : null; + }; + + Boolean.prototype.toJSON = this_value; + Number.prototype.toJSON = this_value; + String.prototype.toJSON = this_value; + } + + var gap; + var indent; + var meta; + var rep; + + + function quote(string) { + +// If the string contains no control characters, no quote characters, and no +// backslash characters, then we can safely slap some quotes around it. +// Otherwise we must also replace the offending characters with safe escape +// sequences. + + rx_escapable.lastIndex = 0; + return rx_escapable.test(string) + ? "\"" + string.replace(rx_escapable, function (a) { + var c = meta[a]; + return typeof c === "string" + ? c + : "\\u" + ("0000" + a.charCodeAt(0).toString(16)).slice(-4); + }) + "\"" + : "\"" + string + "\""; + } + + + function str(key, holder) { + +// Produce a string from holder[key]. + + var i; // The loop counter. + var k; // The member key. + var v; // The member value. + var length; + var mind = gap; + var partial; + var value = holder[key]; + +// If the value has a toJSON method, call it to obtain a replacement value. + + if (value && typeof value === "object" && + typeof value.toJSON === "function") { + value = value.toJSON(key); + } + +// If we were called with a replacer function, then call the replacer to +// obtain a replacement value. + + if (typeof rep === "function") { + value = rep.call(holder, key, value); + } + +// What happens next depends on the value's type. + + switch (typeof value) { + case "string": + return quote(value); + + case "number": + +// JSON numbers must be finite. Encode non-finite numbers as null. + + return isFinite(value) + ? String(value) + : "null"; + + case "boolean": + case "null": + +// If the value is a boolean or null, convert it to a string. Note: +// typeof null does not produce "null". The case is included here in +// the remote chance that this gets fixed someday. + + return String(value); + +// If the type is "object", we might be dealing with an object or an array or +// null. + + case "object": + +// Due to a specification blunder in ECMAScript, typeof null is "object", +// so watch out for that case. + + if (!value) { + return "null"; + } + +// Make an array to hold the partial results of stringifying this object value. + + gap += indent; + partial = []; + +// Is the value an array? + + if (Object.prototype.toString.apply(value) === "[object Array]") { + +// The value is an array. Stringify every element. Use null as a placeholder +// for non-JSON values. + + length = value.length; + for (i = 0; i < length; i += 1) { + partial[i] = str(i, value) || "null"; + } + +// Join all of the elements together, separated with commas, and wrap them in +// brackets. + + v = partial.length === 0 + ? "[]" + : gap + ? "[\n" + gap + partial.join(",\n" + gap) + "\n" + mind + "]" + : "[" + partial.join(",") + "]"; + gap = mind; + return v; + } + +// If the replacer is an array, use it to select the members to be stringified. + + if (rep && typeof rep === "object") { + length = rep.length; + for (i = 0; i < length; i += 1) { + if (typeof rep[i] === "string") { + k = rep[i]; + v = str(k, value); + if (v) { + partial.push(quote(k) + ( + gap + ? ": " + : ":" + ) + v); + } + } + } + } else { + +// Otherwise, iterate through all of the keys in the object. + + for (k in value) { + if (Object.prototype.hasOwnProperty.call(value, k)) { + v = str(k, value); + if (v) { + partial.push(quote(k) + ( + gap + ? ": " + : ":" + ) + v); + } + } + } + } + +// Join all of the member texts together, separated with commas, +// and wrap them in braces. + + v = partial.length === 0 + ? "{}" + : gap + ? "{\n" + gap + partial.join(",\n" + gap) + "\n" + mind + "}" + : "{" + partial.join(",") + "}"; + gap = mind; + return v; + } + } + +// If the JSON object does not yet have a stringify method, give it one. + + if (typeof JSON.stringify !== "function") { + meta = { // table of character substitutions + "\b": "\\b", + "\t": "\\t", + "\n": "\\n", + "\f": "\\f", + "\r": "\\r", + "\"": "\\\"", + "\\": "\\\\" + }; + JSON.stringify = function (value, replacer, space) { + +// The stringify method takes a value and an optional replacer, and an optional +// space parameter, and returns a JSON text. The replacer can be a function +// that can replace values, or an array of strings that will select the keys. +// A default replacer method can be provided. Use of the space parameter can +// produce text that is more easily readable. + + var i; + gap = ""; + indent = ""; + +// If the space parameter is a number, make an indent string containing that +// many spaces. + + if (typeof space === "number") { + for (i = 0; i < space; i += 1) { + indent += " "; + } + +// If the space parameter is a string, it will be used as the indent string. + + } else if (typeof space === "string") { + indent = space; + } + +// If there is a replacer, it must be a function or an array. +// Otherwise, throw an error. + + rep = replacer; + if (replacer && typeof replacer !== "function" && + (typeof replacer !== "object" || + typeof replacer.length !== "number")) { + throw new Error("JSON.stringify"); + } + +// Make a fake root object containing our value under the key of "". +// Return the result of stringifying the value. + + return str("", {"": value}); + }; + } + + +// If the JSON object does not yet have a parse method, give it one. + + if (typeof JSON.parse !== "function") { + JSON.parse = function (text, reviver) { + +// The parse method takes a text and an optional reviver function, and returns +// a JavaScript value if the text is a valid JSON text. + + var j; + + function walk(holder, key) { + +// The walk method is used to recursively walk the resulting structure so +// that modifications can be made. + + var k; + var v; + var value = holder[key]; + if (value && typeof value === "object") { + for (k in value) { + if (Object.prototype.hasOwnProperty.call(value, k)) { + v = walk(value, k); + if (v !== undefined) { + value[k] = v; + } else { + delete value[k]; + } + } + } + } + return reviver.call(holder, key, value); + } + + +// Parsing happens in four stages. In the first stage, we replace certain +// Unicode characters with escape sequences. JavaScript handles many characters +// incorrectly, either silently deleting them, or treating them as line endings. + + text = String(text); + rx_dangerous.lastIndex = 0; + if (rx_dangerous.test(text)) { + text = text.replace(rx_dangerous, function (a) { + return "\\u" + + ("0000" + a.charCodeAt(0).toString(16)).slice(-4); + }); + } + +// In the second stage, we run the text against regular expressions that look +// for non-JSON patterns. We are especially concerned with "()" and "new" +// because they can cause invocation, and "=" because it can cause mutation. +// But just to be safe, we want to reject all unexpected forms. + +// We split the second stage into 4 regexp operations in order to work around +// crippling inefficiencies in IE's and Safari's regexp engines. First we +// replace the JSON backslash pairs with "@" (a non-JSON character). Second, we +// replace all simple value tokens with "]" characters. Third, we delete all +// open brackets that follow a colon or comma or that begin the text. Finally, +// we look to see that the remaining characters are only whitespace or "]" or +// "," or ":" or "{" or "}". If that is so, then the text is safe for eval. + + if ( + rx_one.test( + text + .replace(rx_two, "@") + .replace(rx_three, "]") + .replace(rx_four, "") + ) + ) { + +// In the third stage we use the eval function to compile the text into a +// JavaScript structure. The "{" operator is subject to a syntactic ambiguity +// in JavaScript: it can begin a block or an object literal. We wrap the text +// in parens to eliminate the ambiguity. + + j = eval("(" + text + ")"); + +// In the optional fourth stage, we recursively walk the new structure, passing +// each name/value pair to a reviver function for possible transformation. + + return (typeof reviver === "function") + ? walk({"": j}, "") + : j; + } + +// If the text is not JSON parseable, then a SyntaxError is thrown. + + throw new SyntaxError("JSON.parse"); + }; + } +}()); diff --git "a/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day18/source/day18/js/tools.js" "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day18/source/day18/js/tools.js" new file mode 100644 index 00000000..87257381 --- /dev/null +++ "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\346\272\220\347\240\201/day18/source/day18/js/tools.js" @@ -0,0 +1,135 @@ +//尝试创建一个可以执行简单动画的函数 +/* + * 参数: + * obj:要执行动画的对象 + * attr:要执行动画的样式,比如:left top width height + * target:执行动画的目标位置 + * speed:移动的速度(正数向右移动,负数向左移动) + * callback:回调函数,这个函数将会在动画执行完毕以后执行 + */ +function move(obj, attr, target, speed, callback) { + //关闭上一个定时器 + clearInterval(obj.timer); + + //获取元素目前的位置 + var current = parseInt(getStyle(obj, attr)); + + //判断速度的正负值 + //如果从0 向 800移动,则speed为正 + //如果从800向0移动,则speed为负 + if(current > target) { + //此时速度应为负值 + speed = -speed; + } + + //开启一个定时器,用来执行动画效果 + //向执行动画的对象中添加一个timer属性,用来保存它自己的定时器的标识 + obj.timer = setInterval(function() { + + //获取box1的原来的left值 + var oldValue = parseInt(getStyle(obj, attr)); + + //在旧值的基础上增加 + var newValue = oldValue + speed; + + //判断newValue是否大于800 + //从800 向 0移动 + //向左移动时,需要判断newValue是否小于target + //向右移动时,需要判断newValue是否大于target + if((speed < 0 && newValue < target) || (speed > 0 && newValue > target)) { + newValue = target; + } + + //将新值设置给box1 + obj.style[attr] = newValue + "px"; + + //当元素移动到0px时,使其停止执行动画 + if(newValue == target) { + //达到目标,关闭定时器 + clearInterval(obj.timer); + //动画执行完毕,调用回调函数 + callback && callback(); + } + + }, 30); +} + +/* + * 定义一个函数,用来获取指定元素的当前的样式 + * 参数: + * obj 要获取样式的元素 + * name 要获取的样式名 + */ +function getStyle(obj, name) { + + if(window.getComputedStyle) { + //正常浏览器的方式,具有getComputedStyle()方法 + return getComputedStyle(obj, null)[name]; + } else { + //IE8的方式,没有getComputedStyle()方法 + return obj.currentStyle[name]; + } + +} + +//定义一个函数,用来向一个元素中添加指定的class属性值 +/* + * 参数: + * obj 要添加class属性的元素 + * cn 要添加的class值 + * + */ +function addClass(obj, cn) { + + //检查obj中是否含有cn + if(!hasClass(obj, cn)) { + obj.className += " " + cn; + } + +} + +/* + * 判断一个元素中是否含有指定的class属性值 + * 如果有该class,则返回true,没有则返回false + * + */ +function hasClass(obj, cn) { + + //判断obj中有没有cn class + //创建一个正则表达式 + //var reg = /\bb2\b/; + var reg = new RegExp("\\b" + cn + "\\b"); + + return reg.test(obj.className); + +} + +/* + * 删除一个元素中的指定的class属性 + */ +function removeClass(obj, cn) { + //创建一个正则表达式 + var reg = new RegExp("\\b" + cn + "\\b"); + + //删除class + obj.className = obj.className.replace(reg, ""); + +} + +/* + * toggleClass可以用来切换一个类 + * 如果元素中具有该类,则删除 + * 如果元素中没有该类,则添加 + */ +function toggleClass(obj, cn) { + + //判断obj中是否含有cn + if(hasClass(obj, cn)) { + //有,则删除 + removeClass(obj, cn); + } else { + //没有,则添加 + addClass(obj, cn); + } + +} \ No newline at end of file diff --git "a/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\347\254\224\350\256\260/day05/note/javascript/github.jpg" "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\347\254\224\350\256\260/day05/note/javascript/github.jpg" new file mode 100644 index 00000000..9f92e79a Binary files /dev/null and "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\347\254\224\350\256\260/day05/note/javascript/github.jpg" differ diff --git "a/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\347\254\224\350\256\260/day05/note/javascript/tiobe.png" "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\347\254\224\350\256\260/day05/note/javascript/tiobe.png" new file mode 100644 index 00000000..f96c5ca1 Binary files /dev/null and "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\347\254\224\350\256\260/day05/note/javascript/tiobe.png" differ diff --git "a/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\347\254\224\350\256\260/day05/note/javascript/\346\211\223\351\243\236\346\234\272/img/boom.png" "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\347\254\224\350\256\260/day05/note/javascript/\346\211\223\351\243\236\346\234\272/img/boom.png" new file mode 100644 index 00000000..92fa48f4 Binary files /dev/null and "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\347\254\224\350\256\260/day05/note/javascript/\346\211\223\351\243\236\346\234\272/img/boom.png" differ diff --git "a/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\347\254\224\350\256\260/day05/note/javascript/\346\211\223\351\243\236\346\234\272/img/boom2.png" "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\347\254\224\350\256\260/day05/note/javascript/\346\211\223\351\243\236\346\234\272/img/boom2.png" new file mode 100644 index 00000000..c8820221 Binary files /dev/null and "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\347\254\224\350\256\260/day05/note/javascript/\346\211\223\351\243\236\346\234\272/img/boom2.png" differ diff --git "a/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\347\254\224\350\256\260/day05/note/javascript/\346\211\223\351\243\236\346\234\272/img/bullet.png" "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\347\254\224\350\256\260/day05/note/javascript/\346\211\223\351\243\236\346\234\272/img/bullet.png" new file mode 100644 index 00000000..9e791b5e Binary files /dev/null and "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\347\254\224\350\256\260/day05/note/javascript/\346\211\223\351\243\236\346\234\272/img/bullet.png" differ diff --git "a/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\347\254\224\350\256\260/day05/note/javascript/\346\211\223\351\243\236\346\234\272/img/enemy.png" "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\347\254\224\350\256\260/day05/note/javascript/\346\211\223\351\243\236\346\234\272/img/enemy.png" new file mode 100644 index 00000000..e83b5ca5 Binary files /dev/null and "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\347\254\224\350\256\260/day05/note/javascript/\346\211\223\351\243\236\346\234\272/img/enemy.png" differ diff --git "a/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\347\254\224\350\256\260/day05/note/javascript/\346\211\223\351\243\236\346\234\272/img/warcraft.png" "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\347\254\224\350\256\260/day05/note/javascript/\346\211\223\351\243\236\346\234\272/img/warcraft.png" new file mode 100644 index 00000000..277f105f Binary files /dev/null and "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\347\254\224\350\256\260/day05/note/javascript/\346\211\223\351\243\236\346\234\272/img/warcraft.png" differ diff --git "a/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\347\254\224\350\256\260/day05/note/javascript/\346\211\223\351\243\236\346\234\272/index.html" "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\347\254\224\350\256\260/day05/note/javascript/\346\211\223\351\243\236\346\234\272/index.html" new file mode 100644 index 00000000..2da20356 --- /dev/null +++ "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\347\254\224\350\256\260/day05/note/javascript/\346\211\223\351\243\236\346\234\272/index.html" @@ -0,0 +1,278 @@ + + + + +jQuery实现的牛逼打飞机-在线演示- + + + + + + +
+ + + + +
+ + +
+ + + \ No newline at end of file diff --git "a/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\347\254\224\350\256\260/day05/note/javascript/\346\211\223\351\243\236\346\234\272/js/jquery.min.js" "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\347\254\224\350\256\260/day05/note/javascript/\346\211\223\351\243\236\346\234\272/js/jquery.min.js" new file mode 100644 index 00000000..16ad06c5 --- /dev/null +++ "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\347\254\224\350\256\260/day05/note/javascript/\346\211\223\351\243\236\346\234\272/js/jquery.min.js" @@ -0,0 +1,4 @@ +/*! jQuery v1.7.2 jquery.com | jquery.org/license */ +(function(a,b){function cy(a){return f.isWindow(a)?a:a.nodeType===9?a.defaultView||a.parentWindow:!1}function cu(a){if(!cj[a]){var b=c.body,d=f("<"+a+">").appendTo(b),e=d.css("display");d.remove();if(e==="none"||e===""){ck||(ck=c.createElement("iframe"),ck.frameBorder=ck.width=ck.height=0),b.appendChild(ck);if(!cl||!ck.createElement)cl=(ck.contentWindow||ck.contentDocument).document,cl.write((f.support.boxModel?"":"")+""),cl.close();d=cl.createElement(a),cl.body.appendChild(d),e=f.css(d,"display"),b.removeChild(ck)}cj[a]=e}return cj[a]}function ct(a,b){var c={};f.each(cp.concat.apply([],cp.slice(0,b)),function(){c[this]=a});return c}function cs(){cq=b}function cr(){setTimeout(cs,0);return cq=f.now()}function ci(){try{return new a.ActiveXObject("Microsoft.XMLHTTP")}catch(b){}}function ch(){try{return new a.XMLHttpRequest}catch(b){}}function cb(a,c){a.dataFilter&&(c=a.dataFilter(c,a.dataType));var d=a.dataTypes,e={},g,h,i=d.length,j,k=d[0],l,m,n,o,p;for(g=1;g0){if(c!=="border")for(;e=0===c})}function S(a){return!a||!a.parentNode||a.parentNode.nodeType===11}function K(){return!0}function J(){return!1}function n(a,b,c){var d=b+"defer",e=b+"queue",g=b+"mark",h=f._data(a,d);h&&(c==="queue"||!f._data(a,e))&&(c==="mark"||!f._data(a,g))&&setTimeout(function(){!f._data(a,e)&&!f._data(a,g)&&(f.removeData(a,d,!0),h.fire())},0)}function m(a){for(var b in a){if(b==="data"&&f.isEmptyObject(a[b]))continue;if(b!=="toJSON")return!1}return!0}function l(a,c,d){if(d===b&&a.nodeType===1){var e="data-"+c.replace(k,"-$1").toLowerCase();d=a.getAttribute(e);if(typeof d=="string"){try{d=d==="true"?!0:d==="false"?!1:d==="null"?null:f.isNumeric(d)?+d:j.test(d)?f.parseJSON(d):d}catch(g){}f.data(a,c,d)}else d=b}return d}function h(a){var b=g[a]={},c,d;a=a.split(/\s+/);for(c=0,d=a.length;c)[^>]*$|#([\w\-]*)$)/,j=/\S/,k=/^\s+/,l=/\s+$/,m=/^<(\w+)\s*\/?>(?:<\/\1>)?$/,n=/^[\],:{}\s]*$/,o=/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,p=/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,q=/(?:^|:|,)(?:\s*\[)+/g,r=/(webkit)[ \/]([\w.]+)/,s=/(opera)(?:.*version)?[ \/]([\w.]+)/,t=/(msie) ([\w.]+)/,u=/(mozilla)(?:.*? rv:([\w.]+))?/,v=/-([a-z]|[0-9])/ig,w=/^-ms-/,x=function(a,b){return(b+"").toUpperCase()},y=d.userAgent,z,A,B,C=Object.prototype.toString,D=Object.prototype.hasOwnProperty,E=Array.prototype.push,F=Array.prototype.slice,G=String.prototype.trim,H=Array.prototype.indexOf,I={};e.fn=e.prototype={constructor:e,init:function(a,d,f){var g,h,j,k;if(!a)return this;if(a.nodeType){this.context=this[0]=a,this.length=1;return this}if(a==="body"&&!d&&c.body){this.context=c,this[0]=c.body,this.selector=a,this.length=1;return this}if(typeof a=="string"){a.charAt(0)!=="<"||a.charAt(a.length-1)!==">"||a.length<3?g=i.exec(a):g=[null,a,null];if(g&&(g[1]||!d)){if(g[1]){d=d instanceof e?d[0]:d,k=d?d.ownerDocument||d:c,j=m.exec(a),j?e.isPlainObject(d)?(a=[c.createElement(j[1])],e.fn.attr.call(a,d,!0)):a=[k.createElement(j[1])]:(j=e.buildFragment([g[1]],[k]),a=(j.cacheable?e.clone(j.fragment):j.fragment).childNodes);return e.merge(this,a)}h=c.getElementById(g[2]);if(h&&h.parentNode){if(h.id!==g[2])return f.find(a);this.length=1,this[0]=h}this.context=c,this.selector=a;return this}return!d||d.jquery?(d||f).find(a):this.constructor(d).find(a)}if(e.isFunction(a))return f.ready(a);a.selector!==b&&(this.selector=a.selector,this.context=a.context);return e.makeArray(a,this)},selector:"",jquery:"1.7.2",length:0,size:function(){return this.length},toArray:function(){return F.call(this,0)},get:function(a){return a==null?this.toArray():a<0?this[this.length+a]:this[a]},pushStack:function(a,b,c){var d=this.constructor();e.isArray(a)?E.apply(d,a):e.merge(d,a),d.prevObject=this,d.context=this.context,b==="find"?d.selector=this.selector+(this.selector?" ":"")+c:b&&(d.selector=this.selector+"."+b+"("+c+")");return d},each:function(a,b){return e.each(this,a,b)},ready:function(a){e.bindReady(),A.add(a);return this},eq:function(a){a=+a;return a===-1?this.slice(a):this.slice(a,a+1)},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},slice:function(){return this.pushStack(F.apply(this,arguments),"slice",F.call(arguments).join(","))},map:function(a){return this.pushStack(e.map(this,function(b,c){return a.call(b,c,b)}))},end:function(){return this.prevObject||this.constructor(null)},push:E,sort:[].sort,splice:[].splice},e.fn.init.prototype=e.fn,e.extend=e.fn.extend=function(){var a,c,d,f,g,h,i=arguments[0]||{},j=1,k=arguments.length,l=!1;typeof i=="boolean"&&(l=i,i=arguments[1]||{},j=2),typeof i!="object"&&!e.isFunction(i)&&(i={}),k===j&&(i=this,--j);for(;j0)return;A.fireWith(c,[e]),e.fn.trigger&&e(c).trigger("ready").off("ready")}},bindReady:function(){if(!A){A=e.Callbacks("once memory");if(c.readyState==="complete")return setTimeout(e.ready,1);if(c.addEventListener)c.addEventListener("DOMContentLoaded",B,!1),a.addEventListener("load",e.ready,!1);else if(c.attachEvent){c.attachEvent("onreadystatechange",B),a.attachEvent("onload",e.ready);var b=!1;try{b=a.frameElement==null}catch(d){}c.documentElement.doScroll&&b&&J()}}},isFunction:function(a){return e.type(a)==="function"},isArray:Array.isArray||function(a){return e.type(a)==="array"},isWindow:function(a){return a!=null&&a==a.window},isNumeric:function(a){return!isNaN(parseFloat(a))&&isFinite(a)},type:function(a){return a==null?String(a):I[C.call(a)]||"object"},isPlainObject:function(a){if(!a||e.type(a)!=="object"||a.nodeType||e.isWindow(a))return!1;try{if(a.constructor&&!D.call(a,"constructor")&&!D.call(a.constructor.prototype,"isPrototypeOf"))return!1}catch(c){return!1}var d;for(d in a);return d===b||D.call(a,d)},isEmptyObject:function(a){for(var b in a)return!1;return!0},error:function(a){throw new Error(a)},parseJSON:function(b){if(typeof b!="string"||!b)return null;b=e.trim(b);if(a.JSON&&a.JSON.parse)return a.JSON.parse(b);if(n.test(b.replace(o,"@").replace(p,"]").replace(q,"")))return(new Function("return "+b))();e.error("Invalid JSON: "+b)},parseXML:function(c){if(typeof c!="string"||!c)return null;var d,f;try{a.DOMParser?(f=new DOMParser,d=f.parseFromString(c,"text/xml")):(d=new ActiveXObject("Microsoft.XMLDOM"),d.async="false",d.loadXML(c))}catch(g){d=b}(!d||!d.documentElement||d.getElementsByTagName("parsererror").length)&&e.error("Invalid XML: "+c);return d},noop:function(){},globalEval:function(b){b&&j.test(b)&&(a.execScript||function(b){a.eval.call(a,b)})(b)},camelCase:function(a){return a.replace(w,"ms-").replace(v,x)},nodeName:function(a,b){return a.nodeName&&a.nodeName.toUpperCase()===b.toUpperCase()},each:function(a,c,d){var f,g=0,h=a.length,i=h===b||e.isFunction(a);if(d){if(i){for(f in a)if(c.apply(a[f],d)===!1)break}else for(;g0&&a[0]&&a[j-1]||j===0||e.isArray(a));if(k)for(;i1?i.call(arguments,0):b,j.notifyWith(k,e)}}function l(a){return function(c){b[a]=arguments.length>1?i.call(arguments,0):c,--g||j.resolveWith(j,b)}}var b=i.call(arguments,0),c=0,d=b.length,e=Array(d),g=d,h=d,j=d<=1&&a&&f.isFunction(a.promise)?a:f.Deferred(),k=j.promise();if(d>1){for(;c
a",d=p.getElementsByTagName("*"),e=p.getElementsByTagName("a")[0];if(!d||!d.length||!e)return{};g=c.createElement("select"),h=g.appendChild(c.createElement("option")),i=p.getElementsByTagName("input")[0],b={leadingWhitespace:p.firstChild.nodeType===3,tbody:!p.getElementsByTagName("tbody").length,htmlSerialize:!!p.getElementsByTagName("link").length,style:/top/.test(e.getAttribute("style")),hrefNormalized:e.getAttribute("href")==="/a",opacity:/^0.55/.test(e.style.opacity),cssFloat:!!e.style.cssFloat,checkOn:i.value==="on",optSelected:h.selected,getSetAttribute:p.className!=="t",enctype:!!c.createElement("form").enctype,html5Clone:c.createElement("nav").cloneNode(!0).outerHTML!=="<:nav>",submitBubbles:!0,changeBubbles:!0,focusinBubbles:!1,deleteExpando:!0,noCloneEvent:!0,inlineBlockNeedsLayout:!1,shrinkWrapBlocks:!1,reliableMarginRight:!0,pixelMargin:!0},f.boxModel=b.boxModel=c.compatMode==="CSS1Compat",i.checked=!0,b.noCloneChecked=i.cloneNode(!0).checked,g.disabled=!0,b.optDisabled=!h.disabled;try{delete p.test}catch(r){b.deleteExpando=!1}!p.addEventListener&&p.attachEvent&&p.fireEvent&&(p.attachEvent("onclick",function(){b.noCloneEvent=!1}),p.cloneNode(!0).fireEvent("onclick")),i=c.createElement("input"),i.value="t",i.setAttribute("type","radio"),b.radioValue=i.value==="t",i.setAttribute("checked","checked"),i.setAttribute("name","t"),p.appendChild(i),j=c.createDocumentFragment(),j.appendChild(p.lastChild),b.checkClone=j.cloneNode(!0).cloneNode(!0).lastChild.checked,b.appendChecked=i.checked,j.removeChild(i),j.appendChild(p);if(p.attachEvent)for(n in{submit:1,change:1,focusin:1})m="on"+n,o=m in p,o||(p.setAttribute(m,"return;"),o=typeof p[m]=="function"),b[n+"Bubbles"]=o;j.removeChild(p),j=g=h=p=i=null,f(function(){var d,e,g,h,i,j,l,m,n,q,r,s,t,u=c.getElementsByTagName("body")[0];!u||(m=1,t="padding:0;margin:0;border:",r="position:absolute;top:0;left:0;width:1px;height:1px;",s=t+"0;visibility:hidden;",n="style='"+r+t+"5px solid #000;",q="
"+""+"
",d=c.createElement("div"),d.style.cssText=s+"width:0;height:0;position:static;top:0;margin-top:"+m+"px",u.insertBefore(d,u.firstChild),p=c.createElement("div"),d.appendChild(p),p.innerHTML="
t
",k=p.getElementsByTagName("td"),o=k[0].offsetHeight===0,k[0].style.display="",k[1].style.display="none",b.reliableHiddenOffsets=o&&k[0].offsetHeight===0,a.getComputedStyle&&(p.innerHTML="",l=c.createElement("div"),l.style.width="0",l.style.marginRight="0",p.style.width="2px",p.appendChild(l),b.reliableMarginRight=(parseInt((a.getComputedStyle(l,null)||{marginRight:0}).marginRight,10)||0)===0),typeof p.style.zoom!="undefined"&&(p.innerHTML="",p.style.width=p.style.padding="1px",p.style.border=0,p.style.overflow="hidden",p.style.display="inline",p.style.zoom=1,b.inlineBlockNeedsLayout=p.offsetWidth===3,p.style.display="block",p.style.overflow="visible",p.innerHTML="
",b.shrinkWrapBlocks=p.offsetWidth!==3),p.style.cssText=r+s,p.innerHTML=q,e=p.firstChild,g=e.firstChild,i=e.nextSibling.firstChild.firstChild,j={doesNotAddBorder:g.offsetTop!==5,doesAddBorderForTableAndCells:i.offsetTop===5},g.style.position="fixed",g.style.top="20px",j.fixedPosition=g.offsetTop===20||g.offsetTop===15,g.style.position=g.style.top="",e.style.overflow="hidden",e.style.position="relative",j.subtractsBorderForOverflowNotVisible=g.offsetTop===-5,j.doesNotIncludeMarginInBodyOffset=u.offsetTop!==m,a.getComputedStyle&&(p.style.marginTop="1%",b.pixelMargin=(a.getComputedStyle(p,null)||{marginTop:0}).marginTop!=="1%"),typeof d.style.zoom!="undefined"&&(d.style.zoom=1),u.removeChild(d),l=p=d=null,f.extend(b,j))});return b}();var j=/^(?:\{.*\}|\[.*\])$/,k=/([A-Z])/g;f.extend({cache:{},uuid:0,expando:"jQuery"+(f.fn.jquery+Math.random()).replace(/\D/g,""),noData:{embed:!0,object:"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",applet:!0},hasData:function(a){a=a.nodeType?f.cache[a[f.expando]]:a[f.expando];return!!a&&!m(a)},data:function(a,c,d,e){if(!!f.acceptData(a)){var g,h,i,j=f.expando,k=typeof c=="string",l=a.nodeType,m=l?f.cache:a,n=l?a[j]:a[j]&&j,o=c==="events";if((!n||!m[n]||!o&&!e&&!m[n].data)&&k&&d===b)return;n||(l?a[j]=n=++f.uuid:n=j),m[n]||(m[n]={},l||(m[n].toJSON=f.noop));if(typeof c=="object"||typeof c=="function")e?m[n]=f.extend(m[n],c):m[n].data=f.extend(m[n].data,c);g=h=m[n],e||(h.data||(h.data={}),h=h.data),d!==b&&(h[f.camelCase(c)]=d);if(o&&!h[c])return g.events;k?(i=h[c],i==null&&(i=h[f.camelCase(c)])):i=h;return i}},removeData:function(a,b,c){if(!!f.acceptData(a)){var d,e,g,h=f.expando,i=a.nodeType,j=i?f.cache:a,k=i?a[h]:h;if(!j[k])return;if(b){d=c?j[k]:j[k].data;if(d){f.isArray(b)||(b in d?b=[b]:(b=f.camelCase(b),b in d?b=[b]:b=b.split(" ")));for(e=0,g=b.length;e1,null,!1)},removeData:function(a){return this.each(function(){f.removeData(this,a)})}}),f.extend({_mark:function(a,b){a&&(b=(b||"fx")+"mark",f._data(a,b,(f._data(a,b)||0)+1))},_unmark:function(a,b,c){a!==!0&&(c=b,b=a,a=!1);if(b){c=c||"fx";var d=c+"mark",e=a?0:(f._data(b,d)||1)-1;e?f._data(b,d,e):(f.removeData(b,d,!0),n(b,c,"mark"))}},queue:function(a,b,c){var d;if(a){b=(b||"fx")+"queue",d=f._data(a,b),c&&(!d||f.isArray(c)?d=f._data(a,b,f.makeArray(c)):d.push(c));return d||[]}},dequeue:function(a,b){b=b||"fx";var c=f.queue(a,b),d=c.shift(),e={};d==="inprogress"&&(d=c.shift()),d&&(b==="fx"&&c.unshift("inprogress"),f._data(a,b+".run",e),d.call(a,function(){f.dequeue(a,b)},e)),c.length||(f.removeData(a,b+"queue "+b+".run",!0),n(a,b,"queue"))}}),f.fn.extend({queue:function(a,c){var d=2;typeof a!="string"&&(c=a,a="fx",d--);if(arguments.length1)},removeAttr:function(a){return this.each(function(){f.removeAttr(this,a)})},prop:function(a,b){return f.access(this,f.prop,a,b,arguments.length>1)},removeProp:function(a){a=f.propFix[a]||a;return this.each(function(){try{this[a]=b,delete this[a]}catch(c){}})},addClass:function(a){var b,c,d,e,g,h,i;if(f.isFunction(a))return this.each(function(b){f(this).addClass(a.call(this,b,this.className))});if(a&&typeof a=="string"){b=a.split(p);for(c=0,d=this.length;c-1)return!0;return!1},val:function(a){var c,d,e,g=this[0];{if(!!arguments.length){e=f.isFunction(a);return this.each(function(d){var g=f(this),h;if(this.nodeType===1){e?h=a.call(this,d,g.val()):h=a,h==null?h="":typeof h=="number"?h+="":f.isArray(h)&&(h=f.map(h,function(a){return a==null?"":a+""})),c=f.valHooks[this.type]||f.valHooks[this.nodeName.toLowerCase()];if(!c||!("set"in c)||c.set(this,h,"value")===b)this.value=h}})}if(g){c=f.valHooks[g.type]||f.valHooks[g.nodeName.toLowerCase()];if(c&&"get"in c&&(d=c.get(g,"value"))!==b)return d;d=g.value;return typeof d=="string"?d.replace(q,""):d==null?"":d}}}}),f.extend({valHooks:{option:{get:function(a){var b=a.attributes.value;return!b||b.specified?a.value:a.text}},select:{get:function(a){var b,c,d,e,g=a.selectedIndex,h=[],i=a.options,j=a.type==="select-one";if(g<0)return null;c=j?g:0,d=j?g+1:i.length;for(;c=0}),c.length||(a.selectedIndex=-1);return c}}},attrFn:{val:!0,css:!0,html:!0,text:!0,data:!0,width:!0,height:!0,offset:!0},attr:function(a,c,d,e){var g,h,i,j=a.nodeType;if(!!a&&j!==3&&j!==8&&j!==2){if(e&&c in f.attrFn)return f(a)[c](d);if(typeof a.getAttribute=="undefined")return f.prop(a,c,d);i=j!==1||!f.isXMLDoc(a),i&&(c=c.toLowerCase(),h=f.attrHooks[c]||(u.test(c)?x:w));if(d!==b){if(d===null){f.removeAttr(a,c);return}if(h&&"set"in h&&i&&(g=h.set(a,d,c))!==b)return g;a.setAttribute(c,""+d);return d}if(h&&"get"in h&&i&&(g=h.get(a,c))!==null)return g;g=a.getAttribute(c);return g===null?b:g}},removeAttr:function(a,b){var c,d,e,g,h,i=0;if(b&&a.nodeType===1){d=b.toLowerCase().split(p),g=d.length;for(;i=0}})});var z=/^(?:textarea|input|select)$/i,A=/^([^\.]*)?(?:\.(.+))?$/,B=/(?:^|\s)hover(\.\S+)?\b/,C=/^key/,D=/^(?:mouse|contextmenu)|click/,E=/^(?:focusinfocus|focusoutblur)$/,F=/^(\w*)(?:#([\w\-]+))?(?:\.([\w\-]+))?$/,G=function( +a){var b=F.exec(a);b&&(b[1]=(b[1]||"").toLowerCase(),b[3]=b[3]&&new RegExp("(?:^|\\s)"+b[3]+"(?:\\s|$)"));return b},H=function(a,b){var c=a.attributes||{};return(!b[1]||a.nodeName.toLowerCase()===b[1])&&(!b[2]||(c.id||{}).value===b[2])&&(!b[3]||b[3].test((c["class"]||{}).value))},I=function(a){return f.event.special.hover?a:a.replace(B,"mouseenter$1 mouseleave$1")};f.event={add:function(a,c,d,e,g){var h,i,j,k,l,m,n,o,p,q,r,s;if(!(a.nodeType===3||a.nodeType===8||!c||!d||!(h=f._data(a)))){d.handler&&(p=d,d=p.handler,g=p.selector),d.guid||(d.guid=f.guid++),j=h.events,j||(h.events=j={}),i=h.handle,i||(h.handle=i=function(a){return typeof f!="undefined"&&(!a||f.event.triggered!==a.type)?f.event.dispatch.apply(i.elem,arguments):b},i.elem=a),c=f.trim(I(c)).split(" ");for(k=0;k=0&&(h=h.slice(0,-1),k=!0),h.indexOf(".")>=0&&(i=h.split("."),h=i.shift(),i.sort());if((!e||f.event.customEvent[h])&&!f.event.global[h])return;c=typeof c=="object"?c[f.expando]?c:new f.Event(h,c):new f.Event(h),c.type=h,c.isTrigger=!0,c.exclusive=k,c.namespace=i.join("."),c.namespace_re=c.namespace?new RegExp("(^|\\.)"+i.join("\\.(?:.*\\.)?")+"(\\.|$)"):null,o=h.indexOf(":")<0?"on"+h:"";if(!e){j=f.cache;for(l in j)j[l].events&&j[l].events[h]&&f.event.trigger(c,d,j[l].handle.elem,!0);return}c.result=b,c.target||(c.target=e),d=d!=null?f.makeArray(d):[],d.unshift(c),p=f.event.special[h]||{};if(p.trigger&&p.trigger.apply(e,d)===!1)return;r=[[e,p.bindType||h]];if(!g&&!p.noBubble&&!f.isWindow(e)){s=p.delegateType||h,m=E.test(s+h)?e:e.parentNode,n=null;for(;m;m=m.parentNode)r.push([m,s]),n=m;n&&n===e.ownerDocument&&r.push([n.defaultView||n.parentWindow||a,s])}for(l=0;le&&j.push({elem:this,matches:d.slice(e)});for(k=0;k0?this.on(b,null,a,c):this.trigger(b)},f.attrFn&&(f.attrFn[b]=!0),C.test(b)&&(f.event.fixHooks[b]=f.event.keyHooks),D.test(b)&&(f.event.fixHooks[b]=f.event.mouseHooks)}),function(){function x(a,b,c,e,f,g){for(var h=0,i=e.length;h0){k=j;break}}j=j[a]}e[h]=k}}}function w(a,b,c,e,f,g){for(var h=0,i=e.length;h+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g,d="sizcache"+(Math.random()+"").replace(".",""),e=0,g=Object.prototype.toString,h=!1,i=!0,j=/\\/g,k=/\r\n/g,l=/\W/;[0,0].sort(function(){i=!1;return 0});var m=function(b,d,e,f){e=e||[],d=d||c;var h=d;if(d.nodeType!==1&&d.nodeType!==9)return[];if(!b||typeof b!="string")return e;var i,j,k,l,n,q,r,t,u=!0,v=m.isXML(d),w=[],x=b;do{a.exec(""),i=a.exec(x);if(i){x=i[3],w.push(i[1]);if(i[2]){l=i[3];break}}}while(i);if(w.length>1&&p.exec(b))if(w.length===2&&o.relative[w[0]])j=y(w[0]+w[1],d,f);else{j=o.relative[w[0]]?[d]:m(w.shift(),d);while(w.length)b=w.shift(),o.relative[b]&&(b+=w.shift()),j=y(b,j,f)}else{!f&&w.length>1&&d.nodeType===9&&!v&&o.match.ID.test(w[0])&&!o.match.ID.test(w[w.length-1])&&(n=m.find(w.shift(),d,v),d=n.expr?m.filter(n.expr,n.set)[0]:n.set[0]);if(d){n=f?{expr:w.pop(),set:s(f)}:m.find(w.pop(),w.length===1&&(w[0]==="~"||w[0]==="+")&&d.parentNode?d.parentNode:d,v),j=n.expr?m.filter(n.expr,n.set):n.set,w.length>0?k=s(j):u=!1;while(w.length)q=w.pop(),r=q,o.relative[q]?r=w.pop():q="",r==null&&(r=d),o.relative[q](k,r,v)}else k=w=[]}k||(k=j),k||m.error(q||b);if(g.call(k)==="[object Array]")if(!u)e.push.apply(e,k);else if(d&&d.nodeType===1)for(t=0;k[t]!=null;t++)k[t]&&(k[t]===!0||k[t].nodeType===1&&m.contains(d,k[t]))&&e.push(j[t]);else for(t=0;k[t]!=null;t++)k[t]&&k[t].nodeType===1&&e.push(j[t]);else s(k,e);l&&(m(l,h,e,f),m.uniqueSort(e));return e};m.uniqueSort=function(a){if(u){h=i,a.sort(u);if(h)for(var b=1;b0},m.find=function(a,b,c){var d,e,f,g,h,i;if(!a)return[];for(e=0,f=o.order.length;e":function(a,b){var c,d=typeof b=="string",e=0,f=a.length;if(d&&!l.test(b)){b=b.toLowerCase();for(;e=0)?c||d.push(h):c&&(b[g]=!1));return!1},ID:function(a){return a[1].replace(j,"")},TAG:function(a,b){return a[1].replace(j,"").toLowerCase()},CHILD:function(a){if(a[1]==="nth"){a[2]||m.error(a[0]),a[2]=a[2].replace(/^\+|\s*/g,"");var b=/(-?)(\d*)(?:n([+\-]?\d*))?/.exec(a[2]==="even"&&"2n"||a[2]==="odd"&&"2n+1"||!/\D/.test(a[2])&&"0n+"+a[2]||a[2]);a[2]=b[1]+(b[2]||1)-0,a[3]=b[3]-0}else a[2]&&m.error(a[0]);a[0]=e++;return a},ATTR:function(a,b,c,d,e,f){var g=a[1]=a[1].replace(j,"");!f&&o.attrMap[g]&&(a[1]=o.attrMap[g]),a[4]=(a[4]||a[5]||"").replace(j,""),a[2]==="~="&&(a[4]=" "+a[4]+" ");return a},PSEUDO:function(b,c,d,e,f){if(b[1]==="not")if((a.exec(b[3])||"").length>1||/^\w/.test(b[3]))b[3]=m(b[3],null,null,c);else{var g=m.filter(b[3],c,d,!0^f);d||e.push.apply(e,g);return!1}else if(o.match.POS.test(b[0])||o.match.CHILD.test(b[0]))return!0;return b},POS:function(a){a.unshift(!0);return a}},filters:{enabled:function(a){return a.disabled===!1&&a.type!=="hidden"},disabled:function(a){return a.disabled===!0},checked:function(a){return a.checked===!0},selected:function(a){a.parentNode&&a.parentNode.selectedIndex;return a.selected===!0},parent:function(a){return!!a.firstChild},empty:function(a){return!a.firstChild},has:function(a,b,c){return!!m(c[3],a).length},header:function(a){return/h\d/i.test(a.nodeName)},text:function(a){var b=a.getAttribute("type"),c=a.type;return a.nodeName.toLowerCase()==="input"&&"text"===c&&(b===c||b===null)},radio:function(a){return a.nodeName.toLowerCase()==="input"&&"radio"===a.type},checkbox:function(a){return a.nodeName.toLowerCase()==="input"&&"checkbox"===a.type},file:function(a){return a.nodeName.toLowerCase()==="input"&&"file"===a.type},password:function(a){return a.nodeName.toLowerCase()==="input"&&"password"===a.type},submit:function(a){var b=a.nodeName.toLowerCase();return(b==="input"||b==="button")&&"submit"===a.type},image:function(a){return a.nodeName.toLowerCase()==="input"&&"image"===a.type},reset:function(a){var b=a.nodeName.toLowerCase();return(b==="input"||b==="button")&&"reset"===a.type},button:function(a){var b=a.nodeName.toLowerCase();return b==="input"&&"button"===a.type||b==="button"},input:function(a){return/input|select|textarea|button/i.test(a.nodeName)},focus:function(a){return a===a.ownerDocument.activeElement}},setFilters:{first:function(a,b){return b===0},last:function(a,b,c,d){return b===d.length-1},even:function(a,b){return b%2===0},odd:function(a,b){return b%2===1},lt:function(a,b,c){return bc[3]-0},nth:function(a,b,c){return c[3]-0===b},eq:function(a,b,c){return c[3]-0===b}},filter:{PSEUDO:function(a,b,c,d){var e=b[1],f=o.filters[e];if(f)return f(a,c,b,d);if(e==="contains")return(a.textContent||a.innerText||n([a])||"").indexOf(b[3])>=0;if(e==="not"){var g=b[3];for(var h=0,i=g.length;h=0}},ID:function(a,b){return a.nodeType===1&&a.getAttribute("id")===b},TAG:function(a,b){return b==="*"&&a.nodeType===1||!!a.nodeName&&a.nodeName.toLowerCase()===b},CLASS:function(a,b){return(" "+(a.className||a.getAttribute("class"))+" ").indexOf(b)>-1},ATTR:function(a,b){var c=b[1],d=m.attr?m.attr(a,c):o.attrHandle[c]?o.attrHandle[c](a):a[c]!=null?a[c]:a.getAttribute(c),e=d+"",f=b[2],g=b[4];return d==null?f==="!=":!f&&m.attr?d!=null:f==="="?e===g:f==="*="?e.indexOf(g)>=0:f==="~="?(" "+e+" ").indexOf(g)>=0:g?f==="!="?e!==g:f==="^="?e.indexOf(g)===0:f==="$="?e.substr(e.length-g.length)===g:f==="|="?e===g||e.substr(0,g.length+1)===g+"-":!1:e&&d!==!1},POS:function(a,b,c,d){var e=b[2],f=o.setFilters[e];if(f)return f(a,c,b,d)}}},p=o.match.POS,q=function(a,b){return"\\"+(b-0+1)};for(var r in o.match)o.match[r]=new RegExp(o.match[r].source+/(?![^\[]*\])(?![^\(]*\))/.source),o.leftMatch[r]=new RegExp(/(^(?:.|\r|\n)*?)/.source+o.match[r].source.replace(/\\(\d+)/g,q));o.match.globalPOS=p;var s=function(a,b){a=Array.prototype.slice.call(a,0);if(b){b.push.apply(b,a);return b}return a};try{Array.prototype.slice.call(c.documentElement.childNodes,0)[0].nodeType}catch(t){s=function(a,b){var c=0,d=b||[];if(g.call(a)==="[object Array]")Array.prototype.push.apply(d,a);else if(typeof a.length=="number")for(var e=a.length;c",e.insertBefore(a,e.firstChild),c.getElementById(d)&&(o.find.ID=function(a,c,d){if(typeof c.getElementById!="undefined"&&!d){var e=c.getElementById(a[1]);return e?e.id===a[1]||typeof e.getAttributeNode!="undefined"&&e.getAttributeNode("id").nodeValue===a[1]?[e]:b:[]}},o.filter.ID=function(a,b){var c=typeof a.getAttributeNode!="undefined"&&a.getAttributeNode("id");return a.nodeType===1&&c&&c.nodeValue===b}),e.removeChild(a),e=a=null}(),function(){var a=c.createElement("div");a.appendChild(c.createComment("")),a.getElementsByTagName("*").length>0&&(o.find.TAG=function(a,b){var c=b.getElementsByTagName(a[1]);if(a[1]==="*"){var d=[];for(var e=0;c[e];e++)c[e].nodeType===1&&d.push(c[e]);c=d}return c}),a.innerHTML="",a.firstChild&&typeof a.firstChild.getAttribute!="undefined"&&a.firstChild.getAttribute("href")!=="#"&&(o.attrHandle.href=function(a){return a.getAttribute("href",2)}),a=null}(),c.querySelectorAll&&function(){var a=m,b=c.createElement("div"),d="__sizzle__";b.innerHTML="

";if(!b.querySelectorAll||b.querySelectorAll(".TEST").length!==0){m=function(b,e,f,g){e=e||c;if(!g&&!m.isXML(e)){var h=/^(\w+$)|^\.([\w\-]+$)|^#([\w\-]+$)/.exec(b);if(h&&(e.nodeType===1||e.nodeType===9)){if(h[1])return s(e.getElementsByTagName(b),f);if(h[2]&&o.find.CLASS&&e.getElementsByClassName)return s(e.getElementsByClassName(h[2]),f)}if(e.nodeType===9){if(b==="body"&&e.body)return s([e.body],f);if(h&&h[3]){var i=e.getElementById(h[3]);if(!i||!i.parentNode)return s([],f);if(i.id===h[3])return s([i],f)}try{return s(e.querySelectorAll(b),f)}catch(j){}}else if(e.nodeType===1&&e.nodeName.toLowerCase()!=="object"){var k=e,l=e.getAttribute("id"),n=l||d,p=e.parentNode,q=/^\s*[+~]/.test(b);l?n=n.replace(/'/g,"\\$&"):e.setAttribute("id",n),q&&p&&(e=e.parentNode);try{if(!q||p)return s(e.querySelectorAll("[id='"+n+"'] "+b),f)}catch(r){}finally{l||k.removeAttribute("id")}}}return a(b,e,f,g)};for(var e in a)m[e]=a[e];b=null}}(),function(){var a=c.documentElement,b=a.matchesSelector||a.mozMatchesSelector||a.webkitMatchesSelector||a.msMatchesSelector;if(b){var d=!b.call(c.createElement("div"),"div"),e=!1;try{b.call(c.documentElement,"[test!='']:sizzle")}catch(f){e=!0}m.matchesSelector=function(a,c){c=c.replace(/\=\s*([^'"\]]*)\s*\]/g,"='$1']");if(!m.isXML(a))try{if(e||!o.match.PSEUDO.test(c)&&!/!=/.test(c)){var f=b.call(a,c);if(f||!d||a.document&&a.document.nodeType!==11)return f}}catch(g){}return m(c,null,null,[a]).length>0}}}(),function(){var a=c.createElement("div");a.innerHTML="
";if(!!a.getElementsByClassName&&a.getElementsByClassName("e").length!==0){a.lastChild.className="e";if(a.getElementsByClassName("e").length===1)return;o.order.splice(1,0,"CLASS"),o.find.CLASS=function(a,b,c){if(typeof b.getElementsByClassName!="undefined"&&!c)return b.getElementsByClassName(a[1])},a=null}}(),c.documentElement.contains?m.contains=function(a,b){return a!==b&&(a.contains?a.contains(b):!0)}:c.documentElement.compareDocumentPosition?m.contains=function(a,b){return!!(a.compareDocumentPosition(b)&16)}:m.contains=function(){return!1},m.isXML=function(a){var b=(a?a.ownerDocument||a:0).documentElement;return b?b.nodeName!=="HTML":!1};var y=function(a,b,c){var d,e=[],f="",g=b.nodeType?[b]:b;while(d=o.match.PSEUDO.exec(a))f+=d[0],a=a.replace(o.match.PSEUDO,"");a=o.relative[a]?a+"*":a;for(var h=0,i=g.length;h0)for(h=g;h=0:f.filter(a,this).length>0:this.filter(a).length>0)},closest:function(a,b){var c=[],d,e,g=this[0];if(f.isArray(a)){var h=1;while(g&&g.ownerDocument&&g!==b){for(d=0;d-1:f.find.matchesSelector(g,a)){c.push(g);break}g=g.parentNode;if(!g||!g.ownerDocument||g===b||g.nodeType===11)break}}c=c.length>1?f.unique(c):c;return this.pushStack(c,"closest",a)},index:function(a){if(!a)return this[0]&&this[0].parentNode?this.prevAll().length:-1;if(typeof a=="string")return f.inArray(this[0],f(a));return f.inArray(a.jquery?a[0]:a,this)},add:function(a,b){var c=typeof a=="string"?f(a,b):f.makeArray(a&&a.nodeType?[a]:a),d=f.merge(this.get(),c);return this.pushStack(S(c[0])||S(d[0])?d:f.unique(d))},andSelf:function(){return this.add(this.prevObject)}}),f.each({parent:function(a){var b=a.parentNode;return b&&b.nodeType!==11?b:null},parents:function(a){return f.dir(a,"parentNode")},parentsUntil:function(a,b,c){return f.dir(a,"parentNode",c)},next:function(a){return f.nth(a,2,"nextSibling")},prev:function(a){return f.nth(a,2,"previousSibling")},nextAll:function(a){return f.dir(a,"nextSibling")},prevAll:function(a){return f.dir(a,"previousSibling")},nextUntil:function(a,b,c){return f.dir(a,"nextSibling",c)},prevUntil:function(a,b,c){return f.dir(a,"previousSibling",c)},siblings:function(a){return f.sibling((a.parentNode||{}).firstChild,a)},children:function(a){return f.sibling(a.firstChild)},contents:function(a){return f.nodeName(a,"iframe")?a.contentDocument||a.contentWindow.document:f.makeArray(a.childNodes)}},function(a,b){f.fn[a]=function(c,d){var e=f.map(this,b,c);L.test(a)||(d=c),d&&typeof d=="string"&&(e=f.filter(d,e)),e=this.length>1&&!R[a]?f.unique(e):e,(this.length>1||N.test(d))&&M.test(a)&&(e=e.reverse());return this.pushStack(e,a,P.call(arguments).join(","))}}),f.extend({filter:function(a,b,c){c&&(a=":not("+a+")");return b.length===1?f.find.matchesSelector(b[0],a)?[b[0]]:[]:f.find.matches(a,b)},dir:function(a,c,d){var e=[],g=a[c];while(g&&g.nodeType!==9&&(d===b||g.nodeType!==1||!f(g).is(d)))g.nodeType===1&&e.push(g),g=g[c];return e},nth:function(a,b,c,d){b=b||1;var e=0;for(;a;a=a[c])if(a.nodeType===1&&++e===b)break;return a},sibling:function(a,b){var c=[];for(;a;a=a.nextSibling)a.nodeType===1&&a!==b&&c.push(a);return c}});var V="abbr|article|aside|audio|bdi|canvas|data|datalist|details|figcaption|figure|footer|header|hgroup|mark|meter|nav|output|progress|section|summary|time|video",W=/ jQuery\d+="(?:\d+|null)"/g,X=/^\s+/,Y=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/ig,Z=/<([\w:]+)/,$=/]","i"),bd=/checked\s*(?:[^=]|=\s*.checked.)/i,be=/\/(java|ecma)script/i,bf=/^\s*",""],legend:[1,"
","
"],thead:[1,"","
"],tr:[2,"","
"],td:[3,"","
"],col:[2,"","
"],area:[1,"",""],_default:[0,"",""]},bh=U(c);bg.optgroup=bg.option,bg.tbody=bg.tfoot=bg.colgroup=bg.caption=bg.thead,bg.th=bg.td,f.support.htmlSerialize||(bg._default=[1,"div
","
"]),f.fn.extend({text:function(a){return f.access(this,function(a){return a===b?f.text(this):this.empty().append((this[0]&&this[0].ownerDocument||c).createTextNode(a))},null,a,arguments.length)},wrapAll:function(a){if(f.isFunction(a))return this.each(function(b){f(this).wrapAll(a.call(this,b))});if(this[0]){var b=f(a,this[0].ownerDocument).eq(0).clone(!0);this[0].parentNode&&b.insertBefore(this[0]),b.map(function(){var a=this;while(a.firstChild&&a.firstChild.nodeType===1)a=a.firstChild;return a}).append(this)}return this},wrapInner:function(a){if(f.isFunction(a))return this.each(function(b){f(this).wrapInner(a.call(this,b))});return this.each(function(){var b=f(this),c=b.contents();c.length?c.wrapAll(a):b.append(a)})},wrap:function(a){var b=f.isFunction(a);return this.each(function(c){f(this).wrapAll(b?a.call(this,c):a)})},unwrap:function(){return this.parent().each(function(){f.nodeName(this,"body")||f(this).replaceWith(this.childNodes)}).end()},append:function(){return this.domManip(arguments,!0,function(a){this.nodeType===1&&this.appendChild(a)})},prepend:function(){return this.domManip(arguments,!0,function(a){this.nodeType===1&&this.insertBefore(a,this.firstChild)})},before:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,!1,function(a){this.parentNode.insertBefore(a,this)});if(arguments.length){var a=f +.clean(arguments);a.push.apply(a,this.toArray());return this.pushStack(a,"before",arguments)}},after:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,!1,function(a){this.parentNode.insertBefore(a,this.nextSibling)});if(arguments.length){var a=this.pushStack(this,"after",arguments);a.push.apply(a,f.clean(arguments));return a}},remove:function(a,b){for(var c=0,d;(d=this[c])!=null;c++)if(!a||f.filter(a,[d]).length)!b&&d.nodeType===1&&(f.cleanData(d.getElementsByTagName("*")),f.cleanData([d])),d.parentNode&&d.parentNode.removeChild(d);return this},empty:function(){for(var a=0,b;(b=this[a])!=null;a++){b.nodeType===1&&f.cleanData(b.getElementsByTagName("*"));while(b.firstChild)b.removeChild(b.firstChild)}return this},clone:function(a,b){a=a==null?!1:a,b=b==null?a:b;return this.map(function(){return f.clone(this,a,b)})},html:function(a){return f.access(this,function(a){var c=this[0]||{},d=0,e=this.length;if(a===b)return c.nodeType===1?c.innerHTML.replace(W,""):null;if(typeof a=="string"&&!ba.test(a)&&(f.support.leadingWhitespace||!X.test(a))&&!bg[(Z.exec(a)||["",""])[1].toLowerCase()]){a=a.replace(Y,"<$1>");try{for(;d1&&l0?this.clone(!0):this).get();f(e[h])[b](j),d=d.concat(j)}return this.pushStack(d,a,e.selector)}}),f.extend({clone:function(a,b,c){var d,e,g,h=f.support.html5Clone||f.isXMLDoc(a)||!bc.test("<"+a.nodeName+">")?a.cloneNode(!0):bo(a);if((!f.support.noCloneEvent||!f.support.noCloneChecked)&&(a.nodeType===1||a.nodeType===11)&&!f.isXMLDoc(a)){bk(a,h),d=bl(a),e=bl(h);for(g=0;d[g];++g)e[g]&&bk(d[g],e[g])}if(b){bj(a,h);if(c){d=bl(a),e=bl(h);for(g=0;d[g];++g)bj(d[g],e[g])}}d=e=null;return h},clean:function(a,b,d,e){var g,h,i,j=[];b=b||c,typeof b.createElement=="undefined"&&(b=b.ownerDocument||b[0]&&b[0].ownerDocument||c);for(var k=0,l;(l=a[k])!=null;k++){typeof l=="number"&&(l+="");if(!l)continue;if(typeof l=="string")if(!_.test(l))l=b.createTextNode(l);else{l=l.replace(Y,"<$1>");var m=(Z.exec(l)||["",""])[1].toLowerCase(),n=bg[m]||bg._default,o=n[0],p=b.createElement("div"),q=bh.childNodes,r;b===c?bh.appendChild(p):U(b).appendChild(p),p.innerHTML=n[1]+l+n[2];while(o--)p=p.lastChild;if(!f.support.tbody){var s=$.test(l),t=m==="table"&&!s?p.firstChild&&p.firstChild.childNodes:n[1]===""&&!s?p.childNodes:[];for(i=t.length-1;i>=0;--i)f.nodeName(t[i],"tbody")&&!t[i].childNodes.length&&t[i].parentNode.removeChild(t[i])}!f.support.leadingWhitespace&&X.test(l)&&p.insertBefore(b.createTextNode(X.exec(l)[0]),p.firstChild),l=p.childNodes,p&&(p.parentNode.removeChild(p),q.length>0&&(r=q[q.length-1],r&&r.parentNode&&r.parentNode.removeChild(r)))}var u;if(!f.support.appendChecked)if(l[0]&&typeof (u=l.length)=="number")for(i=0;i1)},f.extend({cssHooks:{opacity:{get:function(a,b){if(b){var c=by(a,"opacity");return c===""?"1":c}return a.style.opacity}}},cssNumber:{fillOpacity:!0,fontWeight:!0,lineHeight:!0,opacity:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0},cssProps:{"float":f.support.cssFloat?"cssFloat":"styleFloat"},style:function(a,c,d,e){if(!!a&&a.nodeType!==3&&a.nodeType!==8&&!!a.style){var g,h,i=f.camelCase(c),j=a.style,k=f.cssHooks[i];c=f.cssProps[i]||i;if(d===b){if(k&&"get"in k&&(g=k.get(a,!1,e))!==b)return g;return j[c]}h=typeof d,h==="string"&&(g=bu.exec(d))&&(d=+(g[1]+1)*+g[2]+parseFloat(f.css(a,c)),h="number");if(d==null||h==="number"&&isNaN(d))return;h==="number"&&!f.cssNumber[i]&&(d+="px");if(!k||!("set"in k)||(d=k.set(a,d))!==b)try{j[c]=d}catch(l){}}},css:function(a,c,d){var e,g;c=f.camelCase(c),g=f.cssHooks[c],c=f.cssProps[c]||c,c==="cssFloat"&&(c="float");if(g&&"get"in g&&(e=g.get(a,!0,d))!==b)return e;if(by)return by(a,c)},swap:function(a,b,c){var d={},e,f;for(f in b)d[f]=a.style[f],a.style[f]=b[f];e=c.call(a);for(f in b)a.style[f]=d[f];return e}}),f.curCSS=f.css,c.defaultView&&c.defaultView.getComputedStyle&&(bz=function(a,b){var c,d,e,g,h=a.style;b=b.replace(br,"-$1").toLowerCase(),(d=a.ownerDocument.defaultView)&&(e=d.getComputedStyle(a,null))&&(c=e.getPropertyValue(b),c===""&&!f.contains(a.ownerDocument.documentElement,a)&&(c=f.style(a,b))),!f.support.pixelMargin&&e&&bv.test(b)&&bt.test(c)&&(g=h.width,h.width=c,c=e.width,h.width=g);return c}),c.documentElement.currentStyle&&(bA=function(a,b){var c,d,e,f=a.currentStyle&&a.currentStyle[b],g=a.style;f==null&&g&&(e=g[b])&&(f=e),bt.test(f)&&(c=g.left,d=a.runtimeStyle&&a.runtimeStyle.left,d&&(a.runtimeStyle.left=a.currentStyle.left),g.left=b==="fontSize"?"1em":f,f=g.pixelLeft+"px",g.left=c,d&&(a.runtimeStyle.left=d));return f===""?"auto":f}),by=bz||bA,f.each(["height","width"],function(a,b){f.cssHooks[b]={get:function(a,c,d){if(c)return a.offsetWidth!==0?bB(a,b,d):f.swap(a,bw,function(){return bB(a,b,d)})},set:function(a,b){return bs.test(b)?b+"px":b}}}),f.support.opacity||(f.cssHooks.opacity={get:function(a,b){return bq.test((b&&a.currentStyle?a.currentStyle.filter:a.style.filter)||"")?parseFloat(RegExp.$1)/100+"":b?"1":""},set:function(a,b){var c=a.style,d=a.currentStyle,e=f.isNumeric(b)?"alpha(opacity="+b*100+")":"",g=d&&d.filter||c.filter||"";c.zoom=1;if(b>=1&&f.trim(g.replace(bp,""))===""){c.removeAttribute("filter");if(d&&!d.filter)return}c.filter=bp.test(g)?g.replace(bp,e):g+" "+e}}),f(function(){f.support.reliableMarginRight||(f.cssHooks.marginRight={get:function(a,b){return f.swap(a,{display:"inline-block"},function(){return b?by(a,"margin-right"):a.style.marginRight})}})}),f.expr&&f.expr.filters&&(f.expr.filters.hidden=function(a){var b=a.offsetWidth,c=a.offsetHeight;return b===0&&c===0||!f.support.reliableHiddenOffsets&&(a.style&&a.style.display||f.css(a,"display"))==="none"},f.expr.filters.visible=function(a){return!f.expr.filters.hidden(a)}),f.each({margin:"",padding:"",border:"Width"},function(a,b){f.cssHooks[a+b]={expand:function(c){var d,e=typeof c=="string"?c.split(" "):[c],f={};for(d=0;d<4;d++)f[a+bx[d]+b]=e[d]||e[d-2]||e[0];return f}}});var bC=/%20/g,bD=/\[\]$/,bE=/\r?\n/g,bF=/#.*$/,bG=/^(.*?):[ \t]*([^\r\n]*)\r?$/mg,bH=/^(?:color|date|datetime|datetime-local|email|hidden|month|number|password|range|search|tel|text|time|url|week)$/i,bI=/^(?:about|app|app\-storage|.+\-extension|file|res|widget):$/,bJ=/^(?:GET|HEAD)$/,bK=/^\/\//,bL=/\?/,bM=/)<[^<]*)*<\/script>/gi,bN=/^(?:select|textarea)/i,bO=/\s+/,bP=/([?&])_=[^&]*/,bQ=/^([\w\+\.\-]+:)(?:\/\/([^\/?#:]*)(?::(\d+))?)?/,bR=f.fn.load,bS={},bT={},bU,bV,bW=["*/"]+["*"];try{bU=e.href}catch(bX){bU=c.createElement("a"),bU.href="",bU=bU.href}bV=bQ.exec(bU.toLowerCase())||[],f.fn.extend({load:function(a,c,d){if(typeof a!="string"&&bR)return bR.apply(this,arguments);if(!this.length)return this;var e=a.indexOf(" ");if(e>=0){var g=a.slice(e,a.length);a=a.slice(0,e)}var h="GET";c&&(f.isFunction(c)?(d=c,c=b):typeof c=="object"&&(c=f.param(c,f.ajaxSettings.traditional),h="POST"));var i=this;f.ajax({url:a,type:h,dataType:"html",data:c,complete:function(a,b,c){c=a.responseText,a.isResolved()&&(a.done(function(a){c=a}),i.html(g?f("
").append(c.replace(bM,"")).find(g):c)),d&&i.each(d,[c,b,a])}});return this},serialize:function(){return f.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?f.makeArray(this.elements):this}).filter(function(){return this.name&&!this.disabled&&(this.checked||bN.test(this.nodeName)||bH.test(this.type))}).map(function(a,b){var c=f(this).val();return c==null?null:f.isArray(c)?f.map(c,function(a,c){return{name:b.name,value:a.replace(bE,"\r\n")}}):{name:b.name,value:c.replace(bE,"\r\n")}}).get()}}),f.each("ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split(" "),function(a,b){f.fn[b]=function(a){return this.on(b,a)}}),f.each(["get","post"],function(a,c){f[c]=function(a,d,e,g){f.isFunction(d)&&(g=g||e,e=d,d=b);return f.ajax({type:c,url:a,data:d,success:e,dataType:g})}}),f.extend({getScript:function(a,c){return f.get(a,b,c,"script")},getJSON:function(a,b,c){return f.get(a,b,c,"json")},ajaxSetup:function(a,b){b?b$(a,f.ajaxSettings):(b=a,a=f.ajaxSettings),b$(a,b);return a},ajaxSettings:{url:bU,isLocal:bI.test(bV[1]),global:!0,type:"GET",contentType:"application/x-www-form-urlencoded; charset=UTF-8",processData:!0,async:!0,accepts:{xml:"application/xml, text/xml",html:"text/html",text:"text/plain",json:"application/json, text/javascript","*":bW},contents:{xml:/xml/,html:/html/,json:/json/},responseFields:{xml:"responseXML",text:"responseText"},converters:{"* text":a.String,"text html":!0,"text json":f.parseJSON,"text xml":f.parseXML},flatOptions:{context:!0,url:!0}},ajaxPrefilter:bY(bS),ajaxTransport:bY(bT),ajax:function(a,c){function w(a,c,l,m){if(s!==2){s=2,q&&clearTimeout(q),p=b,n=m||"",v.readyState=a>0?4:0;var o,r,u,w=c,x=l?ca(d,v,l):b,y,z;if(a>=200&&a<300||a===304){if(d.ifModified){if(y=v.getResponseHeader("Last-Modified"))f.lastModified[k]=y;if(z=v.getResponseHeader("Etag"))f.etag[k]=z}if(a===304)w="notmodified",o=!0;else try{r=cb(d,x),w="success",o=!0}catch(A){w="parsererror",u=A}}else{u=w;if(!w||a)w="error",a<0&&(a=0)}v.status=a,v.statusText=""+(c||w),o?h.resolveWith(e,[r,w,v]):h.rejectWith(e,[v,w,u]),v.statusCode(j),j=b,t&&g.trigger("ajax"+(o?"Success":"Error"),[v,d,o?r:u]),i.fireWith(e,[v,w]),t&&(g.trigger("ajaxComplete",[v,d]),--f.active||f.event.trigger("ajaxStop"))}}typeof a=="object"&&(c=a,a=b),c=c||{};var d=f.ajaxSetup({},c),e=d.context||d,g=e!==d&&(e.nodeType||e instanceof f)?f(e):f.event,h=f.Deferred(),i=f.Callbacks("once memory"),j=d.statusCode||{},k,l={},m={},n,o,p,q,r,s=0,t,u,v={readyState:0,setRequestHeader:function(a,b){if(!s){var c=a.toLowerCase();a=m[c]=m[c]||a,l[a]=b}return this},getAllResponseHeaders:function(){return s===2?n:null},getResponseHeader:function(a){var c;if(s===2){if(!o){o={};while(c=bG.exec(n))o[c[1].toLowerCase()]=c[2]}c=o[a.toLowerCase()]}return c===b?null:c},overrideMimeType:function(a){s||(d.mimeType=a);return this},abort:function(a){a=a||"abort",p&&p.abort(a),w(0,a);return this}};h.promise(v),v.success=v.done,v.error=v.fail,v.complete=i.add,v.statusCode=function(a){if(a){var b;if(s<2)for(b in a)j[b]=[j[b],a[b]];else b=a[v.status],v.then(b,b)}return this},d.url=((a||d.url)+"").replace(bF,"").replace(bK,bV[1]+"//"),d.dataTypes=f.trim(d.dataType||"*").toLowerCase().split(bO),d.crossDomain==null&&(r=bQ.exec(d.url.toLowerCase()),d.crossDomain=!(!r||r[1]==bV[1]&&r[2]==bV[2]&&(r[3]||(r[1]==="http:"?80:443))==(bV[3]||(bV[1]==="http:"?80:443)))),d.data&&d.processData&&typeof d.data!="string"&&(d.data=f.param(d.data,d.traditional)),bZ(bS,d,c,v);if(s===2)return!1;t=d.global,d.type=d.type.toUpperCase(),d.hasContent=!bJ.test(d.type),t&&f.active++===0&&f.event.trigger("ajaxStart");if(!d.hasContent){d.data&&(d.url+=(bL.test(d.url)?"&":"?")+d.data,delete d.data),k=d.url;if(d.cache===!1){var x=f.now(),y=d.url.replace(bP,"$1_="+x);d.url=y+(y===d.url?(bL.test(d.url)?"&":"?")+"_="+x:"")}}(d.data&&d.hasContent&&d.contentType!==!1||c.contentType)&&v.setRequestHeader("Content-Type",d.contentType),d.ifModified&&(k=k||d.url,f.lastModified[k]&&v.setRequestHeader("If-Modified-Since",f.lastModified[k]),f.etag[k]&&v.setRequestHeader("If-None-Match",f.etag[k])),v.setRequestHeader("Accept",d.dataTypes[0]&&d.accepts[d.dataTypes[0]]?d.accepts[d.dataTypes[0]]+(d.dataTypes[0]!=="*"?", "+bW+"; q=0.01":""):d.accepts["*"]);for(u in d.headers)v.setRequestHeader(u,d.headers[u]);if(d.beforeSend&&(d.beforeSend.call(e,v,d)===!1||s===2)){v.abort();return!1}for(u in{success:1,error:1,complete:1})v[u](d[u]);p=bZ(bT,d,c,v);if(!p)w(-1,"No Transport");else{v.readyState=1,t&&g.trigger("ajaxSend",[v,d]),d.async&&d.timeout>0&&(q=setTimeout(function(){v.abort("timeout")},d.timeout));try{s=1,p.send(l,w)}catch(z){if(s<2)w(-1,z);else throw z}}return v},param:function(a,c){var d=[],e=function(a,b){b=f.isFunction(b)?b():b,d[d.length]=encodeURIComponent(a)+"="+encodeURIComponent(b)};c===b&&(c=f.ajaxSettings.traditional);if(f.isArray(a)||a.jquery&&!f.isPlainObject(a))f.each(a,function(){e(this.name,this.value)});else for(var g in a)b_(g,a[g],c,e);return d.join("&").replace(bC,"+")}}),f.extend({active:0,lastModified:{},etag:{}});var cc=f.now(),cd=/(\=)\?(&|$)|\?\?/i;f.ajaxSetup({jsonp:"callback",jsonpCallback:function(){return f.expando+"_"+cc++}}),f.ajaxPrefilter("json jsonp",function(b,c,d){var e=typeof b.data=="string"&&/^application\/x\-www\-form\-urlencoded/.test(b.contentType);if(b.dataTypes[0]==="jsonp"||b.jsonp!==!1&&(cd.test(b.url)||e&&cd.test(b.data))){var g,h=b.jsonpCallback=f.isFunction(b.jsonpCallback)?b.jsonpCallback():b.jsonpCallback,i=a[h],j=b.url,k=b.data,l="$1"+h+"$2";b.jsonp!==!1&&(j=j.replace(cd,l),b.url===j&&(e&&(k=k.replace(cd,l)),b.data===k&&(j+=(/\?/.test(j)?"&":"?")+b.jsonp+"="+h))),b.url=j,b.data=k,a[h]=function(a){g=[a]},d.always(function(){a[h]=i,g&&f.isFunction(i)&&a[h](g[0])}),b.converters["script json"]=function(){g||f.error(h+" was not called");return g[0]},b.dataTypes[0]="json";return"script"}}),f.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/javascript|ecmascript/},converters:{"text script":function(a){f.globalEval(a);return a}}}),f.ajaxPrefilter("script",function(a){a.cache===b&&(a.cache=!1),a.crossDomain&&(a.type="GET",a.global=!1)}),f.ajaxTransport("script",function(a){if(a.crossDomain){var d,e=c.head||c.getElementsByTagName("head")[0]||c.documentElement;return{send:function(f,g){d=c.createElement("script"),d.async="async",a.scriptCharset&&(d.charset=a.scriptCharset),d.src=a.url,d.onload=d.onreadystatechange=function(a,c){if(c||!d.readyState||/loaded|complete/.test(d.readyState))d.onload=d.onreadystatechange=null,e&&d.parentNode&&e.removeChild(d),d=b,c||g(200,"success")},e.insertBefore(d,e.firstChild)},abort:function(){d&&d.onload(0,1)}}}});var ce=a.ActiveXObject?function(){for(var a in cg)cg[a](0,1)}:!1,cf=0,cg;f.ajaxSettings.xhr=a.ActiveXObject?function(){return!this.isLocal&&ch()||ci()}:ch,function(a){f.extend(f.support,{ajax:!!a,cors:!!a&&"withCredentials"in a})}(f.ajaxSettings.xhr()),f.support.ajax&&f.ajaxTransport(function(c){if(!c.crossDomain||f.support.cors){var d;return{send:function(e,g){var h=c.xhr(),i,j;c.username?h.open(c.type,c.url,c.async,c.username,c.password):h.open(c.type,c.url,c.async);if(c.xhrFields)for(j in c.xhrFields)h[j]=c.xhrFields[j];c.mimeType&&h.overrideMimeType&&h.overrideMimeType(c.mimeType),!c.crossDomain&&!e["X-Requested-With"]&&(e["X-Requested-With"]="XMLHttpRequest");try{for(j in e)h.setRequestHeader(j,e[j])}catch(k){}h.send(c.hasContent&&c.data||null),d=function(a,e){var j,k,l,m,n;try{if(d&&(e||h.readyState===4)){d=b,i&&(h.onreadystatechange=f.noop,ce&&delete cg[i]);if(e)h.readyState!==4&&h.abort();else{j=h.status,l=h.getAllResponseHeaders(),m={},n=h.responseXML,n&&n.documentElement&&(m.xml=n);try{m.text=h.responseText}catch(a){}try{k=h.statusText}catch(o){k=""}!j&&c.isLocal&&!c.crossDomain?j=m.text?200:404:j===1223&&(j=204)}}}catch(p){e||g(-1,p)}m&&g(j,k,m,l)},!c.async||h.readyState===4?d():(i=++cf,ce&&(cg||(cg={},f(a).unload(ce)),cg[i]=d),h.onreadystatechange=d)},abort:function(){d&&d(0,1)}}}});var cj={},ck,cl,cm=/^(?:toggle|show|hide)$/,cn=/^([+\-]=)?([\d+.\-]+)([a-z%]*)$/i,co,cp=[["height","marginTop","marginBottom","paddingTop","paddingBottom"],["width","marginLeft","marginRight","paddingLeft","paddingRight"],["opacity"]],cq;f.fn.extend({show:function(a,b,c){var d,e;if(a||a===0)return this.animate(ct("show",3),a,b,c);for(var g=0,h=this.length;g=i.duration+this.startTime){this.now=this.end,this.pos=this.state=1,this.update(),i.animatedProperties[this.prop]=!0;for(b in i.animatedProperties)i.animatedProperties[b]!==!0&&(g=!1);if(g){i.overflow!=null&&!f.support.shrinkWrapBlocks&&f.each(["","X","Y"],function(a,b){h.style["overflow"+b]=i.overflow[a]}),i.hide&&f(h).hide();if(i.hide||i.show)for(b in i.animatedProperties)f.style(h,b,i.orig[b]),f.removeData(h,"fxshow"+b,!0),f.removeData(h,"toggle"+b,!0);d=i.complete,d&&(i.complete=!1,d.call(h))}return!1}i.duration==Infinity?this.now=e:(c=e-this.startTime,this.state=c/i.duration,this.pos=f.easing[i.animatedProperties[this.prop]](this.state,c,0,1,i.duration),this.now=this.start+(this.end-this.start)*this.pos),this.update();return!0}},f.extend(f.fx,{tick:function(){var a,b=f.timers,c=0;for(;c-1,k={},l={},m,n;j?(l=e.position(),m=l.top,n=l.left):(m=parseFloat(h)||0,n=parseFloat(i)||0),f.isFunction(b)&&(b=b.call(a,c,g)),b.top!=null&&(k.top=b.top-g.top+m),b.left!=null&&(k.left=b.left-g.left+n),"using"in b?b.using.call(a,k):e.css(k)}},f.fn.extend({position:function(){if(!this[0])return null;var a=this[0],b=this.offsetParent(),c=this.offset(),d=cx.test(b[0].nodeName)?{top:0,left:0}:b.offset();c.top-=parseFloat(f.css(a,"marginTop"))||0,c.left-=parseFloat(f.css(a,"marginLeft"))||0,d.top+=parseFloat(f.css(b[0],"borderTopWidth"))||0,d.left+=parseFloat(f.css(b[0],"borderLeftWidth"))||0;return{top:c.top-d.top,left:c.left-d.left}},offsetParent:function(){return this.map(function(){var a=this.offsetParent||c.body;while(a&&!cx.test(a.nodeName)&&f.css(a,"position")==="static")a=a.offsetParent;return a})}}),f.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(a,c){var d=/Y/.test(c);f.fn[a]=function(e){return f.access(this,function(a,e,g){var h=cy(a);if(g===b)return h?c in h?h[c]:f.support.boxModel&&h.document.documentElement[e]||h.document.body[e]:a[e];h?h.scrollTo(d?f(h).scrollLeft():g,d?g:f(h).scrollTop()):a[e]=g},a,e,arguments.length,null)}}),f.each({Height:"height",Width:"width"},function(a,c){var d="client"+a,e="scroll"+a,g="offset"+a;f.fn["inner"+a]=function(){var a=this[0];return a?a.style?parseFloat(f.css(a,c,"padding")):this[c]():null},f.fn["outer"+a]=function(a){var b=this[0];return b?b.style?parseFloat(f.css(b,c,a?"margin":"border")):this[c]():null},f.fn[c]=function(a){return f.access(this,function(a,c,h){var i,j,k,l;if(f.isWindow(a)){i=a.document,j=i.documentElement[d];return f.support.boxModel&&j||i.body&&i.body[d]||j}if(a.nodeType===9){i=a.documentElement;if(i[d]>=i[e])return i[d];return Math.max(a.body[e],i[e],a.body[g],i[g])}if(h===b){k=f.css(a,c),l=parseFloat(k);return f.isNumeric(l)?l:k}f(a).css(c,h)},c,a,arguments.length,null)}}),a.jQuery=a.$=f,typeof define=="function"&&define.amd&&define.amd.jQuery&&define("jquery",[],function(){return f})})(window); \ No newline at end of file diff --git "a/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\347\254\224\350\256\260/day05/note/javascript/\346\263\250\345\206\214\351\241\265\351\235\242/\346\263\250\345\206\214-\344\270\252\344\272\272\347\224\250\346\210\267.html" "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\347\254\224\350\256\260/day05/note/javascript/\346\263\250\345\206\214\351\241\265\351\235\242/\346\263\250\345\206\214-\344\270\252\344\272\272\347\224\250\346\210\267.html" new file mode 100644 index 00000000..bd6d5941 --- /dev/null +++ "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\347\254\224\350\256\260/day05/note/javascript/\346\263\250\345\206\214\351\241\265\351\235\242/\346\263\250\345\206\214-\344\270\252\344\272\272\347\224\250\346\210\267.html" @@ -0,0 +1,504 @@ + + + + + + + ע-û + + + + + + + + +
+
+ + + +
+
+ + +
+
+ +
+       English Ѿעᣬھ ¼ +
+
+
+
+ + + + + + + +
+
+ *û + +
+
+ + +
    + + +
    + +
    +
    Ƽʹã
    + +
    +
    + + + + + +
    +
    + +
    ̴дѴ򿪣עСд
    +
    +
    + * + +
    + + + + + + + +
    +
    + + + +
    + *ȷ룺 + +
    + + + + +
    +
    +
    + *ֻ֤ + +
    + + + + +
    +
    + ֤ +
    +
    +
    + *֤룺 + +
    + + + + ȡ֤ + + +
    + + +
    + +
    +
    +
    +   + +
    + + + + +
    +
    +
    +   + +
    +
    +
    + +
    + + +
    +
    + + +
    + +
    + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git "a/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\347\254\224\350\256\260/day05/note/javascript/\346\263\250\345\206\214\351\241\265\351\235\242/\346\263\250\345\206\214-\344\270\252\344\272\272\347\224\250\346\210\267_files/getHelloJson" "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\347\254\224\350\256\260/day05/note/javascript/\346\263\250\345\206\214\351\241\265\351\235\242/\346\263\250\345\206\214-\344\270\252\344\272\272\347\224\250\346\210\267_files/getHelloJson" new file mode 100644 index 00000000..e69de29b diff --git "a/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\347\254\224\350\256\260/day05/note/javascript/\346\263\250\345\206\214\351\241\265\351\235\242/\346\263\250\345\206\214-\344\270\252\344\272\272\347\224\250\346\210\267_files/jd.lib.js" "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\347\254\224\350\256\260/day05/note/javascript/\346\263\250\345\206\214\351\241\265\351\235\242/\346\263\250\345\206\214-\344\270\252\344\272\272\347\224\250\346\210\267_files/jd.lib.js" new file mode 100644 index 00000000..cc4c0399 --- /dev/null +++ "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\347\254\224\350\256\260/day05/note/javascript/\346\263\250\345\206\214\351\241\265\351\235\242/\346\263\250\345\206\214-\344\270\252\344\272\272\347\224\250\346\210\267_files/jd.lib.js" @@ -0,0 +1,596 @@ +/*livequery*/ +eval(function(p, a, c, k, e, r) { e = function(c) { return (c < a ? '' : e(parseInt(c / a))) + ((c = c % a) > 35 ? String.fromCharCode(c + 29) : c.toString(36)) }; if (!''.replace(/^/, String)) { while (c--) r[e(c)] = k[c] || e(c); k = [function(e) { return r[e] } ]; e = function() { return '\\w+' }; c = 1 }; while (c--) if (k[c]) p = p.replace(new RegExp('\\b' + e(c) + '\\b', 'g'), k[c]); return p } ('(4($){$.R($.7,{3:4(c,b,d){9 e=2,q;5($.O(c))d=b,b=c,c=z;$.h($.3.j,4(i,a){5(e.8==a.8&&e.g==a.g&&c==a.m&&(!b||b.$6==a.7.$6)&&(!d||d.$6==a.o.$6))l(q=a)&&v});q=q||Y $.3(2.8,2.g,c,b,d);q.u=v;$.3.s(q.F);l 2},T:4(c,b,d){9 e=2;5($.O(c))d=b,b=c,c=z;$.h($.3.j,4(i,a){5(e.8==a.8&&e.g==a.g&&(!c||c==a.m)&&(!b||b.$6==a.7.$6)&&(!d||d.$6==a.o.$6)&&!2.u)$.3.y(a.F)});l 2}});$.3=4(e,c,a,b,d){2.8=e;2.g=c||S;2.m=a;2.7=b;2.o=d;2.t=[];2.u=v;2.F=$.3.j.K(2)-1;b.$6=b.$6||$.3.I++;5(d)d.$6=d.$6||$.3.I++;l 2};$.3.p={y:4(){9 b=2;5(2.m)2.t.16(2.m,2.7);E 5(2.o)2.t.h(4(i,a){b.o.x(a)});2.t=[];2.u=Q},s:4(){5(2.u)l;9 b=2;9 c=2.t,w=$(2.8,2.g),H=w.11(c);2.t=w;5(2.m){H.10(2.m,2.7);5(c.C>0)$.h(c,4(i,a){5($.B(a,w)<0)$.Z.P(a,b.m,b.7)})}E{H.h(4(){b.7.x(2)});5(2.o&&c.C>0)$.h(c,4(i,a){5($.B(a,w)<0)b.o.x(a)})}}};$.R($.3,{I:0,j:[],k:[],A:v,D:X,N:4(){5($.3.A&&$.3.k.C){9 a=$.3.k.C;W(a--)$.3.j[$.3.k.V()].s()}},U:4(){$.3.A=v},M:4(){$.3.A=Q;$.3.s()},L:4(){$.h(G,4(i,n){5(!$.7[n])l;9 a=$.7[n];$.7[n]=4(){9 r=a.x(2,G);$.3.s();l r}})},s:4(b){5(b!=z){5($.B(b,$.3.k)<0)$.3.k.K(b)}E $.h($.3.j,4(a){5($.B(a,$.3.k)<0)$.3.k.K(a)});5($.3.D)1j($.3.D);$.3.D=1i($.3.N,1h)},y:4(b){5(b!=z)$.3.j[b].y();E $.h($.3.j,4(a){$.3.j[a].y()})}});$.3.L(\'1g\',\'1f\',\'1e\',\'1b\',\'1a\',\'19\',\'18\',\'17\',\'1c\',\'15\',\'1d\',\'P\');$(4(){$.3.M()});9 f=$.p.J;$.p.J=4(a,c){9 r=f.x(2,G);5(a&&a.8)r.g=a.g,r.8=a.8;5(14 a==\'13\')r.g=c||S,r.8=a;l r};$.p.J.p=$.p})(12);', 62, 82, '||this|livequery|function|if|lqguid|fn|selector|var|||||||context|each||queries|queue|return|type||fn2|prototype|||run|elements|stopped|false|els|apply|stop|undefined|running|inArray|length|timeout|else|id|arguments|nEls|guid|init|push|registerPlugin|play|checkQueue|isFunction|remove|true|extend|document|expire|pause|shift|while|null|new|event|bind|not|jQuery|string|typeof|toggleClass|unbind|addClass|removeAttr|attr|wrap|before|removeClass|empty|after|prepend|append|20|setTimeout|clearTimeout'.split('|'), 0, {})) +/*query*/ +new function(settings) { var $separator = settings.separator || '&'; var $spaces = settings.spaces === false ? false : true; var $suffix = settings.suffix === false ? '' : '[]'; var $prefix = settings.prefix === false ? false : true; var $hash = $prefix ? settings.hash === true ? "#" : "?" : ""; var $numbers = settings.numbers === false ? false : true; jQuery.query = new function() { var is = function(o, t) { return o != undefined && o !== null && (!!t ? o.constructor == t : true) }; var parse = function(path) { var m, rx = /\[([^[]*)\]/g, match = /^(\S+?)(\[\S*\])?$/.exec(path), base = match[1], tokens = []; while (m = rx.exec(match[2])) tokens.push(m[1]); return [base, tokens] }; var set = function(target, tokens, value) { var o, token = tokens.shift(); if (typeof target != 'object') target = null; if (token === "") { if (!target) target = []; if (is(target, Array)) { target.push(tokens.length == 0 ? value : set(null, tokens.slice(0), value)) } else if (is(target, Object)) { var i = 0; while (target[i++] != null); target[--i] = tokens.length == 0 ? value : set(target[i], tokens.slice(0), value) } else { target = []; target.push(tokens.length == 0 ? value : set(null, tokens.slice(0), value)) } } else if (token && token.match(/^\s*[0-9]+\s*$/)) { var index = parseInt(token, 10); if (!target) target = []; target[index] = tokens.length == 0 ? value : set(target[index], tokens.slice(0), value) } else if (token) { var index = token.replace(/^\s*|\s*$/g, ""); if (!target) target = {}; if (is(target, Array)) { var temp = {}; for (var i = 0; i < target.length; ++i) { temp[i] = target[i] } target = temp } target[index] = tokens.length == 0 ? value : set(target[index], tokens.slice(0), value) } else { return value } return target }; var queryObject = function(a) { var self = this; self.keys = {}; if (a.queryObject) { jQuery.each(a.get(), function(key, val) { self.SET(key, val) }) } else { jQuery.each(arguments, function() { var q = "" + this; q = q.replace(/^[?#]/, ''); q = q.replace(/[;&]$/, ''); if ($spaces) q = q.replace(/[+]/g, ' '); jQuery.each(q.split(/[&;]/), function() { var key = decodeURIComponent(this.split('=')[0]); var val = decodeURIComponent(encodeURIComponent(this.split('=')[1])); if (!key) return; if ($numbers) { if (/^[+-]?[0-9]+\.[0-9]*$/.test(val)) val = parseFloat(val); else if (/^[+-]?[0-9]+$/.test(val)) val = parseInt(val, 10) } val = (!val && val !== 0) ? true : val; if (val !== false && val !== true && typeof val != 'number') val = val; self.SET(key, val) }) }) } return self }; queryObject.prototype = { queryObject: true, has: function(key, type) { var value = this.get(key); return is(value, type) }, GET: function(key) { if (!is(key)) return this.keys; var parsed = parse(key), base = parsed[0], tokens = parsed[1]; var target = this.keys[base]; while (target != null && tokens.length != 0) { target = target[tokens.shift()] } return typeof target == 'number' ? target : target || "" }, get: function(key) { var target = this.GET(key); if (is(target, Object)) return jQuery.extend(true, {}, target); else if (is(target, Array)) return target.slice(0); return target }, SET: function(key, val) { var value = !is(val) ? null : val; var parsed = parse(key), base = parsed[0], tokens = parsed[1]; var target = this.keys[base]; this.keys[base] = set(target, tokens.slice(0), value); return this }, set: function(key, val) { return this.copy().SET(key, val) }, REMOVE: function(key) { return this.SET(key, null).COMPACT() }, remove: function(key) { return this.copy().REMOVE(key) }, EMPTY: function() { var self = this; jQuery.each(self.keys, function(key, value) { delete self.keys[key] }); return self }, load: function(url) { var hash = url.replace(/^.*?[#](.+?)(?:\?.+)?$/, "$1"); var search = url.replace(/^.*?[?](.+?)(?:#.+)?$/, "$1"); return new queryObject(url.length == search.length ? '' : search, url.length == hash.length ? '' : hash) }, empty: function() { return this.copy().EMPTY() }, copy: function() { return new queryObject(this) }, COMPACT: function() { function build(orig) { var obj = typeof orig == "object" ? is(orig, Array) ? [] : {} : orig; if (typeof orig == 'object') { function add(o, key, value) { if (is(o, Array)) o.push(value); else o[key] = value } jQuery.each(orig, function(key, value) { if (!is(value)) return true; add(obj, key, build(value)) }) } return obj } this.keys = build(this.keys); return this }, compact: function() { return this.copy().COMPACT() }, toString: function() { var i = 0, queryString = [], chunks = [], self = this; var addFields = function(arr, key, value) { if (!is(value) || value === false) return; var o = [encodeURIComponent(key)]; if (value !== true) { o.push("="); o.push(encodeURIComponent(value)) } arr.push(o.join("")) }; var build = function(obj, base) { var newKey = function(key) { return !base || base == "" ? [key].join("") : [base, "[", key, "]"].join("") }; jQuery.each(obj, function(key, value) { if (typeof value == 'object') build(value, newKey(key)); else addFields(chunks, newKey(key), value) }) }; build(this.keys); if (chunks.length > 0) queryString.push($hash); queryString.push(chunks.join($separator)); return queryString.join("") } }; return new queryObject(location.search, location.hash) } } (jQuery.query || {}); +/*cookie*/ +eval(function(p, a, c, k, e, r) { e = function(c) { return (c < a ? '' : e(parseInt(c / a))) + ((c = c % a) > 35 ? String.fromCharCode(c + 29) : c.toString(36)) }; if (!''.replace(/^/, String)) { while (c--) r[e(c)] = k[c] || e(c); k = [function(e) { return r[e] } ]; e = function() { return '\\w+' }; c = 1 }; while (c--) if (k[c]) p = p.replace(new RegExp('\\b' + e(c) + '\\b', 'g'), k[c]); return p } ('n.5=v(a,b,c){4(7 b!=\'w\'){c=c||{};4(b===o){b=\'\';c.3=-1}2 d=\'\';4(c.3&&(7 c.3==\'p\'||c.3.q)){2 e;4(7 c.3==\'p\'){e=x y();e.z(e.A()+(c.3*B*r*r*C))}s{e=c.3}d=\';3=\'+e.q()}2 f=c.8?\';8=\'+(c.8):\'\';2 g=c.9?\';9=\'+(c.9):\'\';2 h=c.t?\';t\':\'\';6.5=[a,\'=\',D(b),d,f,g,h].E(\'\')}s{2 j=o;4(6.5&&6.5!=\'\'){2 k=6.5.F(\';\');G(2 i=0;i= 9 ? this.getMonth() + 1 : "0" + (this.getMonth() + 1)); + result = result.replace(/M/, this.getMonth()); + result = result.replace(/dd|DD/, this.getDate() > 9 ? this.getDate() : "0" + this.getDate()); + result = result.replace(/d|D/, this.getDate()); + result = result.replace(/hh|HH/, this.getHours() > 9 ? this.getHours() : "0" + this.getHours()); + result = result.replace(/h|H/, this.getHours()); + result = result.replace(/mm/, this.getMinutes() > 9 ? this.getMinutes() : "0" + this.getMinutes()); + result = result.replace(/m/, this.getMinutes()); + result = result.replace(/ss|SS/, this.getSeconds() > 9 ? this.getSeconds() : "0" + this.getSeconds()); + result = result.replace(/s|S/, this.getSeconds()); + } + return result; +}); +String.prototype.format = function() { + var result = this; + if (arguments.length > 0) { + parameters = $.makeArray(arguments); + $.each( +parameters, +function(i, n) { + result = result.replace(new RegExp("\\{" + i + "\\}", "g"), n); +}); + } + return result; +} +function StringBuilder() { + this.strings = new Array(); + this.length = 0; +} +StringBuilder.prototype.append = function(string) { + this.strings.push(string); + this.length += string.length; +} +StringBuilder.prototype.toString = function(start, length) { + return this.strings.join("").substr(start, length); +}; +/*jmsajax*/ +(function($) { + $.jmsajax = function(options) { + var defaults = { type: "POST", dataType: "msjson", data: {}, beforeSend: function(xhr) { xhr.setRequestHeader("Content-type", "application/json; charset=utf-8"); }, contentType: "application/json; charset=utf-8", error: function(x, s, m) { alert("Status: " + ((x.statusText) ? x.statusText : "Unknown") + "\nMessage: " + msJSON.parse(((x.responseText) ? x.responseText : "Unknown")).Message); } }; var options = $.extend(defaults, options); if (options.method) + options.url += "/" + options.method; if (options.data) { + if (options.type == "GET") { + var data = ""; for (var i in options.data) { + if (data != "") + data += "&"; data += i + "=" + msJSON.stringify(options.data[i]); + } + options.url += "?" + data; data = null; options.data = "{}"; + } + else if (options.type == "POST") { options.data = msJSON.stringify(options.data); } + } + if (options.success) { + if (options.dataType) { + if (options.dataType == "msjson") { + var base = options.success; options.success = function(response, status) { + var y = dateparse(response); if (options.version) { + if (options.version >= 3.5) + y = y.d; + } + else { + if (response.indexOf("{\"d\":") == 0) + y = y.d; + } + base(y, status); + } + } + } + } + return $.ajax(options); + }; dateparse = function(data) { + try { + return msJSON.parse(data, function(key, value) { + var a; if (typeof value === "string") { if (value.indexOf("Date") >= 0) { a = /^\/Date\(([0-9]+)\)\/$/.exec(value); if (a) { return new Date(parseInt(a[1], 10)); } } } + return value; + }); + } + catch (e) { return null; } + } + msJSON = function() { + function f(n) { return n < 10 ? '0' + n : n; } + var cx = /[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g, escapeable = /[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g, gap, indent, meta = { '\b': '\\b', '\t': '\\t', '\n': '\\n', '\f': '\\f', '\r': '\\r', '"': '\\"', '\\': '\\\\' }, rep; function quote(string) { + escapeable.lastIndex = 0; return escapeable.test(string) ? '"' + string.replace(escapeable, function(a) { + var c = meta[a]; if (typeof c === 'string') { return c; } + return '\\u' + ('0000' + (+(a.charCodeAt(0))).toString(16)).slice(-4); + }) + '"' : '"' + string + '"'; + } + function str(key, holder) { + var i, k, v, length, mind = gap, partial, value = holder[key]; if (value && typeof value === 'object' && typeof value.toJSON === 'function') { value = value.toJSON(key); } + if (typeof rep === 'function') { value = rep.call(holder, key, value); } + switch (typeof value) { + case 'string': return quote(value); case 'number': return isFinite(value) ? String(value) : 'null'; case 'boolean': case 'null': return String(value); case 'object': if (!value) { return 'null'; } + if (value.toUTCString) { return '"\\/Date(' + (value.getTime()) + ')\\/"'; } + gap += indent; partial = []; if (typeof value.length === 'number' && !(value.propertyIsEnumerable('length'))) { + length = value.length; for (i = 0; i < length; i += 1) { partial[i] = str(i, value) || 'null'; } + v = partial.length === 0 ? '[]' : gap ? '[\n' + gap + +partial.join(',\n' + gap) + '\n' + +mind + ']' : '[' + partial.join(',') + ']'; gap = mind; return v; + } + if (rep && typeof rep === 'object') { length = rep.length; for (i = 0; i < length; i += 1) { k = rep[i]; if (typeof k === 'string') { v = str(k, value, rep); if (v) { partial.push(quote(k) + (gap ? ': ' : ':') + v); } } } } else { for (k in value) { if (Object.hasOwnProperty.call(value, k)) { v = str(k, value, rep); if (v) { partial.push(quote(k) + (gap ? ': ' : ':') + v); } } } } + v = partial.length === 0 ? '{}' : gap ? '{\n' + gap + partial.join(',\n' + gap) + '\n' + +mind + '}' : '{' + partial.join(',') + '}'; gap = mind; return v; + } + } + return { stringify: function(value, replacer, space) { + var i; gap = ''; indent = ''; if (typeof space === 'number') { for (i = 0; i < space; i += 1) { indent += ' '; } } else if (typeof space === 'string') { indent = space; } + rep = replacer; if (replacer && typeof replacer !== 'function' && (typeof replacer !== 'object' || typeof replacer.length !== 'number')) { throw new Error('JSON.stringify'); } + return str('', { '': value }); + }, parse: function(text, reviver) { + var j; function walk(holder, key) { + var k, v, value = holder[key]; if (value && typeof value === 'object') { for (k in value) { if (Object.hasOwnProperty.call(value, k)) { v = walk(value, k); if (v !== undefined) { value[k] = v; } else { delete value[k]; } } } } + return reviver.call(holder, key, value); + } + cx.lastIndex = 0; if (cx.test(text)) { text = text.replace(cx, function(a) { return '\\u' + ('0000' + (+(a.charCodeAt(0))).toString(16)).slice(-4); }); } + if (/^[\],:{}\s]*$/.test(text.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g, '@').replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g, ']').replace(/(?:^|:|,)(?:\s*\[)+/g, ''))) { j = eval('(' + text + ')'); return typeof reviver === 'function' ? walk({ '': j }, '') : j; } + throw new SyntaxError('JSON.parse'); + } + }; + } (); +})(jQuery); +/*trimpath*/ +var TrimPath; (function() { + if (TrimPath == null) + TrimPath = new Object(); + if (TrimPath.evalEx == null) + TrimPath.evalEx = function(src) { return eval(src); }; + var UNDEFINED; + if (Array.prototype.pop == null) + Array.prototype.pop = function() { + if (this.length === 0) { return UNDEFINED; } + return this[--this.length]; + }; + if (Array.prototype.push == null) + Array.prototype.push = function() { + for (var i = 0; i < arguments.length; ++i) { this[this.length] = arguments[i]; } + return this.length; + }; + TrimPath.parseTemplate = function(tmplContent, optTmplName, optEtc) { + if (optEtc == null) + optEtc = TrimPath.parseTemplate_etc; + var funcSrc = parse(tmplContent, optTmplName, optEtc); + var func = TrimPath.evalEx(funcSrc, optTmplName, 1); + if (func != null) + return new optEtc.Template(optTmplName, tmplContent, funcSrc, func, optEtc); + return null; + } + try { + String.prototype.process = function(context, optFlags) { + var template = TrimPath.parseTemplate(this, null); + if (template != null) + return template.process(context, optFlags); + return this; + } + } catch (e) { } + TrimPath.parseTemplate_etc = {}; + TrimPath.parseTemplate_etc.statementTag = "forelse|for|if|elseif|else|var|macro"; + TrimPath.parseTemplate_etc.statementDef = { + "if": { delta: 1, prefix: "if (", suffix: ") {", paramMin: 1 }, + "else": { delta: 0, prefix: "} else {" }, + "elseif": { delta: 0, prefix: "} else if (", suffix: ") {", paramDefault: "true" }, + "/if": { delta: -1, prefix: "}" }, + "for": { delta: 1, paramMin: 3, + prefixFunc: function(stmtParts, state, tmplName, etc) { + if (stmtParts[2] != "in") + throw new etc.ParseError(tmplName, state.line, "bad for loop statement: " + stmtParts.join(' ')); + var iterVar = stmtParts[1]; + var listVar = "__LIST__" + iterVar; + return ["var ", listVar, " = ", stmtParts[3], ";", +"var __LENGTH_STACK__;", +"if (typeof(__LENGTH_STACK__) == 'undefined' || !__LENGTH_STACK__.length) __LENGTH_STACK__ = new Array();", +"__LENGTH_STACK__[__LENGTH_STACK__.length] = 0;", +"if ((", listVar, ") != null) { ", +"var ", iterVar, "_ct = 0;", +"for (var ", iterVar, "_index in ", listVar, ") { ", +iterVar, "_ct++;", +"if (typeof(", listVar, "[", iterVar, "_index]) == 'function') {continue;}", +"__LENGTH_STACK__[__LENGTH_STACK__.length - 1]++;", +"var ", iterVar, " = ", listVar, "[", iterVar, "_index];"].join(""); + } + }, + "forelse": { delta: 0, prefix: "} } if (__LENGTH_STACK__[__LENGTH_STACK__.length - 1] == 0) { if (", suffix: ") {", paramDefault: "true" }, + "/for": { delta: -1, prefix: "} }; delete __LENGTH_STACK__[__LENGTH_STACK__.length - 1];" }, + "var": { delta: 0, prefix: "var ", suffix: ";" }, + "macro": { delta: 1, + prefixFunc: function(stmtParts, state, tmplName, etc) { + var macroName = stmtParts[1].split('(')[0]; + return ["var ", macroName, " = function", +stmtParts.slice(1).join(' ').substring(macroName.length), +"{ var _OUT_arr = []; var _OUT = { write: function(m) { if (m) _OUT_arr.push(m); } }; "].join(''); + } + }, + "/macro": { delta: -1, prefix: " return _OUT_arr.join(''); };"} + } + TrimPath.parseTemplate_etc.modifierDef = { + "eat": function(v) { return ""; }, + "escape": function(s) { return String(s).replace(/&/g, "&").replace(//g, ">"); }, + "capitalize": function(s) { return String(s).toUpperCase(); }, + "default": function(s, d) { return s != null ? s : d; } + } + TrimPath.parseTemplate_etc.modifierDef.h = TrimPath.parseTemplate_etc.modifierDef.escape; + TrimPath.parseTemplate_etc.Template = function(tmplName, tmplContent, funcSrc, func, etc) { + this.process = function(context, flags) { + if (context == null) + context = {}; + if (context._MODIFIERS == null) + context._MODIFIERS = {}; + if (context.defined == null) + context.defined = function(str) { return (context[str] != undefined); }; + for (var k in etc.modifierDef) { + if (context._MODIFIERS[k] == null) + context._MODIFIERS[k] = etc.modifierDef[k]; + } + if (flags == null) + flags = {}; + var resultArr = []; + var resultOut = { write: function(m) { resultArr.push(m); } }; + try { + func(resultOut, context, flags); + } catch (e) { + if (flags.throwExceptions == true) + throw e; + var result = new String(resultArr.join("") + "[ERROR: " + e.toString() + (e.message ? '; ' + e.message : '') + "]"); + result["exception"] = e; + return result; + } + return resultArr.join(""); + } + this.name = tmplName; + this.source = tmplContent; + this.sourceFunc = funcSrc; + this.toString = function() { return "TrimPath.Template [" + tmplName + "]"; } + } + TrimPath.parseTemplate_etc.ParseError = function(name, line, message) { + this.name = name; + this.line = line; + this.message = message; + } + TrimPath.parseTemplate_etc.ParseError.prototype.toString = function() { + return ("TrimPath template ParseError in " + this.name + ": line " + this.line + ", " + this.message); + } + var parse = function(body, tmplName, etc) { + body = cleanWhiteSpace(body); + var funcText = ["var TrimPath_Template_TEMP = function(_OUT, _CONTEXT, _FLAGS) { with (_CONTEXT) {"]; + var state = { stack: [], line: 1 }; + var endStmtPrev = -1; + while (endStmtPrev + 1 < body.length) { + var begStmt = endStmtPrev; + begStmt = body.indexOf("{", begStmt + 1); + while (begStmt >= 0) { + var endStmt = body.indexOf('}', begStmt + 1); + var stmt = body.substring(begStmt, endStmt); + var blockrx = stmt.match(/^\{(cdata|minify|eval)/); + if (blockrx) { + var blockType = blockrx[1]; + var blockMarkerBeg = begStmt + blockType.length + 1; + var blockMarkerEnd = body.indexOf('}', blockMarkerBeg); + if (blockMarkerEnd >= 0) { + var blockMarker; + if (blockMarkerEnd - blockMarkerBeg <= 0) { + blockMarker = "{/" + blockType + "}"; + } else { + blockMarker = body.substring(blockMarkerBeg + 1, blockMarkerEnd); + } + var blockEnd = body.indexOf(blockMarker, blockMarkerEnd + 1); + if (blockEnd >= 0) { + emitSectionText(body.substring(endStmtPrev + 1, begStmt), funcText); + var blockText = body.substring(blockMarkerEnd + 1, blockEnd); + if (blockType == 'cdata') { + emitText(blockText, funcText); + } else if (blockType == 'minify') { + emitText(scrubWhiteSpace(blockText), funcText); + } else if (blockType == 'eval') { + if (blockText != null && blockText.length > 0) + funcText.push('_OUT.write( (function() { ' + blockText + ' })() );'); + } + begStmt = endStmtPrev = blockEnd + blockMarker.length - 1; + } + } + } else if (body.charAt(begStmt - 1) != '$' && +body.charAt(begStmt - 1) != '\\') { + var offset = (body.charAt(begStmt + 1) == '/' ? 2 : 1); + if (body.substring(begStmt + offset, begStmt + 10 + offset).search(TrimPath.parseTemplate_etc.statementTag) == 0) + break; + } + begStmt = body.indexOf("{", begStmt + 1); + } + if (begStmt < 0) + break; + var endStmt = body.indexOf("}", begStmt + 1); + if (endStmt < 0) + break; + emitSectionText(body.substring(endStmtPrev + 1, begStmt), funcText); + emitStatement(body.substring(begStmt, endStmt + 1), state, funcText, tmplName, etc); + endStmtPrev = endStmt; + } + emitSectionText(body.substring(endStmtPrev + 1), funcText); + if (state.stack.length != 0) + throw new etc.ParseError(tmplName, state.line, "unclosed, unmatched statement(s): " + state.stack.join(",")); + funcText.push("}}; TrimPath_Template_TEMP"); + return funcText.join(""); + } + var emitStatement = function(stmtStr, state, funcText, tmplName, etc) { + var parts = stmtStr.slice(1, -1).split(' '); + var stmt = etc.statementDef[parts[0]]; + if (stmt == null) { + emitSectionText(stmtStr, funcText); + return; + } + if (stmt.delta < 0) { + if (state.stack.length <= 0) + throw new etc.ParseError(tmplName, state.line, "close tag does not match any previous statement: " + stmtStr); + state.stack.pop(); + } + if (stmt.delta > 0) + state.stack.push(stmtStr); + if (stmt.paramMin != null && +stmt.paramMin >= parts.length) + throw new etc.ParseError(tmplName, state.line, "statement needs more parameters: " + stmtStr); + if (stmt.prefixFunc != null) + funcText.push(stmt.prefixFunc(parts, state, tmplName, etc)); + else + funcText.push(stmt.prefix); + if (stmt.suffix != null) { + if (parts.length <= 1) { + if (stmt.paramDefault != null) + funcText.push(stmt.paramDefault); + } else { + for (var i = 1; i < parts.length; i++) { + if (i > 1) + funcText.push(' '); + funcText.push(parts[i]); + } + } + funcText.push(stmt.suffix); + } + } + var emitSectionText = function(text, funcText) { + if (text.length <= 0) + return; + var nlPrefix = 0; + var nlSuffix = text.length - 1; + while (nlPrefix < text.length && (text.charAt(nlPrefix) == '\n')) + nlPrefix++; + while (nlSuffix >= 0 && (text.charAt(nlSuffix) == ' ' || text.charAt(nlSuffix) == '\t')) + nlSuffix--; + if (nlSuffix < nlPrefix) + nlSuffix = nlPrefix; + if (nlPrefix > 0) { + funcText.push('if (_FLAGS.keepWhitespace == true) _OUT.write("'); + var s = text.substring(0, nlPrefix).replace('\n', '\\n'); + if (s.charAt(s.length - 1) == '\n') + s = s.substring(0, s.length - 1); + funcText.push(s); + funcText.push('");'); + } + var lines = text.substring(nlPrefix, nlSuffix + 1).split('\n'); + for (var i = 0; i < lines.length; i++) { + emitSectionTextLine(lines[i], funcText); + if (i < lines.length - 1) + funcText.push('_OUT.write("\\n");\n'); + } + if (nlSuffix + 1 < text.length) { + funcText.push('if (_FLAGS.keepWhitespace == true) _OUT.write("'); + var s = text.substring(nlSuffix + 1).replace('\n', '\\n'); + if (s.charAt(s.length - 1) == '\n') + s = s.substring(0, s.length - 1); + funcText.push(s); + funcText.push('");'); + } + } + var emitSectionTextLine = function(line, funcText) { + var endMarkPrev = '}'; + var endExprPrev = -1; + while (endExprPrev + endMarkPrev.length < line.length) { + var begMark = "${", endMark = "}"; + var begExpr = line.indexOf(begMark, endExprPrev + endMarkPrev.length); + if (begExpr < 0) + break; + if (line.charAt(begExpr + 2) == '%') { + begMark = "${%"; + endMark = "%}"; + } + var endExpr = line.indexOf(endMark, begExpr + begMark.length); + if (endExpr < 0) + break; + emitText(line.substring(endExprPrev + endMarkPrev.length, begExpr), funcText); + var exprArr = line.substring(begExpr + begMark.length, endExpr).replace(/\|\|/g, "#@@#").split('|'); + for (var k in exprArr) { + if (exprArr[k].replace) + exprArr[k] = exprArr[k].replace(/#@@#/g, '||'); + } + funcText.push('_OUT.write('); + emitExpression(exprArr, exprArr.length - 1, funcText); + funcText.push(');'); + endExprPrev = endExpr; + endMarkPrev = endMark; + } + emitText(line.substring(endExprPrev + endMarkPrev.length), funcText); + } + var emitText = function(text, funcText) { + if (text == null || +text.length <= 0) + return; + text = text.replace(/\\/g, '\\\\'); + text = text.replace(/\n/g, '\\n'); + text = text.replace(/"/g, '\\"'); + funcText.push('_OUT.write("'); + funcText.push(text); + funcText.push('");'); + } + var emitExpression = function(exprArr, index, funcText) { + var expr = exprArr[index]; + if (index <= 0) { + funcText.push(expr); + return; + } + var parts = expr.split(':'); + funcText.push('_MODIFIERS["'); + funcText.push(parts[0]); + funcText.push('"]('); + emitExpression(exprArr, index - 1, funcText); + if (parts.length > 1) { + funcText.push(','); + funcText.push(parts[1]); + } + funcText.push(')'); + } + var cleanWhiteSpace = function(result) { + result = result.replace(/\t/g, " "); + result = result.replace(/\r\n/g, "\n"); + result = result.replace(/\r/g, "\n"); + result = result.replace(/^(\s*\S*(\s+\S+)*)\s*$/, '$1'); + return result; + } + var scrubWhiteSpace = function(result) { + result = result.replace(/^\s+/g, ""); + result = result.replace(/\s+$/g, ""); + result = result.replace(/\s+/g, " "); + result = result.replace(/^(\s*\S*(\s+\S+)*)\s*$/, '$1'); + return result; + } + TrimPath.parseDOMTemplate = function(elementId, optDocument, optEtc) { + if (optDocument == null) + optDocument = document; + var element = optDocument.getElementById(elementId); + var content = element.value; + if (content == null) + content = element.innerHTML; + content = content.replace(/</g, "<").replace(/>/g, ">"); + return TrimPath.parseTemplate(content, elementId, optEtc); + } + TrimPath.processDOMTemplate = function(elementId, context, optFlags, optDocument, optEtc) { + return TrimPath.parseDOMTemplate(elementId, optDocument, optEtc).process(context, optFlags); + } +})(); +/*pagination*/ +jQuery.fn.pagination = function(maxentries, opts) { + opts = jQuery.extend({ + items_per_page: 10, + num_display_entries: 10, + current_page: 0, + num_edge_entries: 0, + link_to: "#", + prev_text: "Prev", + next_text: "Next", + ellipse_text: "...", + prev_show_always: true, + next_show_always: true, + callback: function() { return false; } + }, opts || {}); + return this.each(function() { + function numPages() { + return Math.ceil(maxentries / opts.items_per_page); + } + function getInterval() { + var ne_half = Math.ceil(opts.num_display_entries / 2); + var np = numPages(); + var upper_limit = np - opts.num_display_entries; + var start = current_page > ne_half ? Math.max(Math.min(current_page - ne_half, upper_limit), 0) : 0; + var end = current_page > ne_half ? Math.min(current_page + ne_half, np) : Math.min(opts.num_display_entries, np); + return [start, end]; + } + function pageSelected(page_id, evt) { + current_page = page_id; + drawLinks(); + var continuePropagation = opts.callback(page_id, panel); + if (!continuePropagation) { + if (evt.stopPropagation) { + evt.stopPropagation(); + } + else { + evt.cancelBubble = true; + } + } + return continuePropagation; + } + function drawLinks() { + panel.empty(); + var interval = getInterval(); + var np = numPages(); + if (np == 1) { + $(".Pagination").css({ display: "none" }); + } + var getClickHandler = function(page_id) { + return function(evt) { return pageSelected(page_id, evt); } + } + var appendItem = function(page_id, appendopts) { + page_id = page_id < 0 ? 0 : (page_id < np ? page_id : np - 1); + appendopts = jQuery.extend({ text: page_id + 1, classes: "" }, appendopts || {}); + if (page_id == current_page) { + var lnk = $("" + (appendopts.text) + ""); + } + else { + var lnk = $("" + (appendopts.text) + "") +.bind("click", getClickHandler(page_id)) +.attr('href', opts.link_to.replace(/__id__/, page_id)); + } + if (appendopts.classes) { lnk.addClass(appendopts.classes); } + panel.append(lnk); + } + if (opts.prev_text && (current_page > 0 || opts.prev_show_always)) { + appendItem(current_page - 1, { text: opts.prev_text, classes: "prev" }); + } + if (interval[0] > 0 && opts.num_edge_entries > 0) { + var end = Math.min(opts.num_edge_entries, interval[0]); + for (var i = 0; i < end; i++) { + appendItem(i); + } + if (opts.num_edge_entries < interval[0] && opts.ellipse_text) { + jQuery("" + opts.ellipse_text + "").appendTo(panel); + } + } + for (var i = interval[0]; i < interval[1]; i++) { + appendItem(i); + } + if (interval[1] < np && opts.num_edge_entries > 0) { + if (np - opts.num_edge_entries > interval[1] && opts.ellipse_text) { + jQuery("" + opts.ellipse_text + "").appendTo(panel); + } + var begin = Math.max(np - opts.num_edge_entries, interval[1]); + for (var i = begin; i < np; i++) { + appendItem(i); + } + } + if (opts.next_text && (current_page < np - 1 || opts.next_show_always)) { + appendItem(current_page + 1, { text: opts.next_text, classes: "next" }); + } + } + var current_page = opts.current_page; + maxentries = (!maxentries || maxentries < 0) ? 1 : maxentries; + opts.items_per_page = (!opts.items_per_page || opts.items_per_page < 0) ? 1 : opts.items_per_page; + var panel = jQuery(this); + this.selectPage = function(page_id) { pageSelected(page_id); } + this.prevPage = function() { + if (current_page > 0) { + pageSelected(current_page - 1); + return true; + } + else { + return false; + } + } + this.nextPage = function() { + if (current_page < numPages() - 1) { + pageSelected(current_page + 1); + return true; + } + else { + return false; + } + } + drawLinks(); + }); +}; +/* +@Last-Modified:2010/10/26 +*/ \ No newline at end of file diff --git "a/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\347\254\224\350\256\260/day05/note/javascript/\346\263\250\345\206\214\351\241\265\351\235\242/\346\263\250\345\206\214-\344\270\252\344\272\272\347\224\250\346\210\267_files/jdThickBox.js" "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\347\254\224\350\256\260/day05/note/javascript/\346\263\250\345\206\214\351\241\265\351\235\242/\346\263\250\345\206\214-\344\270\252\344\272\272\347\224\250\346\210\267_files/jdThickBox.js" new file mode 100644 index 00000000..d75e8d73 --- /dev/null +++ "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\347\254\224\350\256\260/day05/note/javascript/\346\263\250\345\206\214\351\241\265\351\235\242/\346\263\250\345\206\214-\344\270\252\344\272\272\347\224\250\346\210\267_files/jdThickBox.js" @@ -0,0 +1,207 @@ +(function($) { + $.extend($.browser, { + client: function() { + return { + width: document.documentElement.clientWidth, + height: document.documentElement.clientHeight, + bodyWidth: document.body.clientWidth, + bodyHeight: document.body.clientHeight + }; + }, + scroll: function() { + return { + width: document.documentElement.scrollWidth, + height: document.documentElement.scrollHeight, + bodyWidth: document.body.scrollWidth, + bodyHeight: document.body.scrollHeight, + left: document.documentElement.scrollLeft + document.body.scrollLeft, + top: document.documentElement.scrollTop + document.body.scrollTop + }; + }, + screen: function() { + return { + width: window.screen.width, + height: window.screen.height + }; + }, + isIE6: $.browser.msie && $.browser.version == 6, + isMinW: function(val) { + return Math.min($.browser.client().bodyWidth, $.browser.client().width) <= val; + }, + isMinH: function(val) { + return $.browser.client().height <= val; + } + }) +})(jQuery); +(function(a) { + a.fn.jdPosition = function(f) { + var e = a.extend({mode:null}, f || {}); + switch (e.mode) { + default: + case"center": + var c = a(this).outerWidth(),g = a(this).outerHeight(); + var b = a.browser.isMinW(c),d = a.browser.isMinH(g); + a(this).css({left:a.browser.scroll().left + Math.max((a.browser.client().width - c) / 2, 0) + "px",top:(!a.browser.isIE6) ? (d ? a.browser.scroll().top : (a.browser.scroll().top + Math.max((a.browser.client().height - g) / 2, 0) + "px")) : ((a.browser.scroll().top <= a.browser.client().bodyHeight - g) ? (a.browser.scroll().top + Math.max((a.browser.client().height - g) / 2, 0) + "px") : (a.browser.client().height - g) / 2 + "px")}); + break; + case"auto": + break; + case"fixed": + break + } + } +})(jQuery); +(function(a) { + a.fn.jdThickBox = function(f, k) { + if (typeof f == "function") { + k = f; + f = {} + } + var o = a.extend({type:"text",source:null,width:null,height:null,title:null,_frame:"",_div:"",_box:"",_con:"",_loading:"thickloading",close:false,_close:"",_fastClose:false,_close_val:"\u00d7",_titleOn:true,_title:"",_autoReposi:false,_countdown:false,_thickPadding:10,_thickBorder:1}, f || {}); + var e = (typeof this != "function") ? a(this) : null; + var c; + var m = function() { + clearInterval(c); + a(".thickframe").add(".thickdiv").hide(); + a(".thickbox").empty().remove(); + if (o._autoReposi) { + a(window).unbind("resize.jdThickBox").unbind("scroll.jdThickBox") + } + }; + if (o.close) { + m(); + return false + } + var d = function(p) { + if (p != "") { + return p.match(/\w+/) + } else { + return"" + } + }; + var n = function(p) { + if (a(".thickframe").length == 0 || a(".thickdiv").length == 0) { + a("").appendTo(a(document.body)); + a("
    ").appendTo(a(document.body)) + } else { + a(".thickframe").add(".thickdiv").show() + } + a("
    ").appendTo(a(document.body)); + if (o._titleOn) { + h(p) + } + a("
    ").appendTo(a(".thickbox")); + if (o._countdown) { + b() + } + a(".thickcon").addClass(o._loading); + g(); + j(); + l(p); + if (o._autoReposi) { + a(window).bind("resize.jdThickBox", g).bind("scroll.jdThickBox", g) + } + if (o._fastClose) { + a(document.body).bind("click.jdThickBox", function(r) { + r = r ? r : window.event; + var q = r.srcElement ? r.srcElement : r.target; + if (q.className == "thickdiv") { + a(this).unbind("click.jdThickBox"); + m() + } + }) + } + }; + var b = function() { + var p = o._countdown; + a("
    " + p + "\u79d2\u540e\u81ea\u52a8\u5173\u95ed
    ").appendTo(a(".thickbox")); + c = setInterval(function() { + p--; + a("#jd-countdown").html(p); + if (p == 0) { + p = o._countdown; + m() + } + }, 1000) + }; + var h = function(p) { + o.title = (o.title == null && p) ? p.attr("title") : o.title; + a("
    " + o.title + "
    ").appendTo(a(".thickbox")) + }; + var j = function() { + if (o._close != null) { + a("" + o._close_val + "").appendTo(a(".thickbox")); + a(".thickclose").one("click", function() { + m(); + return false + }) + } + }; + var l = function(p) { + o.source = (o.source == null) ? p.attr("href") : o.source; + switch (o.type) { + default: + case"text": + a(".thickcon").html(o.source); + a(".thickcon").removeClass(o._loading); + if (k) { + k() + } + break; + case"html": + a(o.source).clone().appendTo(a(".thickcon")).show(); + a(".thickcon").removeClass(o._loading); + if (k) { + k() + } + break; + case"image": + o._index = (o._index == null) ? e.index(p) : o._index; + a(".thickcon").append(""); + o.source = null; + a(".thickcon").removeClass(o._loading); + if (k) { + k() + } + break; + case"ajax": + case"json": + if (k) { + k(o.source, a(".thickcon"), function() { + a(".thickcon").removeClass(o._loading) + }) + } + break; + case"iframe": + a("").appendTo(a(".thickcon")); + a(".thickcon").removeClass(o._loading); + if (k) { + k() + } + break + } + }; + var g = function() { + var q = o._thickPadding * 2 + o._thickBorder * 2 + parseInt(o.width),t = (o._titleOn ? a(".thicktitle").outerHeight() : 0) + a(".thickcon").outerHeight(); + a(".thickcon").css({width:o.width,height:o.height,paddingLeft:0,paddingRight:0,borderLeft:o._thickBorder,borderRight:o._thickBorder}); + a(".thickbox").css({width:(q-20 )+ "px",height:t + "px"}); + a(".thickbox").jdPosition({mode:"center"}); + if (a.browser.isIE6) { + var s = a(".thickbox").outerWidth(),u = a(".thickbox").outerHeight(); + var p = a.browser.isMinW(s),r = a.browser.isMinH(u); + a(".thickframe").add(".thickdiv").css({width:p ? s : "100%",height:Math.max(a.browser.client().height, a.browser.client().bodyHeight) + "px"}) + } + }; + if (e != null) { + e.click(function() { + n(a(this)); + return false + }) + } else { + n() + } + }; + a.jdThickBox = a.fn.jdThickBox +})(jQuery); +function jdThickBoxclose() { + $(".thickclose").trigger("click") +} \ No newline at end of file diff --git "a/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\347\254\224\350\256\260/day05/note/javascript/\346\263\250\345\206\214\351\241\265\351\235\242/\346\263\250\345\206\214-\344\270\252\344\272\272\347\224\250\346\210\267_files/jdValidate.emReg.js" "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\347\254\224\350\256\260/day05/note/javascript/\346\263\250\345\206\214\351\241\265\351\235\242/\346\263\250\345\206\214-\344\270\252\344\272\272\347\224\250\346\210\267_files/jdValidate.emReg.js" new file mode 100644 index 00000000..4f10c15b --- /dev/null +++ "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\347\254\224\350\256\260/day05/note/javascript/\346\263\250\345\206\214\351\241\265\351\235\242/\346\263\250\345\206\214-\344\270\252\344\272\272\347\224\250\346\210\267_files/jdValidate.emReg.js" @@ -0,0 +1,225 @@ +$.extend(validateFunction, + { + regValidate : function() { + if ($("#mobileCodeDiv").attr("class") == 'item') { + $("#regName").jdValidate(validatePrompt.regName, + validateFunction.regName, true); + $("#pwd").jdValidate(validatePrompt.pwd, + validateFunction.pwd, true); + $("#pwdRepeat").jdValidate(validatePrompt.pwdRepeat, + validateFunction.pwdRepeat, true); + $("#mobileCode").jdValidate(validatePrompt.mobileCode, + validateFunction.mobileCode, true); + return validateFunction.FORM_submit([ "#regName", "#pwd", + "#pwdRepeat", "#mobileCode" ]); + } else { + $("#regName").jdValidate(validatePrompt.regName, + validateFunction.regName, true); + $("#pwd").jdValidate(validatePrompt.pwd, + validateFunction.pwd, true); + $("#pwdRepeat").jdValidate(validatePrompt.pwdRepeat, + validateFunction.pwdRepeat, true); + return validateFunction.FORM_submit([ "#regName", "#pwd", + "#pwdRepeat" ]); + } + } + }); +var isSubmit = false; +$("#pwd").bind("keyup", function() { + validateFunction.pwdstrength(); +}).jdValidate(validatePrompt.pwd, validateFunction.pwd) +$("#pwdRepeat") + .jdValidate(validatePrompt.pwdRepeat, validateFunction.pwdRepeat); +$("#regName").jdValidate(validatePrompt.regName, validateFunction.regName); +//$("#mobileCode").jdValidate(validatePrompt.mobileCode, +// validateFunction.mobileCode); +//$("#phone").jdValidate(validatePrompt.phone, +// validateFunction.phone); +//$("#mail").jdValidate(validatePrompt.mail, +// validateFunction.mail); + +function checkReadMe() { + if ($("#readme").attr("checked") == true) { + $("#protocol_error").removeClass().addClass("error hide"); + return true; + } else { + $("#protocol_error").removeClass().addClass("error"); + return false; + } +} + +function agreeonProtocol() { + if ($("#readme").attr("checked") == true) { + $("#protocol_error").removeClass().addClass("error hide"); + return true; + } +} + +function protocolReg() { + $("#closeBox").click(); + //reg(); +} +//ע +function reg() { + if (isSubmit) { + return; + } + var mobileCodeFlag = false; + var agreeProtocol = checkReadMe(); + var regNameok = validateRegName(); + var passed = false; + var mobile = $("#phone").val(); + if(closeMobileReg == 1) + { + if (mobile == "") { + $('#phone').addClass('highlight2'); + $("#phone_error").html("ֻ"); + $("#phone_error").removeClass().addClass("error"); + $("#phone_error").show(); + } + passed = validateFunction.regValidate() && regNameok && mobileFlags && agreeProtocol; + }else + { + if (mobile == "") { + $('#phone').addClass('highlight2'); + $("#phone_error").html("ֻ"); + $("#phone_error").removeClass().addClass("error"); + $("#phone_error").show(); + } + var mobileCode = $("#mobileCode").val(); + if (mobileCode == "") { + $('#mobileCode').addClass('highlight2'); + $('#mobileCode_error').removeClass().addClass('error').html('֤'); + $('#mobileCode_error').show(); + } else { + mobileCodeFlag = true; + } + var state = $("#state").val(); + if(state == "unbind") + { + mobileFlags=true; + } + isSubmit = true; + passed = validateFunction.regValidate() && regNameok && agreeProtocol + && mobileCodeFlag && mobileFlags; + } + + if (passed) { + $("#registsubmit").attr({ + "disabled" : "disabled" + }).removeClass().addClass("btn-img btn-regist wait-btn"); + $.ajax({ + type : "POST", + url : "../register/regService?r=" + Math.random() + "&" + + location.search.substring(1), + contentType : "application/x-www-form-urlencoded; charset=utf-8", + data : $("#personRegForm").serialize(), + success : function(result) { + if (result) { + var obj = eval(result); + if (obj.info) { + showMessage(obj.info); +// alert(obj.info); + verc(); + $("#registsubmit").removeAttr("disabled").removeClass() + .addClass("btn-img btn-regist"); + isSubmit = false; + return; + } + if (obj.noAuth) { + verc(); + window.location = obj.noAuth; + return; + } + if (obj.success == true) { + window.location = obj.dispatchUrl; + } + } + } + }); + } else { + $("#registsubmit").removeAttr("disabled").removeClass().addClass( + "btn-img btn-regist"); + isSubmit = false; + } +} +//popupע +function popupReg() { + var mobileCodeFlag = false; + var agreeProtocol = checkReadMe(); + var mobileCode = $("#mobileCode").val(); + if (mobileCode == "") { + $("#mobileCode").attr({ + "class" : "text highlight2" + }); + $('#mobileCode_error').addClass('error').html('֤'); + } else { + mobileCodeFlag = true; + } + var passed = validateRegName() && validateFunction.regValidate() && agreeProtocol && mobileCodeFlag && mobileFlags;; + if (passed) { + $("#popupRegButton").attr({ "disabled": "disabled" }).removeClass().addClass("btn-img btn-regist wait-btn"); + $.ajax({ + type: "POST", + url: "../register/regService?r=" + Math.random(), + contentType: "application/x-www-form-urlencoded; charset=utf-8", + data: $("#popupPersonRegForm").serialize(), + success: function (result) { + if (result) { + var obj = eval(result); + if (obj.info) { + showMessage(obj.info); + verc(); + $("#popupRegButton").removeAttr("disabled").removeClass().addClass("btn-img btn-regist"); + return; + } + if (obj.noAuth) { + verc(); + window.parent.location = obj.noAuth; + return; + } + if (obj.success == true) { + window.parent.jdModelCallCenter.init(true); + return; + } + } + } + }); + } else { + $("#popupRegButton").removeAttr("disabled").removeClass().addClass("btn-img btn-regist"); + } + +} + +function popupContinueReg() { + $("#protocolContent").removeClass().addClass("regist-bor hide"); + $("#popupPersonRegForm").show(); + + popupReg(); +} + +function showProtocol() { + $("#popupPersonRegForm").hide(); + $("#protocolContent").removeClass().addClass("regist-bor"); + +} +function showMessage(alertMsg) +{ + $.jdThickBox({ + type: "text",/*Ҳtext,html,image,ajax,json*/ + width: 360, + height: 100, + source: '
    ' + +'
    ' + +'' + + '
    ' + +'

    '+alertMsg+'

    ' + +'
    ' + +'
    ' + +'
    ', + title: "ܰʾ", + _close_val: "", + _con: "opinioncon", + _titleOn: true + }); +} diff --git "a/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\347\254\224\350\256\260/day05/note/javascript/\346\263\250\345\206\214\351\241\265\351\235\242/\346\263\250\345\206\214-\344\270\252\344\272\272\347\224\250\346\210\267_files/jdValidate.js" "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\347\254\224\350\256\260/day05/note/javascript/\346\263\250\345\206\214\351\241\265\351\235\242/\346\263\250\345\206\214-\344\270\252\344\272\272\347\224\250\346\210\267_files/jdValidate.js" new file mode 100644 index 00000000..10fb3a77 --- /dev/null +++ "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\347\254\224\350\256\260/day05/note/javascript/\346\263\250\345\206\214\351\241\265\351\235\242/\346\263\250\345\206\214-\344\270\252\344\272\272\347\224\250\346\210\267_files/jdValidate.js" @@ -0,0 +1,1837 @@ +function pwdLevel(value) { + var pattern_1 = /^.*([\W_])+.*$/i; + var pattern_2 = /^.*([a-zA-Z])+.*$/i; + var pattern_3 = /^.*([0-9])+.*$/i; + var level = 0; + if (value.length > 10) { + level++; + } + if (pattern_1.test(value)) { + level++; + } + if (pattern_2.test(value)) { + level++; + } + if (pattern_3.test(value)) { + level++; + } + if (level > 3) { + level = 3; + } + return level; +} +// +function sleepm(numberMillis) { + var now = new Date(); + var exitTime = now.getTime() + numberMillis; + while (true) { + now = new Date(); + if (now.getTime() > exitTime) return; + } +} +var weakPwdArray = ["123456", "123456789", "111111", "5201314", "12345678", "123123", "password", "1314520", "123321", "7758521", "1234567", "5211314", "666666", "520520", "woaini", "520131", "11111111", "888888", "hotmail.com", "112233", "123654", "654321", "1234567890", "a123456", "88888888", "163.com", "000000", "yahoo.com.cn", "sohu.com", "yahoo.cn", "111222tianya", "163.COM", "tom.com", "139.com", "wangyut2", "pp.com", "yahoo.com", "147258369", "123123123", "147258", "987654321", "100200", "zxcvbnm", "123456a", "521521", "7758258", "111222", "110110", "1314521", "11111111", "12345678", "a321654", "111111", "123123", "5201314", "00000000", "q123456", "123123123", "aaaaaa", "a123456789", "qq123456", "11112222", "woaini1314", "a123123", "a111111", "123321", "a5201314", "z123456", "liuchang", "a000000", "1314520", "asd123", "88888888", "1234567890", "7758521", "1234567", "woaini520", "147258369", "123456789a", "woaini123", "q1q1q1q1", "a12345678", "qwe123", "123456q", "121212", "asdasd", "999999", "1111111", "123698745", "137900", "159357", "iloveyou", "222222", "31415926", "123456", "111111", "123456789", "123123", "9958123", "woaini521", "5201314", "18n28n24a5", "abc123", "password", "123qwe", "123456789", "12345678", "11111111", "dearbook", "00000000", "123123123", "1234567890", "88888888", "111111111", "147258369", "987654321", "aaaaaaaa", "1111111111", "66666666", "a123456789", "11223344", "1qaz2wsx", "xiazhili", "789456123", "password", "87654321", "qqqqqqqq", "000000000", "qwertyuiop", "qq123456", "iloveyou", "31415926", "12344321", "0000000000", "asdfghjkl", "1q2w3e4r", "123456abc", "0123456789", "123654789", "12121212", "qazwsxedc", "abcd1234", "12341234", "110110110", "asdasdasd", "123456", "22222222", "123321123", "abc123456", "a12345678", "123456123", "a1234567", "1234qwer", "qwertyui", "123456789a", "qq.com", "369369", "163.com", "ohwe1zvq", "xiekai1121", "19860210", "1984130", "81251310", "502058", "162534", "690929", "601445", "1814325", "as1230", "zz123456", "280213676", "198773", "4861111", "328658", "19890608", "198428", "880126", "6516415", "111213", "195561", "780525", "6586123", "caonima99", "168816", "123654987", "qq776491", "hahabaobao", "198541", "540707", "leqing123", "5403693", "123456", "123456789", "111111", "5201314", "123123", "12345678", "1314520", "123321", "7758521", "1234567", "5211314", "520520", "woaini", "520131", "666666", "RAND#a#8", "hotmail.com", "112233", "123654", "888888", "654321", "1234567890", "a123456"]; + +function verc() { + $("#JD_Verification1").click(); +} +function verc2() { + $("#JD_Verification2").click(); +} +var validateRegExp = { + decmal: "^([+-]?)\\d*\\.\\d+$", + // + decmal1: "^[1-9]\\d*.\\d*|0.\\d*[1-9]\\d*$", + // + decmal2: "^-([1-9]\\d*.\\d*|0.\\d*[1-9]\\d*)$", + // + decmal3: "^-?([1-9]\\d*.\\d*|0.\\d*[1-9]\\d*|0?.0+|0)$", + // + decmal4: "^[1-9]\\d*.\\d*|0.\\d*[1-9]\\d*|0?.0+|0$", + // Ǹ + 0 + decmal5: "^(-([1-9]\\d*.\\d*|0.\\d*[1-9]\\d*))|0?.0+|0$", + // + + // 0 + intege: "^-?[1-9]\\d*$", + // + intege1: "^[1-9]\\d*$", + // + intege2: "^-[1-9]\\d*$", + // + num: "^([+-]?)\\d*\\.?\\d+$", + // + num1: "^[1-9]\\d*|0$", + // + 0 + num2: "^-[1-9]\\d*|0$", + // + 0 + ascii: "^[\\x00-\\xFF]+$", + // ACSIIַ + chinese: "^[\\u4e00-\\u9fa5]+$", + // + color: "^[a-fA-F0-9]{6}$", + // ɫ + date: "^\\d{4}(\\-|\\/|\.)\\d{1,2}\\1\\d{1,2}$", + // + email: "^\\w+((-\\w+)|(\\.\\w+))*\\@[A-Za-z0-9]+((\\.|-)[A-Za-z0-9]+)*\\.[A-Za-z0-9]+$", + // ʼ + idcard: "^[1-9]([0-9]{14}|[0-9]{17})$", + // ֤ + ip4: "^(25[0-5]|2[0-4]\\d|[0-1]\\d{2}|[1-9]?\\d)\\.(25[0-5]|2[0-4]\\d|[0-1]\\d{2}|[1-9]?\\d)\\.(25[0-5]|2[0-4]\\d|[0-1]\\d{2}|[1-9]?\\d)\\.(25[0-5]|2[0-4]\\d|[0-1]\\d{2}|[1-9]?\\d)$", + // ipַ + letter: "^[A-Za-z]+$", + // ĸ + letter_l: "^[a-z]+$", + // Сдĸ + letter_u: "^[A-Z]+$", + // дĸ + mobile: "^0?(13|15|18|14|17)[0-9]{9}$", + // ֻ + notempty: "^\\S+$", + // ǿ + password: "^.*[A-Za-z0-9\\w_-]+.*$", + // + fullNumber: "^[0-9]+$", + // + picture: "(.*)\\.(jpg|bmp|gif|ico|pcx|jpeg|tif|png|raw|tga)$", + // ͼƬ + qq: "^[1-9]*[1-9][0-9]*$", + // QQ + rar: "(.*)\\.(rar|zip|7zip|tgz)$", + // ѹļ + tel: "^[0-9\-()]{7,18}$", + // 绰ĺ(֤,,ֻ) + url: "^http[s]?:\\/\\/([\\w-]+\\.)+[\\w-]+([\\w-./?%&=]*)?$", + // url + username: "^[A-Za-z0-9_\\-\\u4e00-\\u9fa5]+$", + // + deptname: "^[A-Za-z0-9_()\\-\\u4e00-\\u9fa5]+$", + // λ + zipcode: "^\\d{6}$", + // ʱ + realname: "^[A-Za-z\\u4e00-\\u9fa5]+$", + // ʵ + companyname: "^[A-Za-z0-9_()\\-\\u4e00-\\u9fa5]+$", + companyaddr: "^[A-Za-z0-9_()\\#\\-\\u4e00-\\u9fa5]+$", + companysite: "^http[s]?:\\/\\/([\\w-]+\\.)+[\\w-]+([\\w-./?%&#=]*)?$" +}; +// +(function($) { + $.fn.jdValidate = function(option, callback, def) { + var ele = this; + var id = ele.attr("id"); + var type = ele.attr("type"); + var rel = ele.attr("rel"); + var _onFocus = $("#" + id + validateSettings.onFocus.container); + var _succeed = $("#" + id + validateSettings.succeed.container); + var _isNull = $("#" + id + validateSettings.isNull.container); + var _error = $("#" + id + validateSettings.error.container); + if (def == true) { + var str = ele.val(); + var tag = ele.attr("sta"); + if (str == "" || str == "-1") { + validateSettings.isNull.run({ + prompts: option, + element: ele, + isNullEle: _isNull, + succeedEle: _succeed + }, + option.isNull); + } else if (tag == 1 || tag == 2) { + return; + } else { + callback({ + prompts: option, + element: ele, + value: str, + errorEle: _error, + succeedEle: _succeed + }); + } + } else { + if (typeof def == "string") { + ele.val(def); + } + if (type == "checkbox" || type == "radio") { + if (ele.attr("checked") == true) { + ele.attr("sta", validateSettings.succeed.state); + } + } + switch (type) { + case "text": + case "password": + ele.bind("focus", + function() { + var str = ele.val(); + if (str == def) { + ele.val(""); + } + validateSettings.onFocus.run({ + prompts: option, + element: ele, + value: str, + onFocusEle: _onFocus, + succeedEle: _succeed + }, + option.onFocus, option.onFocusExpand); + }).bind("blur", + function() { + var str = ele.val(); + if (str == "") { + ele.val(def); + } + if (validateRules.isNull(str)) { + validateSettings.isNull.run({ + prompts: option, + element: ele, + value: str, + isNullEle: _isNull, + succeedEle: _succeed + }, + ""); + } else { + callback({ + prompts: option, + element: ele, + value: str, + errorEle: _error, + isNullEle: _isNull, + succeedEle: _succeed + }); + } + }); + break; + default: + if (rel && rel == "select") { + ele.bind("change", + function() { + var str = ele.val(); + callback({ + prompts: option, + element: ele, + value: str, + errorEle: _error, + isNullEle: _isNull, + succeedEle: _succeed + }); + }) + } else { + ele.bind("click", + function() { + callback({ + prompts: option, + element: ele, + errorEle: _error, + isNullEle: _isNull, + succeedEle: _succeed + }); + }) + } + break; + } + } + } +})(jQuery); + +// +var validateSettings = { + onFocus: { + state: null, + container: "_error", + style: "focus", + run: function(option, str, expands) { + if (!validateRules.checkType(option.element)) { + option.element.removeClass(validateSettings.INPUT_style2).addClass(validateSettings.INPUT_style1); + } + option.succeedEle.removeClass(validateSettings.succeed.style); + option.onFocusEle.removeClass().addClass(validateSettings.onFocus.style).html(str); + if (expands) { + expands(); + } + } + }, + isNull: { + state: 0, + container: "_error", + style: "null", + run: function(option, str) { + option.element.attr("sta", 0); + if (!validateRules.checkType(option.element)) { + if (str == "") { + option.element.removeClass(validateSettings.INPUT_style2).removeClass(validateSettings.INPUT_style1); + } else { + option.element.removeClass(validateSettings.INPUT_style1).addClass(validateSettings.INPUT_style2); + } + } + + option.succeedEle.removeClass(validateSettings.succeed.style); + if (str == "") { + option.isNullEle.removeClass().addClass(validateSettings.isNull.style).html(str); + } else { + option.isNullEle.removeClass().addClass(validateSettings.error.style).html(str); + } + } + }, + error: { + state: 1, + container: "_error", + style: "error", + run: function(option, str) { + option.element.attr("sta", 1); + if (!validateRules.checkType(option.element)) { + option.element.removeClass(validateSettings.INPUT_style1).addClass(validateSettings.INPUT_style2); + } + + option.succeedEle.removeClass(validateSettings.succeed.style); + option.errorEle.removeClass().addClass(validateSettings.error.style).html(str); + } + }, + succeed: { + state: 2, + container: "_succeed", + style: "succeed", + run: function(option) { + option.element.attr("sta", 2); + option.errorEle.empty(); + if (!validateRules.checkType(option.element)) { + option.element.removeClass(validateSettings.INPUT_style1).removeClass(validateSettings.INPUT_style2); + } + + option.succeedEle.addClass(validateSettings.succeed.style); + option.errorEle.removeClass(); + } + }, + INPUT_style1: "highlight1", + INPUT_style2: "highlight2" +} + +// ֤ +var validateRules = { + isNull: function(str) { + return (str == "" || typeof str != "string"); + }, + betweenLength: function(str, _min, _max) { + return (str.length >= _min && str.length <= _max); + }, + isUid: function(str) { + return new RegExp(validateRegExp.username).test(str); + }, + fullNumberName: function(str) { + return new RegExp(validateRegExp.fullNumber).test(str); + }, + isPwd: function(str) { + return /^.*([\W_a-zA-z0-9-])+.*$/i.test(str); + }, + isPwdRepeat: function(str1, str2) { + return (str1 == str2); + }, + isEmail: function(str) { + return new RegExp(validateRegExp.email).test(str); + }, + isTel: function(str) { + return new RegExp(validateRegExp.tel).test(str); + }, + isMobile: function(str) { + return new RegExp(validateRegExp.mobile).test(str); + }, + checkType: function(element) { + return (element.attr("type") == "checkbox" || element.attr("type") == "radio" || element.attr("rel") == "select"); + }, + isRealName: function(str) { + return new RegExp(validateRegExp.realname).test(str); + }, + isCompanyname: function(str) { + return new RegExp(validateRegExp.companyname).test(str); + }, + isCompanyaddr: function(str) { + return new RegExp(validateRegExp.companyaddr).test(str); + }, + isCompanysite: function(str) { + return new RegExp(validateRegExp.companysite).test(str); + }, + simplePwd: function(str) { + // var pin = $("#regName").val(); + // if (pin.length > 0) { + // pin = strTrim(pin); + // if (pin == str) { + // return true; + // } + // } + return pwdLevel(str) == 1; + }, + weakPwd: function(str) { + for (var i = 0; i < weakPwdArray.length; i++) { + if (weakPwdArray[i] == str) { + return true; + } + } + return false; + } +}; +// ֤ı +var validatePrompt = { + regName: { + //onFocus: "4-20λַ֧Ӣġּ\"-\"\"_\"", + onFocus:"4-20λַ,ֺ֧֡ĸּ\"-\"\"_\"", + succeed: "", + isNull: "û", + error: { + beUsed: "ûѱʹã롣Ǹû¼", + badLength: "ûֻ4-20λַ֮", + badFormat: "ûֻġӢġּ\"-\"\"_\"", + fullNumberName: "ûǴ֣" + }, + onFocusExpand: function() { + $("#morePinDiv").removeClass().addClass("intelligent-error hide"); + } + }, + + pwd: { + onFocus: "6-20λַĸֺͷ", + succeed: "", + isNull: "", + error: { + badLength: "볤ֻ6-20λַ֮", + badFormat: "ֻӢġּ", + simplePwd: "Ƚϼ򵥣бգΪ룬ĸ+ֵ", + weakPwd: "Ƚϼ򵥣бգΪ" + }, + onFocusExpand: function() { + $("#pwdstrength").hide(); + } + }, + pwdRepeat: { + onFocus: "ٴ", + succeed: "", + isNull: "ȷ", + error: { + badLength: "볤ֻ6-20λַ֮", + badFormat2: "벻һ", + badFormat1: "ֻӢġּ" + } + }, + phone: { + onFocus: "ֻ", + succeed: "", + isNull: "ֻ", + error: "" + }, + protocol: { + onFocus: "", + succeed: "", + isNull: "Ķͬ⡶ûעЭ顷", + error: "" + }, + empty: { + onFocus: "", + succeed: "", + isNull: "", + error: "" + } +}; + +var nameold, morePinOld, emailResult; +var namestate = false; +// ص +var validateFunction = { + regName: function(option) { + $("#intelligent-regName").empty().hide(); + var regName = option.value; + if (validateRules.isNull(regName) || regName == '') { + option.element.removeClass(validateSettings.INPUT_style2).removeClass(validateSettings.INPUT_style1); + $("#regName_error").removeClass().empty(); + return; + } + $("#authcodeDiv").show(); + checkPin(option); + }, + + pwd: function(option) { + var str1 = option.value; + var regName = $("#regName").val(); + if ((validateRules.isNull(regName) == false) && (regName != '') && regName == str1) { + $("#pwdstrength").hide(); + validateSettings.error.run(option, "˻Ϣ̫غϣбգ뻻һ"); + return; + } + + //var str2 = $("#pwdRepeat").val(); + $("#pwdRepeat").blur(); + var format = validateRules.isPwd(option.value); + var length = validateRules.betweenLength(option.value, 6, 20); + + $("#pwdstrength").hide(); + if (!length && format) { + validateSettings.error.run(option, option.prompts.error.badLength); + } else if (!length && !format) { + validateSettings.error.run(option, option.prompts.error.badFormat); + } else if (length && !format) { + validateSettings.error.run(option, option.prompts.error.badFormat); + } else if (validateRules.weakPwd(str1)) { + validateSettings.error.run(option, option.prompts.error.weakPwd); + } else { + + validateSettings.succeed.run(option); + validateFunction.pwdstrength(); + if (validateRules.simplePwd(str1)) { + $("#pwd_error").removeClass().addClass("focus"); + $("#pwd_error").empty().html(option.prompts.error.simplePwd); + return; + } + } + // if (str2 == str1) { + // $("#pwdRepeat").focus(); + // } + }, + pwdRepeat: function(option) { + var str1 = option.value; + var str2 = $("#pwd").val(); + var length = validateRules.betweenLength(option.value, 6, 20); + var format2 = validateRules.isPwdRepeat(str1, str2); + var format1 = validateRules.isPwd(str1); + if (!length) { + validateSettings.error.run(option, option.prompts.error.badLength); + } else { + if (!format1) { + validateSettings.error.run(option, option.prompts.error.badFormat1); + } else { + if (!format2) { + validateSettings.error.run(option, option.prompts.error.badFormat2); + } else { + validateSettings.succeed.run(option); + } + } + } + }, + // mobileCode: function(option) { + // var bool = validateRules.isNull(option.value); + // if (bool) { + // validateSettings.error.run(option, option.prompts.error); + // return; + // } else { + // validateSettings.succeed.run(option); + // } + // }, + protocol: function(option) { + if (option.element.attr("checked") == true) { + option.element.attr("sta", validateSettings.succeed.state); + option.errorEle.html(""); + } else { + option.element.attr("sta", validateSettings.isNull.state); + option.succeedEle.removeClass(validateSettings.succeed.style); + } + }, + pwdstrength: function() { + var element = $("#pwdstrength"); + var value = $("#pwd").val(); + if (value.length >= 6 && validateRules.isPwd(value)) { + $("#pwd_error").removeClass('focus'); + $("#pwd_error").empty(); + element.show(); + var level = pwdLevel(value); + switch (level) { + case 1: + element.removeClass().addClass("strengthA"); + break; + case 2: + element.removeClass().addClass("strengthB"); + break; + case 3: + element.removeClass().addClass("strengthC"); + break; + default: + break; + } + } else { + element.hide(); + } + }, + checkGroup: function(elements) { + for (var i = 0; i < elements.length; i++) { + if (elements[i].checked) { + return true; + } + } + return false; + }, + checkSelectGroup: function(elements) { + for (var i = 0; i < elements.length; i++) { + if (elements[i].value == -1) { + return false; + } + } + return true; + }, + + FORM_submit: function(elements) { + var bool = true; + for (var i = 0; i < elements.length; i++) { + if ($(elements[i]).attr("sta") == 2) { + bool = true; + } else { + bool = false; + break; + } + } + + return bool; + } +}; + +// û +var checkpin = -10; +function checkPin(option) { + var pin = option.value; + if (!validateRules.betweenLength(pin.replace(/[^\x00-\xff]/g, "**"), 4, 20)) { + validateSettings.error.run(option, option.prompts.error.badLength); + return false; + } + + if (!validateRules.isUid(pin)) { + validateSettings.error.run(option, option.prompts.error.badFormat); + return; + } + if (validateRules.fullNumberName(pin)) { + validateSettings.error.run(option, option.prompts.error.fullNumberName); + return; + } + if (!namestate || nameold != pin) { + if (nameold != pin) { + nameold = pin; + option.errorEle.html("С"); + $.getJSON("../validateuser/isPinEngaged?pin=" + escape(pin) + "&r=" + Math.random(), + function(date) { + checkpin = date.success; + if (date.success == 0) { + validateSettings.succeed.run(option); + namestate = true; + } else if (date.success == 2) { + validateSettings.error.run(option, "û˷Ƿ"); + namestate = false; + } else { + validateSettings.error.run(option, "" + option.prompts.error.beUsed.replace("{1}", option.value) + ""); + namestate = false; + morePinOld = date.morePin; + if (date.morePin != null && date.morePin.length > 0) { + var html = "" + for (var i = 0; i < date.morePin.length; i++) { + html += "
    " + } + $("#morePinGroom").empty(); + $("#morePinGroom").html(html); + $("#morePinDiv").removeClass().addClass("intelligent-error"); + } + } + }); + } else { + + if (checkpin == 2) { + validateSettings.error.run(option, "û˷Ƿ"); + } else { + validateSettings.error.run(option, "" + option.prompts.error.beUsed.replace("{1}", option.value) + ""); + if (morePinOld != null && morePinOld.length > 0) { + $("#morePinDiv").removeClass().addClass("intelligent-error"); + } + } + namestate = false; + } + } else { + validateSettings.succeed.run(option); + } +} + +function selectMe(option) { + $("#morePinDiv").removeClass().addClass("intelligent-error hide"); + $("#regName").val(option.value); + $("#regName").blur(); +} +// ̷ֻ֤ +function sendMobileCode() { + if ($("#sendMobileCode").attr("disabled")) { + return; + } + mobileCodeHide(); + var mobile = $("#phone").val(); + if (validateRules.isNull(mobile)) { + $("#phone_error").removeClass().addClass("error").html("ֻ"); + $("#phone_error").show(); + return; + } + if (!validateRules.isMobile(mobile)) { + $("#phone_error").removeClass().addClass("error").html("ֻʽȷֻ"); + $("#phone_error").show(); + return; + } + $('#mobileCode').removeClass("highlight2"); + // ֻǷ + $.getJSON("../validateuser/isMobileEngaged?mobile=" + mobile + "&r=" + Math.random(), + function(result) { + if (result.success == 0) { + $('#phone').removeClass().addClass("text"); + $("#phone_error").html(""); + $("#phone_error").hide(); + $("#phone_succeed").removeClass().addClass("blank succeed"); + mobileFlags = true; + sendmCode(); + } + + if (result.success == 1) { + $('#phone').removeClass().addClass('text highlight3'); + $("#phone_error").html("ֻעᣬעὫԭ˺Ž"); + $("#phone_error").removeClass().addClass("cue"); + $("#phone_error").show(); + $("#phone_succeed").removeClass().addClass("blank cue-ico"); + mobileFlags = false; + var state = $("#state").val(); + if (state == "unbind") { + sendmCode(); + } else { + mobileEngagedStyle(); + } + } + + if (result.success == 2) { + $('#phone').removeClass().addClass('text highlight2'); + $("#phone_error").html("ֻעᲢ󶨣3ڲɸİ"); + $("#phone_error").removeClass().addClass("error"); + $("#phone_error").show(); + $("#phone_succeed").removeClass().addClass(""); + mobileFlags = false; + } + }); + +} +// ֻע֤ᷢtarget +function sendmCode() { + if ($("#sendMobileCode").attr("disabled") || delayFlag == false) { + return; + } + var state = $("#state").val(); + if (state != "unbind") { + $("#rebind").remove(); + $("#mobileCodeDiv").show(); + } + $("#sendMobileCode").attr("disabled", "disabled"); + jQuery.ajax({ + type: "get", + url: "../notifyuser/mobileCode?state=" + state + "&mobile=" + $("#phone").val() + "&r=" + Math.random(), + success: function(result) { + if (result) { + var obj = eval(result); + if (obj.rs == 1 || obj.remain) { + $("#mobileCode_error").addClass("hide"); + $("#dyMobileButton").html("120»ȡ"); + if (obj.remain) { + $("#mobileCodeSucMessage").empty().html(obj.remain); + } else { + if (state == "unbind") { + $("#mobileCode_error").removeClass().addClass("cue").empty().html("Уѷ,עɹֻŽԭʺŽ"); + $("#mobileCode_error").show(); + } else { + $("#mobileCode_error").removeClass().empty().html("֤ѷͣնš"); + $("#mobileCode_error").show(); + } + } + + setTimeout(countDown, 1000); + $("#sendMobileCode").removeClass().addClass("btn btn-15").attr("disabled", "disabled"); + $("#mobileCode").removeAttr("disabled"); + } + if (obj.rs == -1) { + mobileCodeError("緱æԺ»ȡ֤"); + } + if (obj.info) { + if (obj.info == "ֻѱʹã") { + mobileEngagedStyle(); + } else { + mobileCodeError(obj.info); + } + + } + + if (obj.rs == -2) { + mobileCodeError("緱æԺ»ȡ֤"); + } + } + } + }); +} +// ֤֤target +function sendmCode1() { + if ($("#sendMobileCode1").attr("disabled") || delayFlag1 == false) { + return; + } + $("#rebind1").remove(); + $("#mobileCodeDiv1").show(); + $("#sendMobileCode1").attr("disabled", "disabled"); + var state = $("#state").val(); + jQuery.ajax({ + type: "get", + url: "../notifyuser/mobileCode?state=" + state + "&mobile=" + $("#phone1").val() + "&r=" + Math.random(), + success: function(result) { + if (result) { + var obj = eval(result); + if (obj.rs == 1 || obj.remain) { + $("#mobileCode1_error").addClass("hide"); + $("#dyMobileButton1").html("120»ȡ"); + if (obj.remain) { + $("#mobileCodeSucMessage1").empty().html(obj.remain); + } else { + if (state == "unbind") { + $("#mobileCodeSucMessage1").removeClass().addClass("cue").empty().html("Уѷ,עɹֻŽԭʺŽ"); + } else { + $("#mobileCodeSucMessage1").empty().html("֤ѷͣնš"); + } + } + + setTimeout(countDown1, 1000); + $("#sendMobileCode1").removeClass().addClass("btn btn-15").attr("disabled", "disabled"); + $("#mobileCode1").removeAttr("disabled"); + } + if (obj.rs == -1) { + $("#mobileCode1_error").html("緱æԺ»ȡ֤"); + $("#mobileCode1_error").removeClass().addClass("error"); + $("#mobileCode1_error").show(); + $("#sendMobileCode1").removeClass().addClass("btn").removeAttr("disabled"); + } + if (obj.info) { + if (obj.info == "ֻѱʹã") { + mobileEngagedStyle1(); + } else { + $("#mobileCode1_error").html(obj.info); + $("#mobileCode1_error").removeClass().addClass("error"); + $("#mobileCode1_error").show(); + $("#sendMobileCode1").removeClass().addClass("btn").removeAttr("disabled"); + } + } + + if (obj.rs == -2) { + $("#mobileCode1_error").html("緱æԺ»ȡ֤"); + $("#mobileCode1_error").removeClass().addClass("error"); + $("#mobileCode1_error").show(); + $("#sendMobileCode1").removeClass().addClass("btn").removeAttr("disabled"); + } + } + } + }); +} +// ̷ֻ֤ +function sendMobileCode1() { + if ($("#sendMobileCode1").attr("disabled")) { + return; + } + var mobile = $("#phone1").val(); + if (validateRules.isNull(mobile)) { + $('#phone1').addClass('highlight2'); + $("#phone1_succeed").removeClass().addClass("blank error-ico"); + $("#phone1_error").removeClass().addClass("error").html("ֻ"); + $("#phone1_error").show(); + return; + } + if (!validateRules.isMobile(mobile)) { + $("#phone1_error").removeClass().addClass("error").html("ֻʽȷֻ"); + $("#phone1_error").show(); + $("#phone1_succeed").removeClass().addClass("blank error-ico"); + return; + } + + var mobile = $("#phone1").val(); + if (mobile == "") { + $('#phone1').removeClass().addClass("text"); + $("#phone1_error").hide(); + $('#phone1_succeed').removeClass('error-ico'); + mobileFlag = false; + return; + } + if (!validateRules.isMobile(mobile)) { + $("#phone1_error").html("ֻʽȷֻ"); + $("#phone1_error").removeClass().addClass("error"); + $("#phone1_succeed").removeClass().addClass("blank error-ico"); + $("#phone1_error").show(); + $('#phone1').removeClass("highlight1").addClass('highlight2'); + mobileFlag = false; + return; + } + $("#mobileCode1_error").removeClass().empty(); + $("#mobileCode1_error").hide(); + $('#mobileCode1').removeClass("highlight2"); + // ֻǷ + $.getJSON("../validateuser/isMobileEngaged?mobile=" + mobile + "&r=" + Math.random(), + function(result) { + if (result.success == 0) { + $('#phone1').removeClass().addClass("text"); + $("#phone1_error").html(""); + $("#phone1_error").hide(); + $("#phone1_succeed").removeClass().addClass("blank succeed"); + mobileFlags = true; + sendmCode1(); + return; + } + if (result.success == 1) { + $('#phone1').removeClass().addClass('text highlight3'); + $("#phone1_error").html("ֻעᣬעὫԭ˺Ž"); + $("#phone1_error").removeClass().addClass("cue"); + $("#phone1_error").show(); + $("#phone1_succeed").removeClass().addClass("blank cue-ico"); + mobileFlags = false; + var state = $("#state").val(); + if (state == "unbind") { + sendmCode1(); + } else { + mobileEngagedStyle1(); + } + return; + } + if (result.success == 2) { + $('#phone1').removeClass().addClass('text highlight2'); + $("#phone1_error").html("ֻעᲢ󶨣3ڲɸİ"); + $("#phone1_error").removeClass().addClass("error"); + $("#phone1_error").show(); + $("#phone1_succeed").removeClass().addClass("blank error-ico"); + // $("#sendMobileCode1").attr("disabled", "disabled"); + mobileFlags = false; + } + }); +} + +var oldEmail, emailCheckResult; +// ֤Ϣд +function sendRegMail() { + var mail = $("#mail").val(); + var authcode1 = $("#authcode1").val(); + if (mail == "") { + $("#mail_error").removeClass().addClass("error").html(""); + $("#mail_error").show(); + $('#mail_succeed').addClass('error-ico'); + $('#mail').addClass('highlight2'); + return; + } + var email = strTrim(mail); + var format = validateRules.isEmail(email); + var format2 = validateRules.betweenLength(email, 0, 50); + if (!format) { + $("#mail_error").html("ַȷ"); + $('#mail_succeed').addClass('error-ico'); + $('#mail').addClass('highlight2'); + return; + } else { + if (!format2) { + $('#mail_error').removeClass().addClass("error"); + $("#mail_error").html("ַӦ4-50ַ֮"); + $('#mail_succeed').addClass('error-ico'); + $('#mail').removeClass("highlight1").addClass('highlight2'); + return; + } else { + // if (oldEmail == email) { + // if (emailCheckResult == 1) { + // emailEngagedStyle(); + // return; + // } + // if (emailCheckResult == 2) { + // emailFormatErrorStyle(); + // return; + // } + // return; + // } + // oldEmail = email; + $.getJSON("../validateuser/isEmailEngaged?email=" + escape(email) + "&r=" + Math.random(), + function(result) { + emailResult = result.success; + emailCheckResult = emailResult; + // δ֤ ע + if (emailResult == 0) { + $("#emailMg").val(email); + $("#authcodeMg").val(authcode1); + jdThickBoxclose(); + $("#dyMobileButton1").html("ȡ֤"); + jQuery.jdThickBox({ + type: "text", + width: 500, + height: 260, + source: $('#box01').html(), + title: "ֻ֤", + _close_val: "", + _con: "opinioncon", + _titleOn: true + }); + } + if (emailResult == 1) { + emailEngagedStyle(); + return; + } + if (emailResult == 2) { + emailFormatErrorStyle(); + return; + } + }); + + } + } +} + +function emailEngagedStyle() { + $('#mail_succeed').addClass('error-ico'); + $('#mail_error').removeClass().addClass("error"); + $("#mail_error").html("ѱʹã"); +} + +function emailFormatErrorStyle() { + $('#mail_succeed').addClass('error-ico'); + $('#mail_error').removeClass().addClass("error"); + $("#mail_error").html("ַȷ"); +} + +// ֤ ֻ֤ ύע +function mobileReg() { + var mail = $("#emailMg").val(); + var authcode = $("#authcodeMg").val(); + var email = strTrim(mail); + var format = validateRules.isEmail(email); + var format2 = validateRules.betweenLength(email, 0, 50); + if (!format) { + $("#mail_error").html("ַȷ"); + return; + } else if (!format2) { + $("#mail_error").html("ַӦ4-50ַ֮"); + return; + } + + var mobile = $("#phone1").val(); + var phonevalue = $("#phone").val(); + var mobileCode = $("#mobileCode1").val(); + if (mobile == "") { + $('#phone1').addClass('highlight2'); + $("#phone1_error").removeClass().addClass("error").html("ֻ"); + $("#phone1_error").show(); + $("#phone1_succeed").removeClass().addClass("blank error-ico"); + } + + if (mobileCode == "") { + $('#mobileCode1').addClass('highlight2'); + $("#mobileCodeSucMessage1").empty(); + $("#mobileCodeSucMessage1").removeClass(); + $("#mobileCode1_error").html("֤"); + $("#mobileCode1_error").removeClass().addClass("error"); + $("#mobileCode1_error").show(); + return; + } + if (mobile == "") { + $('#phone1').addClass('highlight2'); + $("#phone1_error").removeClass().addClass("error").html("ֻ"); + $("#phone1_error").show(); + $("#phone1_succeed").removeClass().addClass("blank error-ico"); + return; + } else if (validateRules.isNull(mobile) || !validateRules.isMobile(mobile)) { + $("#phone1_error").html("ֻʽȷֻ"); + $("#phone1_error").removeClass().addClass("error"); + $("#phone1_succeed").removeClass().addClass("blank error-ico"); + $("#phone1_error").show(); + $('#phone1').removeClass().addClass('text highlight2'); + $("#mobileCodeDiv1").show(); + mobileFlag = false; + return; + } + var state = $("#state").val(); + if (state == "unbind") { + mobileFlag = true; + } + if (mobileFlag) { + var paramList = $("#personRegForm").serialize() + "&email=" + email; + var temp = paramList.replace("phone=" + phonevalue, "phone=" + mobile); + var params = temp.replace("mobileCode=", "mobileCode=" + mobileCode); + params = params.replace("authcode=", "authcode=" + authcode); + $.ajax({ + type: "POST", + url: "../register/sendRegEmail?r=" + Math.random() + "&" + location.search.substring(1), + contentType: "application/x-www-form-urlencoded; charset=utf-8", + data: params, + success: function(result) { + var obj = eval(result); + var emailResult = obj.success; + var key = obj.k; + if (emailResult == 0) { + jdThickBoxclose(); + jQuery.jdThickBox({ + type: "text", + width: 510, + height: 280, + source: '
    ' + '
    ' + '' + '
    ' + '
    ˻ȫ
    ' + '
    ' + '
    ' + '
    ' + 'ϵͳ ' + $("#emailMg").val() + ' һ֤ʼ¼䣬ʼе֤2δյʼ·' + '
    ' + '
    ' + '
    ' + '¼' + // +'޸' + + '' + '
    ' + '
    ', + title: "ܰʾ", + _close_val: "", + _con: "opinioncon", + _titleOn: true + }); + + initEmailLoginUrl(email); + } else { + $("#mobileCodeSucMessage1").removeClass().empty(); + $("#mobileCode1_error").html(obj.info); + $("#mobileCode1_error").removeClass().addClass("error"); + $("#mobileCode1_error").show(); + $("#sendMobileCode1").removeClass().addClass("btn").removeAttr("disabled"); + } + } + }); + } +} +function mobileCodeError(content) { + $("#mobileCode_error").html(content); + $("#mobileCode_error").removeClass().addClass("error"); + $("#mobileCode_error").show(); + $("#sendMobileCode").removeClass().addClass("btn").removeAttr("disabled"); +} +function mobileCodeHide() { + $("#mobileCode_error").html(""); + $("#mobileCode_error").removeClass().addClass("error"); + $("#mobileCode_error").hide(); +} +var delayTime = 120; +var delayFlag = true; +function countDown() { + delayTime--; + $("#sendMobileCode").attr("disabled", "disabled"); + $("#dyMobileButton").html(delayTime + '»ȡ'); + if (delayTime == 1) { + delayTime = 120; + $("#mobileCodeSucMessage").removeClass().empty(); + $("#dyMobileButton").html("ȡ֤"); + $("#mobileCode_error").addClass("hide"); + $("#sendMobileCode").removeClass().addClass("btn").removeAttr("disabled"); + delayFlag = true; + } else { + delayFlag = false; + setTimeout(countDown, 1000); + } +} +var delayTime1 = 120; +var delayFlag1 = true; +function countDown1() { + delayTime1--; + $("#sendMobileCode1").attr("disabled", "disabled"); + $("#dyMobileButton1").html(delayTime1 + '»ȡ'); + if (delayTime1 == 1) { + delayTime1 = 120; + $("#mobileCodeSucMessage1").removeClass().empty(); + $("#dyMobileButton1").html("ȡ֤"); + $("#mobileCode1_error").removeClass().empty(); + $("#mobileCode1_error").hide(); + $("#sendMobileCode1").removeClass().addClass("btn").removeAttr("disabled"); + delayFlag1 = true; + } else { + delayFlag1 = false; + countDown1.timer = setTimeout(countDown1, 1000); + } +} +countDown1.timer = ''; +function strTrim(str) { + return str.replace(/(^\s*)|(\s*$)/g, ""); +} + +$("#regName").blur(function() { + setTimeout(function() { + if ($("#schoolid").val() == "") { + $("#schoolinput").val(""); + $("#hnschool").val("-1"); + $("#hnschool").attr("sta", 0); + $("#schoolinput_succeed").removeClass("succeed"); + } else { + $("#hnschool").val("1"); + $("#hnschool").attr("sta", 2); + $("#schoolinput_error").html(""); + $("#schoolinput_succeed").addClass("succeed"); + } + $('#intelligent-school').hide().empty(); + $("#hnseli").val("-1"); + }, + 200) +}) + +function showHideProtocol() { + var protocolNode = $('.protocol-box'); + if (!protocolNode.is(':hidden')) { + protocolNode.hide(); + } else { + protocolNode.show(); + } + return false; +} + +function validateRegName() { + var loginName = $("#regName").val(); + if (validateRules.isNull(loginName) || loginName == '') { + $("#regName").val(""); + $("#regName").attr({ + "class": "text highlight2" + }); + $("#regName_error").html("û").show().attr({ + "class": "error" + }); + return false; + } + return true; +} +$("#regist .tab li").hover(function() { + if ($(this).hasClass("curr")) {} else { + $(this).addClass("new"); + } +}, +function() { + if ($(this).hasClass("curr")) {} else { + $(this).removeClass("new"); + } +}) + +$("#registsubmit").hover(function() { + $(this).addClass("hover-btn") +}, +function() { + + $(this).removeClass("hover-btn") +}) + +// ֻý¼ +function phoneFocus() { + var mobile = $("#phone").val(); + if (oldMobile == mobile && mobile != "") { + return; + } + $("#phone_succeed").removeClass("blank succeed"); + $('#phone').removeClass().addClass('text highlight1'); + $("#phone_error").removeClass().addClass("focus").html("֤øֻŵ¼һ"); + $("#phone_error").show(); + $('#phone_succeed').removeClass('error-ico'); +} +//ֻý¼ +function phoneOtherFocus() { + var mobile = $("#phone").val(); + if (oldMobile == mobile && mobile != "") { + return; + } + $("#phone_succeed").removeClass("blank succeed"); + $('#phone').removeClass().addClass('text highlight1'); + $("#phone_error").removeClass().addClass("focus").html("ֻ"); + $("#phone_error").show(); + $('#phone_succeed').removeClass('error-ico'); +} +// ֻý¼ +function phone1Focus() { + var mobile1 = $("#phone1").val(); + if (oldMobile1 == mobile1 && mobile1 != "") { + return; + } + $("#phone1_succeed").removeClass(); + $('#phone1').removeClass().addClass('text highlight1'); + $("#phone1_error").removeClass().addClass("focus").html("֤øֻŵ¼һ"); + $("#phone1_error").show(); + $('#phone1_succeed').removeClass('error-ico'); +} + +var oldMobile, mobileResult; +// ֻ̼ +function phoneBlur() { + var mobile = $("#phone").val(); + + if (mobile == "") { + $('#phone').removeClass().addClass('text'); + $("#phone_error").removeClass().html(""); + $("#phone_error").hide(); + $("#rebind").remove(); + $("#mobileCodeDiv").show(); + $("#phone_succeed").removeClass().addClass(""); + oldMobile = mobile; + mobileFlags = false; + return; + } + if (oldMobile == mobile && mobile != "") { + // δ޸ֻ + // showMobileCheckResult(mobileResult); + return; + } + oldMobile = mobile; + if (validateRules.isNull(mobile) || !validateRules.isMobile(mobile)) { + $('#phone').removeClass().addClass('text highlight2'); + $("#phone_error").html("ֻʽȷֻ"); + $("#phone_error").removeClass().addClass("error"); + $("#phone_error").show(); + $("#phone_succeed").removeClass().addClass(""); + $("#rebind").remove(); + $("#mobileCodeDiv").show(); + mobileFlags = false; + return; + } + $("#mobileCodeSucMessage").removeClass().empty(); + $("#mobileCode_error").html(""); + $("#mobileCode_error").hide(); + $("#state").val(""); + // ֻǷ + $.getJSON("../validateuser/isMobileEngaged?mobile=" + mobile + "&r=" + Math.random(), + function(result) { + + mobileResult = result.success; + // if (mobileResult != 2) { + // if ($("#sendMobileCode").attr("disabled")) { + // return; + // } + // $("#sendMobileCode").removeAttr("disabled"); + // } + $("#sendMobileCode").removeAttr("disabled"); + if (result.success == 0) { + mobileOkStyle(); + } + + if (result.success == 1) { + mobileEngagedStyle(); + } + + if (result.success == 2) { + mobileBindedStyle(); + // $("#sendMobileCode").attr("disabled", "disabled"); + } + }); +} +//ֻ̼ +function phoneKeyup() { + var mobile = $("#phone").val(); + var mobileLength=mobile.length; + if(mobileLength != 11) + { + return; + } + if (mobile == "") { + $('#phone').removeClass().addClass('text'); + $("#phone_error").removeClass().html(""); + $("#phone_error").hide(); + $("#rebind").remove(); + $("#mobileCodeDiv").show(); + $("#phone_succeed").removeClass().addClass(""); + oldMobile = mobile; + mobileFlags = false; + return; + } + if (oldMobile == mobile && mobile != "") { + // δ޸ֻ + // showMobileCheckResult(mobileResult); + return; + } + oldMobile = mobile; + if (validateRules.isNull(mobile) || !validateRules.isMobile(mobile)) { + $('#phone').removeClass().addClass('text highlight2'); + $("#phone_error").html("ֻʽȷֻ"); + $("#phone_error").removeClass().addClass("error"); + $("#phone_error").show(); + $("#phone_succeed").removeClass().addClass(""); + $("#rebind").remove(); + $("#mobileCodeDiv").show(); + mobileFlags = false; + return; + } + $("#mobileCodeSucMessage").removeClass().empty(); + $("#mobileCode_error").html(""); + $("#mobileCode_error").hide(); + $("#state").val(""); + // ֻǷ + $.getJSON("../validateuser/isMobileEngaged?mobile=" + mobile + "&r=" + Math.random(), + function(result) { + + mobileResult = result.success; + // if (mobileResult != 2) { + // if ($("#sendMobileCode").attr("disabled")) { + // return; + // } + // $("#sendMobileCode").removeAttr("disabled"); + // } + $("#sendMobileCode").removeAttr("disabled"); + if (result.success == 0) { + mobileOkStyle(); + } + + if (result.success == 1) { + mobileEngagedStyle(); + } + + if (result.success == 2) { + mobileBindedStyle(); + // $("#sendMobileCode").attr("disabled", "disabled"); + } + }); +} + +//ֻ̼ +function phoneOtherBlur() { + var mobile = $("#phone").val(); + + if (mobile == "") { + $('#phone').removeClass().addClass('text'); + $("#phone_error").removeClass().html(""); + $("#phone_error").hide(); + $("#phone_succeed").removeClass().addClass(""); + oldMobile = mobile; + mobileFlags = false; + return; + } + if (oldMobile == mobile && mobile != "") { + // δ޸ֻ + // showMobileCheckResult(mobileResult); + return; + } + oldMobile = mobile; + if (validateRules.isNull(mobile) || !validateRules.isMobile(mobile)) { + $('#phone').removeClass().addClass('text highlight2'); + $("#phone_error").html("ֻʽȷֻ"); + $("#phone_error").removeClass().addClass("error"); + $("#phone_error").show(); + $("#phone_succeed").removeClass().addClass(""); + mobileFlags = false; + return; + } + // ֻǷ + $.getJSON("../validateuser/isMobileEngaged?mobile=" + mobile + "&r=" + Math.random(), + function(result) { + + mobileResult = result.success; + // if (mobileResult != 2) { + // if ($("#sendMobileCode").attr("disabled")) { + // return; + // } + // $("#sendMobileCode").removeAttr("disabled"); + // } + $("#sendMobileCode").removeAttr("disabled"); + if (result.success == 0) { + mobileOkStyle(); + } + + if (result.success == 1 || result.success == 2) { + $('#phone').removeClass().addClass('text highlight2'); + $("#phone_error").html("ֻѱ󶨣ֻ"); + $("#phone_error").removeClass().addClass("error"); + $("#phone_error").show(); + $("#phone_succeed").removeClass().addClass(""); + mobileFlags = false; + } + + }); +} +//ֻ̼ +function phoneOtherKeyup() { + var mobile = $("#phone").val(); + var mobileLength=mobile.length; + if(mobileLength != 11) + { + return; + } + if (mobile == "") { + $('#phone').removeClass().addClass('text'); + $("#phone_error").removeClass().html(""); + $("#phone_error").hide(); + $("#phone_succeed").removeClass().addClass(""); + oldMobile = mobile; + mobileFlags = false; + return; + } + if (oldMobile == mobile && mobile != "") { + // δ޸ֻ + // showMobileCheckResult(mobileResult); + return; + } + oldMobile = mobile; + if (validateRules.isNull(mobile) || !validateRules.isMobile(mobile)) { + $('#phone').removeClass().addClass('text highlight2'); + $("#phone_error").html("ֻʽȷֻ"); + $("#phone_error").removeClass().addClass("error"); + $("#phone_error").show(); + $("#phone_succeed").removeClass().addClass(""); + mobileFlags = false; + return; + } + // ֻǷ + $.getJSON("../validateuser/isMobileEngaged?mobile=" + mobile + "&r=" + Math.random(), + function(result) { + + mobileResult = result.success; + // if (mobileResult != 2) { + // if ($("#sendMobileCode").attr("disabled")) { + // return; + // } + // $("#sendMobileCode").removeAttr("disabled"); + // } + $("#sendMobileCode").removeAttr("disabled"); + if (result.success == 0) { + mobileOkStyle(); + } + + if (result.success == 1 || result.success == 2) { + $('#phone').removeClass().addClass('text highlight2'); + $("#phone_error").html("ֻѱ󶨣ֻ"); + $("#phone_error").removeClass().addClass("error"); + $("#phone_error").show(); + $("#phone_succeed").removeClass().addClass(""); + mobileFlags = false; + } + }); +} +function showMobileCheckResult(result) { + if (result == 0) { + mobileOkStyle(); + } + if (result == 1) { + mobileEngagedStyle(); + } + if (result == 2) { + mobileBindedStyle(); + } +} + +function mobileOkStyle() { + $('#phone').removeClass().addClass("text"); + $("#phone_error").html(""); + $("#phone_error").hide(); + $("#phone_succeed").removeClass().addClass("blank succeed"); + $("#mobileCode_error").removeClass().empty(); + $("#mobileCodeDiv").show(); + $("#rebind").remove(); + $("#mobileCodeDiv").show(); + mobileFlags = true; +} + +function mobileBindedStyle() { + $('#phone').removeClass().addClass('text highlight2'); + $("#phone_error").html("ֻעᲢ󶨣3ڲɸİ"); + $("#phone_error").removeClass().addClass("error"); + $("#phone_error").show(); + $("#phone_succeed").removeClass().addClass(""); + $("#rebind").remove(); + $("#mobileCodeDiv").show(); + mobileFlags = false; +} + +function mobileEngagedStyle() { + $('#phone').removeClass().addClass('text highlight3'); + $("#phone_error").html("ֻעᣬעὫԭ˺Ž"); + $("#phone_error").removeClass().addClass("cue"); + $("#phone_error").show(); + $("#phone_succeed").removeClass().addClass("blank cue-ico"); + $("#rebind").remove(); + $('#dphone').after('
     
    ע
    '); + $("#mobileCodeDiv").hide(); + mobileFlags = false; +} +function showMobileCheckResult1(result) { + if (result == 0) { + mobileOkStyle1(); + } + if (result == 1) { + mobileEngagedStyle1(); + } + if (result == 2) { + mobileBindedStyle1(); + } +} +function mobileOkStyle1() { + $('#phone1').removeClass().addClass("text"); + $("#phone1_error").removeClass().addClass("success"); + $("#phone1_error").html("ֻſ"); + $("#phone1_succeed").removeClass().addClass("blank succeed"); + $("#mobileCodeDiv1").show(); + $("#dmcode1").show(); + $("#rebind1").remove(); + mobileFlag = true; + return; +} + +function mobileBindedStyle1() { + $('#phone1').removeClass().addClass('text highlight2'); + $("#phone1_error").html("ֻעᲢ󶨣3ڲɸİ"); + $("#phone1_error").removeClass().addClass("error"); + $("#phone1_succeed").removeClass().addClass("blank error-ico"); + $("#phone1_error").show(); + $('#phone1').removeClass("highlight1").addClass('highlight2'); + $("#sendMobileCode1").attr("disabled", "disabled"); + $("#mobileCodeDiv1").show(); + $("#rebind1").remove(); + mobileFlag = false; + return; +} + +function mobileEngagedStyle1() { + $('#phone1').removeClass().addClass('text highlight3'); + $("#phone1_error").html("ֻעᣬעὫԭ˺Ž"); + $("#phone1_error").removeClass().addClass("cue"); + $("#phone1_succeed").removeClass().addClass("blank cue-ico"); + $("#phone1_error").show(); + $("#rebind1").remove(); + $('#dphone1').after('
     
    '); + $("#mobileCodeDiv1").hide(); + mobileFlag = false; + return; +} +// ֻʧȥ¼ +var mobileFlag = false; +var oldMobile1, mobileResult1; +function phone1Blur() { + var mobile = $("#phone1").val(); + if (mobile == "") { + $('#phone1').removeClass().addClass("text"); + $("#phone1_error").hide(); + $('#phone1_succeed').removeClass(); + $("#rebind1").remove(); + $("#dmcode1").show(); + $("#mobileCodeDiv1").show(); + oldMobile1 = mobile; + mobileFlag = false; + return; + } + if (oldMobile1 == mobile && mobile != "") { + // δ޸ֻ + // showMobileCheckResult1(mobileResult1); + return; + } + oldMobile1 = mobile; + + if (validateRules.isNull(mobile) || !validateRules.isMobile(mobile)) { + $("#phone1_error").html("ֻʽȷֻ"); + $("#phone1_error").removeClass().addClass("error"); + $("#phone1_succeed").removeClass().addClass("blank error-ico"); + $("#phone1_error").show(); + $('#phone1').removeClass().addClass('text highlight2'); + $("#mobileCodeDiv1").show(); + $("#rebind1").remove(); + $("#dmcode1").show(); + mobileFlag = false; + return; + } + $("#state").val(""); + $("#mobileCodeSucMessage1").removeClass().empty(); + $("#mobileCode1_error").removeClass().empty(); + $("#mobileCode1_error").hide(); + $('#mobileCode1').removeClass("highlight2"); + // ֻǷ + $.getJSON("../validateuser/isMobileEngaged?mobile=" + mobile + "&r=" + Math.random(), + function(result) { + // mobileResult1 = result.success; + // if (mobileResult1 != 2) { + // if ($("#sendMobileCode1").attr("disabled")) { + // return; + // } + // $("#sendMobileCode1").removeAttr("disabled"); + // } + $("#sendMobileCode1").removeAttr("disabled"); + if (result.success == 0) { + mobileOkStyle1(); + } + + if (result.success == 1) { + mobileEngagedStyle1(); + } + + if (result.success == 2) { + mobileBindedStyle1(); + // $("#sendMobileCode1").attr("disabled", "disabled"); + } + }); +} +function phone1Keyup() { + var mobile = $("#phone1").val(); + var mobileLength=mobile.length; + if(mobileLength != 11) + { + return; + } + if (mobile == "") { + $('#phone1').removeClass().addClass("text"); + $("#phone1_error").hide(); + $('#phone1_succeed').removeClass(); + $("#rebind1").remove(); + $("#dmcode1").show(); + $("#mobileCodeDiv1").show(); + oldMobile1 = mobile; + mobileFlag = false; + return; + } + if (oldMobile1 == mobile && mobile != "") { + // δ޸ֻ + // showMobileCheckResult1(mobileResult1); + return; + } + oldMobile1 = mobile; + + if (validateRules.isNull(mobile) || !validateRules.isMobile(mobile)) { + $("#phone1_error").html("ֻʽȷֻ"); + $("#phone1_error").removeClass().addClass("error"); + $("#phone1_succeed").removeClass().addClass("blank error-ico"); + $("#phone1_error").show(); + $('#phone1').removeClass().addClass('text highlight2'); + $("#mobileCodeDiv1").show(); + $("#rebind1").remove(); + $("#dmcode1").show(); + mobileFlag = false; + return; + } + $("#state").val(""); + $("#mobileCodeSucMessage1").removeClass().empty(); + $("#mobileCode1_error").removeClass().empty(); + $("#mobileCode1_error").hide(); + $('#mobileCode1').removeClass("highlight2"); + // ֻǷ + $.getJSON("../validateuser/isMobileEngaged?mobile=" + mobile + "&r=" + Math.random(), + function(result) { + // mobileResult1 = result.success; + // if (mobileResult1 != 2) { + // if ($("#sendMobileCode1").attr("disabled")) { + // return; + // } + // $("#sendMobileCode1").removeAttr("disabled"); + // } + $("#sendMobileCode1").removeAttr("disabled"); + if (result.success == 0) { + mobileOkStyle1(); + } + + if (result.success == 1) { + mobileEngagedStyle1(); + } + + if (result.success == 2) { + mobileBindedStyle1(); + // $("#sendMobileCode1").attr("disabled", "disabled"); + } + }); +} +// ̶֤ý¼ +function mobileCodeFocus() { + $('#mobileCode').removeClass().addClass('text text-1 highlight1'); + $("#mobileCode_error").hide(); +} +// ̶֤ʧȥ¼ +function mobileCodeBlur() { + $('#mobileCode').removeClass().addClass("text text-1"); + $("#mobileCode_error").hide(); +} +// ̶֤ý¼ +function mobileCode1Focus() { + $('#mobileCode1').removeClass().addClass('text text-1 highlight1'); + $("#mobileCode1_error").hide(); +} +// ̶֤ʧȥ¼ +function mobileCode1Blur() { + $('#mobileCode1').removeClass().addClass("text text-1"); + $("#mobileCode1_error").hide(); + $('#mobileCode1_succeed').removeClass('error-ico'); +} +// ť¼ +function unbind() { + $("#state").val("unbind"); + $("#mobileCodeDiv").show(); + $("#rebind").remove(); + // sendmCode(); + sendMobileCode(); +} +// ̽ť¼ +function unbind1() { + $("#state").val("unbind"); + $("#mobileCodeDiv1").show(); + $("#rebind1").remove(); + sendMobileCode1(); +} +// ûЭ +$(function() { + $('#protocol').click(function() { + jQuery.jdThickBox({ + type: "text", + title: "ûעЭ", + width: 922, + height: 450, + source: "
    " + "
    " + "
    " + "
    " + "

    ûעЭ

    " + + + "

    " + " Э뾩վ\"վ\"ַwww.jd.comߣ¼Ϊ\"\"֮;վԼϸĶעЭ飬\"ͬⲢ\"ť󣬱Э鼴ɶ˫Լķļ

    " + "
    1 վȷϺͽ
    " + + + "

    " + " 1.1վĸӷȨȨ龩СûͬעЭע򣬲ܳΪվʽûûȷϣЭǴ˫ȨԼʼЧǿԹ涨˫رԼģ涨" + "

    " + + + "

    " + " 1.2ûͬⱾЭģΪûȷԼܱվµӦȨΪܹеΡ

    " + + + "

    " + " 1.318£ֻڸĸ໤˵ļ໤²ʹñվ

    " + + + "

    " + " 1.4л񹲺͹½ʩ֮ķΧڶԾܾ񡢹رû˻༭ݻȡȨ

    " + "
    2 վ
    " + + + "

    " + " 2.1ͨΪûṩϢȷûȫͬⱾЭ鼰վ涨£Ȩʹñվط

    " + + + "

    " + " 2.2û׼豸ͳе¿֧1豸ڵԻնˡƽرװã2֧ѡ豸÷ѡֻѵȡ" + "

    " + "
    3 ûϢ
    " + + + "

    " + " 3.1ûӦгվṩעϣûͬṩעʵ׼ȷϷЧûעб䶯ģӦʱעϡûṩעϲϷʵ׼ȷ꾡ģûеӦμҾֹûʹþȨ" + "

    " + + + "

    " + " 3.2ûڱվµȻʱ漰ûʵ/ơͨŵַϵ绰˽ϢģվϸܣǵõûȨй涨վ¶û˽Ϣ" + "

    " + + + "

    " + " 3.3ûעɹ󣬽û˻ϢԸݱվ涨ı롣ûӦı桢ʹû롣ûκηǷʹû˺Żڰȫ©֪ͨվ򹫰ر" + "

    " + + + "

    " + " 3.4ûͬ⣬ӵͨʼŵ绰ʽڱվעᡢûջ˷ͶϢȸ֪ϢȨ

    " + + + "

    " + " 3.5ûýڱվעõ˻ʹãûӦеɴ˲ȫΣʵʹ˳еΡ

    " + + + "

    " + " 3.6ûͬ⣬ȨʹûעϢûϢ¼ûע˻֤ݱȫڹ֤֤ȡ

    " + "
    4 û
    " + + + "

    Эݹطɷƶûͬϸ

    " + + + "

    " + " 1ô򷢱ɿܡƻܷͷɡʵʩۣɿ߸ȨƷƶȵۣɿѹҡƻͳһĵۣɿޡӡƻŽۣ" + "

    " + + + "

    " + " 2й½⴫Ϣʱййط棻

    " + + + "

    " + " 3ñվϴǮȡҵܡȡϢΥ" + "

    " + + + "

    " + " 4øűվת뱾վҼϢϵͳ

    " + + + "

    " + " 5ô򷢱κΥġɧԵġ˵ġԵġԵġ˺Եġӹ׵ģġĵϢϣ

    " + + + "

    " + " 6ô򷢱𺦹ṫ漰ҰȫϢϻۣ

    " + + + "

    " + " 7ý˴±ֹΪ

    " + + + "

    " + " 8ڱվע˻IJԾӪ

    " + + + "

    " + " 9÷κַȨ̱Ȩ֪ʶȨϷȨݣ

    " + + + "

    " + " ûӦʱעرվʱ޸ĵĸϷ涨

    " + + + "

    " + " վɾվڸ಻Ϸ߻ʵϢݶ֪ͨûȨ

    " + + + "

    " + " ûδϹ涨ģվȨжϲȡͣرûʺŵȴʩûԼϵۺΪеΡ

    " + "
    5 ƷϢ
    " + + + "

    " + " վϵƷ۸ǷлƷϢʱпܷ䶯վر֪ͨվƷϢӴȻվᾡŬ֤ƷϢ׼ȷԣ֪Ļصȿ͹ԭڣվҳʾϢܻһͺԻԴ֪Ϥ⣻ӭһĽ

    " + + + "

    ΪƷͷΪ\"Ʒ\"\"\"

    " + "
    6
    " + + + "

    " + " 6.1¶ʱϸȷƷơ۸ͺš񡢳ߴ硢ϵַ绰ջ˵Ϣջû˲һµģջ˵Ϊ˼ʾΪûΪ˼ʾûӦջ˵Ϊ˼ʾķɺеΡ" + "

    " + + + "

    " + " 6.2ǿԹ涨⣬˫Լ£վ۷չʾƷͼ۸ϢҪԼ룬µʱдϣƷۿ֧ʽջˡϵʽջַͬеص㣩ͬзʽݣϵͳɵĶϢǼϢϵͳдԶɵݣ۷ĺͬҪԼ۷յĶϢֻ۷ڶжƷӲֿʵֱʱ" + " ƷΪ־Ϊ۷֮ʵֱƷ˺ͬϵһݶﶩ˶Ʒ۷ֻ˲Ʒʱ۷֮ʵֱƷ˺ͬϵֻ۷ʵֱ˶жƷʱ۷֮ͶиʵֱƷųͬϵʱ¼ڱվע˻ѯĶ״̬" + "

    " + + + "

    " + " 6.3г仯ԺҵŬԿƵصӰ죬վ޷֤ύĶϢϣƷл⹺ƷȱȨȡ" + "

    " + "
    7
    " + + + "

    " + " 7.1۷Ʒ͵ָջַڱվгͻʱΪοʱ䣬οʱļǸݿ״Ĵ̺ͻʱ䡢ͻصĻϹƵóġ

    " + "" + "

    " + " 7.2ɶӳٻ޷͵ȣ۷еӳ͵Σ

    " + + + "

    " + " 1ûṩϢ󡢵ַϸԭµģ" + "

    " + + + "

    " + " 2ʹǩգ޷ͻӳ͵ģ

    " + + + "

    " + " 3Ʊصµģ

    " + + + "

    " + " 4ɿصµģ磺Ȼֺͨϡͻսȡ

    " + "
    8 Ȩ֪ʶȨ
    " + + + "

    " + " 8.1ûһܱЭ飬ûκʱڱվκʽϢݣڿͻۡͻѯ໰µϢݣIJƲȨκοתõȨȨƲȨڣȨȨȨչȨȨӳȨ㲥ȨϢ紫ȨȨıȨȨȨԼӦȨеתȨȫҲɳתøУûͬ⾩ȨκȨϡ" + "

    " + + + "

    " + " 8.2ЭѾɡл񹲺͹Ȩڶʮ2011Ȩȷطɹ涨ƲȨȨתЭ飬ЧûھվϷκȨƷݣ۸õγڱЭ鶩ǰDZЭ鶩" + "

    " + + + "

    " + " 8.3ûͬⲢѳ˽ⱾЭŵѷڱվϢκʽȨκηʽʹãڸվýʹã

    " + + + "

    " + " 8.4DZվ,ӵдվݼԴȨȺϷȨ,ܹҷɱ,ȨʱضԱЭ鼰վݽ޸ģڱվ֪ͨûڷ޶ȷΧڣԱЭ鼰վӵнȨ" + "

    " + + + "

    " + " 8.5ǿԹ涨⣬δȷر,κελ˲κηʽǷȫ򲿷ָơתءáӡץȡʽʹñվϢݣ򣬾Ȩ׷䷨Ρ" + "

    " + "

    " + " 8.6վǵϢ֡ͼʶťͼꡢͼļƬΡءݱ༭ǾṩߵIJƲй͹ʰȨıվݵĻǾƲй͹ʰȨıվǾ˾Ӧ̵IJƲй͹ʰȨı" + "

    " + "
    9 Ƽŵ
    " + "

    " + " ȷ˵,վĻʽͨվṩȫϢݡϡƷͷ񣬾\"״\"\"\"Ļṩġ

    " + + + "

    " + " ȷ˵,ԱվӪڱվϵϢݡϡƷκʽġʾĬʾ򵣱л񹲺͹й涨⣩" + "

    " + "

    " + " վĻʽͨվṩȫϢݡϡƷͷӱվĵżϢûвкɷ֡

    " + "

    " + " 򲻿ɿվ޷Ƶԭʹվϵͳ޷ʹõϽ޷ɻʧйصϢ¼ȣؾЭƺˡ

    " + "
    10 Э¼ûע
    " + " ݹҷɷ仯վӪҪȨԱЭʱؽ޸ģ޸ĺЭһڱվϼЧԭЭ顣ûʱ¼Э飻ûʱעͰЭ鼰վ档ûͬºЭ飬ӦֹܾͣվݱЭṩķûʹñվṩķģΪͬºЭ顣ʹñվ֮ǰĶЭ鼰վĹ档" + " ЭκһΪֹЧκɲִУӦΪɷֵҲӰκЧԺͿִԡ" + "
    11 ɹϽ
    " + " ЭĶִкͽͼĽӦл񹲺͹½֮Чɣͻ򣩡 緢Эִ֮ʱЩȫɹ涨½ͣЧЧ" + " ԼͱЭݻִзκ飬˫ӦѺЭ̽Э̲ʱκһйϽȨл񹲺͹½Ժϡ" + "
    12
    " + "

    " + " 12.1վָɻ򱸰ľվӪ塣

    " + + + "

    " + " 12.2ûߵĺϷȨЭ鼰վϷĸݣΪ˸õġӱΪûṩ񡣱վӭûͽ飬Ľܲʱ޸ıЭ鼰վϵĸ" + "

    " + + + "

    " + " 12.3ЭԺ塢Ӵ֡»ߡбȷʽʶûĶ

    " + "

    " + " 12.4Э·\"ͬⲢ\"ťΪȫܱЭ飬ڵ֮ǰٴȷ֪ϤȫⱾЭȫݡ

    " + "
    " + "
    " + " " + "
    " + "
    " + "
    " + "
    ", + _autoReposi: true + }); + }); +}); \ No newline at end of file diff --git "a/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\347\254\224\350\256\260/day05/note/javascript/\346\263\250\345\206\214\351\241\265\351\235\242/\346\263\250\345\206\214-\344\270\252\344\272\272\347\224\250\346\210\267_files/jdValidate.regSuccess.js" "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\347\254\224\350\256\260/day05/note/javascript/\346\263\250\345\206\214\351\241\265\351\235\242/\346\263\250\345\206\214-\344\270\252\344\272\272\347\224\250\346\210\267_files/jdValidate.regSuccess.js" new file mode 100644 index 00000000..d5abc0d4 --- /dev/null +++ "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\347\254\224\350\256\260/day05/note/javascript/\346\263\250\345\206\214\351\241\265\351\235\242/\346\263\250\345\206\214-\344\270\252\344\272\272\347\224\250\346\210\267_files/jdValidate.regSuccess.js" @@ -0,0 +1,398 @@ +function isEmail(str) { + return new RegExp("^\\w+((-\\w+)|(\\.\\w+))*\\@[A-Za-z0-9]+((\\.|-)[A-Za-z0-9]+)*\\.[A-Za-z0-9]+$").test(str); +} +//ʼʼUrl +function initEmailLoginUrl(email) { + var loginUrl = getEmailLoginUrl(email); + if (loginUrl != null) { + $("#emailLogin").attr("href", loginUrl); + $("#emailLogin").show(); + } else { + $("#emailLogin").hide(); + } +} +var emailLoginUrlArrar = ['@gmail.com=http://mail.google.com/', + '@163.com=http://mail.163.com/', + '@126.com=http://mail.126.com/', + '@hotmail.com=http://www.hotmail.com/', + '@sina.com=http://mail.sina.com/', + '@vip.sina.com=http://mail.sina.com/', + '@tom.com=http://mail.tom.com/', + '@qq.com=http://mail.qq.com/', + '@139.com=http://mail.10086.cn/', + '@msn.com=https://login.live.com/login.srf', + '@sohu.com=http://mail.sohu.com/']; + +function getEmailLoginUrl(email) { + + email = email.toLowerCase(); + if (email == "" || !isEmail(email)) { + return null; + } + var index = email.indexOf("@"); + var emailSurfix = email.substring(index, email.length); + for (var i = 0; i < emailLoginUrlArrar.length; i++) { + if (emailLoginUrlArrar[i].indexOf(emailSurfix) == 0) { + return emailLoginUrlArrar[i].split("=")[1]; + } + } + return null; +} + +function getKey() { + return $("#authKey").val(); +} + + +var oldNick = $("#nicknameInput").val(); +(function () { + var reviseNickname = $('.reg-nickname-revise'), + regNickname = $('#changeNickname'); + var usernamePrompt = { + onFocus: "4-20λַġӢġּ_-", + succeed: "", + isNull: "ûdz", + error: { + beUsed: "dzѱʹã", + badLength: "dzƳֻ4-20λַ֮", + badFormat: "dzֻġӢġּ_-", + fullNumberName: "dzƲȫΪ", + bannedWord: "dzư˷Ƿ" + } + } + regNickname.click(function () { + var self = $(this); + $("#username_error").empty(); + self.parent().hide(); + reviseNickname.show().focus(); + return false; + }); + //focus + reviseNickname.find('.text').focus(function () { + $(this).addClass('hover'); + if ($('#username_error').length <= 0) { + var div = $('
    '); + $(this).parent().append(div); + } + var uError = $('#username_error'); + uError.html(usernamePrompt.onFocus); + uError.addClass('focus').removeClass('error'); + }); + reviseNickname.find('.text').blur(function () { + $(this).removeClass('hover'); + var uError = $('#username_error'); + uError.html(''); + }); + //nickname save + reviseNickname.find('.j_save').click(function () { + nicknameParentNode = regNickname.parent(); + var nickName = reviseNickname.find('.text').val(); + var username = $.trim(nickName); + if (username == oldNick) { + $("#orgNick").html(username); + nicknameParentNode.show(); + reviseNickname.hide(); + oldNick = username; + return; + } + var div = $('#username_error'); + if (div.length <= 0) { + var div = $('
    '); + $(this).parent().append(div); + } + + if (!userCheck(username)) { + return; + } + div.html("С"); + $.getJSON("../validate/newNickname?nickname=" + escape(username) + "&k=" + getKey() + "&r=" + Math.random(), function (date) { + if (date.success == 1) { + $("#orgNick").html(username); + $("#safeNick").html(date.safeNick); + nicknameParentNode.show(); + reviseNickname.hide(); + hello(); + oldNick = username; + } + if (date.success == 0) { + div.html(usernamePrompt.error.beUsed.replace("{1}", username)); + return; + } + if (date.success == -5) { + div.html(usernamePrompt.error.bannedWord); + return; + } + if (date.success == -1) { + div.html("ϵͳ쳣Ժ"); + return; + } + if (date.success == -4) { + window.location.href = "http://reg.jd.com/reg/expire"; + return; + } + }) + }); + + function badFormat(str) { + return new RegExp("^[A-Za-z0-9_\\-\\u4e00-\\u9fa5]+$").test(str); + } + + // û֤ + function userCheck(username) { + var div = $('#username_error'); + var reg = /^[A-Za-z0-9_\\-\\u4e00-\\u9fa5]+$/; //û + var fullNumber = /^[0-9]+$/ // + div.removeClass('focus').addClass('error'); + if (username == "") { + div.html(usernamePrompt.isNull); + return false; + } + var len = betweenLength(username.replace(/[^\x00-\xff]/g, "**"), 4, 20); + if (!len) { + div.html(usernamePrompt.error.badLength); + return false; + } + else if (badFormat(username) == false) { + div.html(usernamePrompt.error.badFormat); + return false; + } + else if (fullNumber.test(username)) { + div.html(usernamePrompt.error.fullNumberName); + return false; + } + return true; + } + + // max and min length + function betweenLength(str, _min, _max) { + return (str.length >= _min && str.length <= _max); + } + + $('#emailStr').focus(function () { + + $("#emailStr").removeClass().addClass("text focus-color"); + $("#email_error").html(""); + $("#email_focus").html("֤ø¼һ롣"); + }); + $('#emailStr').blur(function () { + $("#email_focus").html(""); + var content = $("#emailStr").val(); + if (content == "õĵ") { + $("#emailStr").removeClass().addClass("text"); + } + }); + $('#sendEmail').click(function () { + sendEmail(); + }); + function strTrim(str) { + return str.replace(/(^\s*)|(\s*$)/g, ""); + } + + function mobileCodeError(content) { + $("#smsFocusMessage").removeClass().addClass("sms-tips mobileError").html(content); + $("#smsFocusDiv").removeClass().addClass("item"); + } + + $('#mobileCode').focus(function () { + $("#smsErrorDiv").removeClass().addClass("item hide"); + $("#smsErrorMessage").html(""); + }); + // ֻ֤ + $('#moblie').bind('focus', function () { + $("#smsErrorDiv").removeClass().addClass("item hide"); + $("#smsErrorMessage").text(""); + $("#smsFocusDiv").removeClass().addClass("item"); + $("#smsFocusMessage").removeClass().addClass("sms-tips mobileFocus").text("֤øֻŵ¼һ롣"); + }); + + $('#moblie').bind('blur', function () { + $("#smsFocusDiv").removeClass().addClass("item hide"); + $("#smsFocusMessage").text(""); + }); + $('#send-sms').click(function () { + var mobile = $('#moblie').val(); + if (mobile == "") { + mobileCodeError("ֻ"); + return; + } + mobile = strTrim(mobile); + var isMobile = new RegExp("^0?(13|15|17|18|14)[0-9]{9}$").test(mobile); + if (!isMobile || mobile.length > 11) { + mobileCodeError("ֻʽȷֻš"); + return; + } + var self = $(this); + var data = 'mobile=' + mobile + "&k=" + $("#k").val() + '&r=' + Math.random(); + $.ajax({ + type: "POST", + url: "../notify/regValidateCode", + data: data, + success: function (result) { + if (result) { + var obj = eval(result); + if (obj.rs == 1 || obj.remain) { + $("#smsErrorMessage").text(""); + $("#smsFocusDiv").removeClass().addClass("item hide"); + $("#smsErrorDiv").removeClass().addClass("item hide"); + if (obj.remain) { + $("#successMes").empty().html(obj.remain); + } else { + $("#successMes").empty().html("֤ѷͣնš"); + } + $('#sms-box').show(); + $('#validateMobileDiv').removeClass().addClass("sms-btn"); + $("#mobileCode").empty(); + $('#moblie').attr("disabled", "disabled"); + $('#send-sms').attr("disabled", "disabled"); + var i = 120; + self.removeClass().addClass('reg-btn1').val(i + '»ȡ'); + var timer = setInterval(function () { + i--; + self.val(i + '»ȡ'); + if (i <= 0) { + clearInterval(timer); + self.addClass('reg-btn2').val('ȡ֤'); + $("#successMes").empty(); + $('#moblie').attr("disabled", ""); + $('#send-sms').attr("disabled", ""); + + } + }, 1000); + } + if (obj.rs == -1) { + mobileCodeError("ֻʽȷֻš"); + } + if (obj.rs == -5) { + window.location.href = "http://reg.jd.com/reg/expire"; + //mobileCodeError("ʧЧǰȫ֤"); + } + if (obj.rs == -7) { + mobileCodeError("ֻ֤뵽˻ȫ鿴"); + } + if (obj.info) { + mobileCodeError(obj.info); + } + if (obj.rs == -2) { + mobileCodeError("緱æԺ»ȡ֤"); + } + } + } + }); + }); + + function clientError(content) { + $("#smsErrorMessage").html(content); + $("#smsErrorDiv").removeClass().addClass("item"); + $("#smsErrorDiv").show(); + } + + var flg = false; + $('#toValidate').click(function () { + var mobile = $('#moblie').val(); + mobile = $.trim(mobile); + if (mobile == "") { + clientError("ֻ") + return false; + } + var mobileCode = $('#mobileCode').val(); + mobileCode = $.trim(mobileCode); + if (mobileCode == "") { + clientError("֤") + return false; + } + var k = $("#k").val(); + var data = 'mobile=' + mobile + "&mobileCode=" + mobileCode + "&k=" + k + '&r=' + Math.random(); + $.getJSON("../reg/validateMobile?" + data, function (result) { + if (result.success == 1) { + window.location.href = "http://reg.jd.com/reg/best?ret=" + result.ret; + return; + } + if (result.success == -1) { + window.location.href = "http://www.jd.com" + return; + } + if (result.success == -2) { + clientError("֤벻ȷѹ"); + return; + } + if (result.success == -3) { + clientError("ֻռ"); + return; + } + if (result.success == -4) { + clientError("ϵͳ쳣Ժ"); + return; + } + if (result.success == -5) { + clientError("ֻ֤뵽˻ȫ鿴"); + return; + } + if (result.success == -7) { + window.location.href = "http://reg.jd.com/reg/expire"; + return; + } + } + ); + }); +})(); + +// +function sleep(numberMillis) { + var now = new Date(); + var exitTime = now.getTime() + numberMillis; + while (true) { + now = new Date(); + if (now.getTime() > exitTime) return; + } +} + +//·ʼ +function reSendEmail(email, key) { + $('#reSendEmailSuccess').hide(); + sleep(500); + $('#reSendEmailSuccess').removeClass().empty(); + email = $.trim(email); + if (email == "" || (isEmail(email) == false)) { + $("#reSendEmailSuccess").removeClass().addClass('check-email-error'); + $("#reSendEmailSuccess").html("Чַ"); + return; + } + var unbind = $("#state").val(); + $.getJSON("../notifyuser/email?email=" + (email) + "&k=" + key + "&state=" + unbind+ "&r=" + Math.random(), function (result) { + if (result.success == 1) { + $('#reSendEmailSuccess').removeClass().empty().html('֤ʼ·'); + $('#reSendEmailSuccess').show(); + initEmailLoginUrl(email); + } + if (result.success == 0) { + $('#reSendEmailSuccess').removeClass().addClass('error').empty().html('ѱʹã'); + $('#reSendEmailSuccess').show(); + } + if (result.success == -1) { + $('#reSendEmailSuccess').removeClass().addClass('error').empty().html('ϵͳ쳣Ժ '); + $('#reSendEmailSuccess').show(); + } + if (result.success == -2) { + $('#reSendEmailSuccess').removeClass().addClass('error').empty().html('뷢֤ʼĴޣ24Сʱԣ'); + $('#reSendEmailSuccess').show(); + } + + if (result.success == -3) { + window.location.href = "http://reg.jd.com/reg/expire"; + return; + } + if (result.success == -4) { + $('#reSendEmailSuccess').removeClass().addClass('error').empty().html('ע'); + $('#reSendEmailSuccess').show(); + return; + } + + if (result.success == -5) { + $('#reSendEmailSuccess').removeClass().addClass('error').empty().html('Чַ'); + $('#reSendEmailSuccess').show(); + return; + } + $('#reSendEmailSuccess').show(); + //setTimeout(hideEmailSendResult, 5000); + }); +} \ No newline at end of file diff --git "a/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\347\254\224\350\256\260/day05/note/javascript/\346\263\250\345\206\214\351\241\265\351\235\242/\346\263\250\345\206\214-\344\270\252\344\272\272\347\224\250\346\210\267_files/jquery-1.2.6.pack.js" "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\347\254\224\350\256\260/day05/note/javascript/\346\263\250\345\206\214\351\241\265\351\235\242/\346\263\250\345\206\214-\344\270\252\344\272\272\347\224\250\346\210\267_files/jquery-1.2.6.pack.js" new file mode 100644 index 00000000..95dd0138 --- /dev/null +++ "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\347\254\224\350\256\260/day05/note/javascript/\346\263\250\345\206\214\351\241\265\351\235\242/\346\263\250\345\206\214-\344\270\252\344\272\272\347\224\250\346\210\267_files/jquery-1.2.6.pack.js" @@ -0,0 +1,11 @@ +/* + * jQuery 1.2.6 - New Wave Javascript + * + * Copyright (c) 2008 John Resig (jquery.com) + * Dual licensed under the MIT (MIT-LICENSE.txt) + * and GPL (GPL-LICENSE.txt) licenses. + * + * $Date: 2008-05-24 14:22:17 -0400 (Sat, 24 May 2008) $ + * $Rev: 5685 $ + */ +eval(function(p,a,c,k,e,r){e=function(c){return(c35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--)r[e(c)]=k[c]||e(c);k=[function(e){return r[e]}];e=function(){return'\\w+'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}('(H(){J w=1b.4M,3m$=1b.$;J D=1b.4M=1b.$=H(a,b){I 2B D.17.5j(a,b)};J u=/^[^<]*(<(.|\\s)+>)[^>]*$|^#(\\w+)$/,62=/^.[^:#\\[\\.]*$/,12;D.17=D.44={5j:H(d,b){d=d||S;G(d.16){7[0]=d;7.K=1;I 7}G(1j d=="23"){J c=u.2D(d);G(c&&(c[1]||!b)){G(c[1])d=D.4h([c[1]],b);N{J a=S.61(c[3]);G(a){G(a.2v!=c[3])I D().2q(d);I D(a)}d=[]}}N I D(b).2q(d)}N G(D.1D(d))I D(S)[D.17.27?"27":"43"](d);I 7.6Y(D.2d(d))},5w:"1.2.6",8G:H(){I 7.K},K:0,3p:H(a){I a==12?D.2d(7):7[a]},2I:H(b){J a=D(b);a.5n=7;I a},6Y:H(a){7.K=0;2p.44.1p.1w(7,a);I 7},P:H(a,b){I D.P(7,a,b)},5i:H(b){J a=-1;I D.2L(b&&b.5w?b[0]:b,7)},1K:H(c,a,b){J d=c;G(c.1q==56)G(a===12)I 7[0]&&D[b||"1K"](7[0],c);N{d={};d[c]=a}I 7.P(H(i){R(c 1n d)D.1K(b?7.V:7,c,D.1i(7,d[c],b,i,c))})},1g:H(b,a){G((b==\'2h\'||b==\'1Z\')&&3d(a)<0)a=12;I 7.1K(b,a,"2a")},1r:H(b){G(1j b!="49"&&b!=U)I 7.4E().3v((7[0]&&7[0].2z||S).5F(b));J a="";D.P(b||7,H(){D.P(7.3t,H(){G(7.16!=8)a+=7.16!=1?7.76:D.17.1r([7])})});I a},5z:H(b){G(7[0])D(b,7[0].2z).5y().39(7[0]).2l(H(){J a=7;1B(a.1x)a=a.1x;I a}).3v(7);I 7},8Y:H(a){I 7.P(H(){D(7).6Q().5z(a)})},8R:H(a){I 7.P(H(){D(7).5z(a)})},3v:H(){I 7.3W(19,M,Q,H(a){G(7.16==1)7.3U(a)})},6F:H(){I 7.3W(19,M,M,H(a){G(7.16==1)7.39(a,7.1x)})},6E:H(){I 7.3W(19,Q,Q,H(a){7.1d.39(a,7)})},5q:H(){I 7.3W(19,Q,M,H(a){7.1d.39(a,7.2H)})},3l:H(){I 7.5n||D([])},2q:H(b){J c=D.2l(7,H(a){I D.2q(b,a)});I 7.2I(/[^+>] [^+>]/.11(b)||b.1h("..")>-1?D.4r(c):c)},5y:H(e){J f=7.2l(H(){G(D.14.1f&&!D.4n(7)){J a=7.6o(M),5h=S.3h("1v");5h.3U(a);I D.4h([5h.4H])[0]}N I 7.6o(M)});J d=f.2q("*").5c().P(H(){G(7[E]!=12)7[E]=U});G(e===M)7.2q("*").5c().P(H(i){G(7.16==3)I;J c=D.L(7,"3w");R(J a 1n c)R(J b 1n c[a])D.W.1e(d[i],a,c[a][b],c[a][b].L)});I f},1E:H(b){I 7.2I(D.1D(b)&&D.3C(7,H(a,i){I b.1k(a,i)})||D.3g(b,7))},4Y:H(b){G(b.1q==56)G(62.11(b))I 7.2I(D.3g(b,7,M));N b=D.3g(b,7);J a=b.K&&b[b.K-1]!==12&&!b.16;I 7.1E(H(){I a?D.2L(7,b)<0:7!=b})},1e:H(a){I 7.2I(D.4r(D.2R(7.3p(),1j a==\'23\'?D(a):D.2d(a))))},3F:H(a){I!!a&&D.3g(a,7).K>0},7T:H(a){I 7.3F("."+a)},6e:H(b){G(b==12){G(7.K){J c=7[0];G(D.Y(c,"2A")){J e=c.64,63=[],15=c.15,2V=c.O=="2A-2V";G(e<0)I U;R(J i=2V?e:0,2f=2V?e+1:15.K;i<2f;i++){J d=15[i];G(d.2W){b=D.14.1f&&!d.at.2x.an?d.1r:d.2x;G(2V)I b;63.1p(b)}}I 63}N I(7[0].2x||"").1o(/\\r/g,"")}I 12}G(b.1q==4L)b+=\'\';I 7.P(H(){G(7.16!=1)I;G(b.1q==2p&&/5O|5L/.11(7.O))7.4J=(D.2L(7.2x,b)>=0||D.2L(7.34,b)>=0);N G(D.Y(7,"2A")){J a=D.2d(b);D("9R",7).P(H(){7.2W=(D.2L(7.2x,a)>=0||D.2L(7.1r,a)>=0)});G(!a.K)7.64=-1}N 7.2x=b})},2K:H(a){I a==12?(7[0]?7[0].4H:U):7.4E().3v(a)},7b:H(a){I 7.5q(a).21()},79:H(i){I 7.3s(i,i+1)},3s:H(){I 7.2I(2p.44.3s.1w(7,19))},2l:H(b){I 7.2I(D.2l(7,H(a,i){I b.1k(a,i,a)}))},5c:H(){I 7.1e(7.5n)},L:H(d,b){J a=d.1R(".");a[1]=a[1]?"."+a[1]:"";G(b===12){J c=7.5C("9z"+a[1]+"!",[a[0]]);G(c===12&&7.K)c=D.L(7[0],d);I c===12&&a[1]?7.L(a[0]):c}N I 7.1P("9u"+a[1]+"!",[a[0],b]).P(H(){D.L(7,d,b)})},3b:H(a){I 7.P(H(){D.3b(7,a)})},3W:H(g,f,h,d){J e=7.K>1,3x;I 7.P(H(){G(!3x){3x=D.4h(g,7.2z);G(h)3x.9o()}J b=7;G(f&&D.Y(7,"1T")&&D.Y(3x[0],"4F"))b=7.3H("22")[0]||7.3U(7.2z.3h("22"));J c=D([]);D.P(3x,H(){J a=e?D(7).5y(M)[0]:7;G(D.Y(a,"1m"))c=c.1e(a);N{G(a.16==1)c=c.1e(D("1m",a).21());d.1k(b,a)}});c.P(6T)})}};D.17.5j.44=D.17;H 6T(i,a){G(a.4d)D.3Y({1a:a.4d,31:Q,1O:"1m"});N D.5u(a.1r||a.6O||a.4H||"");G(a.1d)a.1d.37(a)}H 1z(){I+2B 8J}D.1l=D.17.1l=H(){J b=19[0]||{},i=1,K=19.K,4x=Q,15;G(b.1q==8I){4x=b;b=19[1]||{};i=2}G(1j b!="49"&&1j b!="H")b={};G(K==i){b=7;--i}R(;i-1}},6q:H(b,c,a){J e={};R(J d 1n c){e[d]=b.V[d];b.V[d]=c[d]}a.1k(b);R(J d 1n c)b.V[d]=e[d]},1g:H(d,e,c){G(e=="2h"||e=="1Z"){J b,3X={30:"5x",5g:"1G",18:"3I"},35=e=="2h"?["5e","6k"]:["5G","6i"];H 5b(){b=e=="2h"?d.8f:d.8c;J a=0,2C=0;D.P(35,H(){a+=3d(D.2a(d,"57"+7,M))||0;2C+=3d(D.2a(d,"2C"+7+"4b",M))||0});b-=29.83(a+2C)}G(D(d).3F(":4j"))5b();N D.6q(d,3X,5b);I 29.2f(0,b)}I D.2a(d,e,c)},2a:H(f,l,k){J e,V=f.V;H 3E(b){G(!D.14.2k)I Q;J a=3P.54(b,U);I!a||a.52("3E")==""}G(l=="1y"&&D.14.1f){e=D.1K(V,"1y");I e==""?"1":e}G(D.14.2G&&l=="18"){J d=V.50;V.50="0 7Y 7W";V.50=d}G(l.1I(/4i/i))l=y;G(!k&&V&&V[l])e=V[l];N G(3P.54){G(l.1I(/4i/i))l="4i";l=l.1o(/([A-Z])/g,"-$1").3y();J c=3P.54(f,U);G(c&&!3E(f))e=c.52(l);N{J g=[],2E=[],a=f,i=0;R(;a&&3E(a);a=a.1d)2E.6h(a);R(;i<2E.K;i++)G(3E(2E[i])){g[i]=2E[i].V.18;2E[i].V.18="3I"}e=l=="18"&&g[2E.K-1]!=U?"2F":(c&&c.52(l))||"";R(i=0;i]*?)\\/>/g,H(b,a,c){I c.1I(/^(aK|4f|7E|aG|4T|7A|aB|3n|az|ay|av)$/i)?b:a+">"});J f=D.3k(d).3y(),1v=h.3h("1v");J e=!f.1h("",""]||!f.1h("",""]||f.1I(/^<(aq|22|am|ak|ai)/)&&[1,"<1T>",""]||!f.1h("<4F")&&[2,"<1T><22>",""]||(!f.1h("<22><4F>",""]||!f.1h("<7E")&&[2,"<1T><22><7q>",""]||D.14.1f&&[1,"1v<1v>",""]||[0,"",""];1v.4H=e[1]+d+e[2];1B(e[0]--)1v=1v.5T;G(D.14.1f){J g=!f.1h("<1T")&&f.1h("<22")<0?1v.1x&&1v.1x.3t:e[1]=="<1T>"&&f.1h("<22")<0?1v.3t:[];R(J j=g.K-1;j>=0;--j)G(D.Y(g[j],"22")&&!g[j].3t.K)g[j].1d.37(g[j]);G(/^\\s/.11(d))1v.39(h.5F(d.1I(/^\\s*/)[0]),1v.1x)}d=D.2d(1v.3t)}G(d.K===0&&(!D.Y(d,"3V")&&!D.Y(d,"2A")))I;G(d[0]==12||D.Y(d,"3V")||d.15)k.1p(d);N k=D.2R(k,d)});I k},1K:H(d,f,c){G(!d||d.16==3||d.16==8)I 12;J e=!D.4n(d),40=c!==12,1f=D.14.1f;f=e&&D.3X[f]||f;G(d.2j){J g=/5Q|4d|V/.11(f);G(f=="2W"&&D.14.2k)d.1d.64;G(f 1n d&&e&&!g){G(40){G(f=="O"&&D.Y(d,"4T")&&d.1d)7p"O a3 a1\'t 9V 9U";d[f]=c}G(D.Y(d,"3V")&&d.7i(f))I d.7i(f).76;I d[f]}G(1f&&e&&f=="V")I D.1K(d.V,"9T",c);G(40)d.9Q(f,""+c);J h=1f&&e&&g?d.4G(f,2):d.4G(f);I h===U?12:h}G(1f&&f=="1y"){G(40){d.6B=1;d.1E=(d.1E||"").1o(/7f\\([^)]*\\)/,"")+(3r(c)+\'\'=="9L"?"":"7f(1y="+c*7a+")")}I d.1E&&d.1E.1h("1y=")>=0?(3d(d.1E.1I(/1y=([^)]*)/)[1])/7a)+\'\':""}f=f.1o(/-([a-z])/9H,H(a,b){I b.2r()});G(40)d[f]=c;I d[f]},3k:H(a){I(a||"").1o(/^\\s+|\\s+$/g,"")},2d:H(b){J a=[];G(b!=U){J i=b.K;G(i==U||b.1R||b.4I||b.1k)a[0]=b;N 1B(i)a[--i]=b[i]}I a},2L:H(b,a){R(J i=0,K=a.K;i*",7).21();1B(7.1x)7.37(7.1x)}},H(a,b){D.17[a]=H(){I 7.P(b,19)}});D.P(["6N","4b"],H(i,c){J b=c.3y();D.17[b]=H(a){I 7[0]==1b?D.14.2G&&S.1c["5t"+c]||D.14.2k&&1b["5s"+c]||S.70=="6Z"&&S.1C["5t"+c]||S.1c["5t"+c]:7[0]==S?29.2f(29.2f(S.1c["4y"+c],S.1C["4y"+c]),29.2f(S.1c["2i"+c],S.1C["2i"+c])):a==12?(7.K?D.1g(7[0],b):U):7.1g(b,a.1q==56?a:a+"2X")}});H 25(a,b){I a[0]&&3r(D.2a(a[0],b,M),10)||0}J C=D.14.2k&&3r(D.14.5B)<8H?"(?:[\\\\w*3m-]|\\\\\\\\.)":"(?:[\\\\w\\8F-\\8E*3m-]|\\\\\\\\.)",6L=2B 4v("^>\\\\s*("+C+"+)"),6J=2B 4v("^("+C+"+)(#)("+C+"+)"),6I=2B 4v("^([#.]?)("+C+"*)");D.1l({6H:{"":H(a,i,m){I m[2]=="*"||D.Y(a,m[2])},"#":H(a,i,m){I a.4G("2v")==m[2]},":":{8D:H(a,i,m){I im[3]-0},3a:H(a,i,m){I m[3]-0==i},79:H(a,i,m){I m[3]-0==i},3o:H(a,i){I i==0},3S:H(a,i,m,r){I i==r.K-1},6D:H(a,i){I i%2==0},6C:H(a,i){I i%2},"3o-4u":H(a){I a.1d.3H("*")[0]==a},"3S-4u":H(a){I D.3a(a.1d.5T,1,"4l")==a},"8z-4u":H(a){I!D.3a(a.1d.5T,2,"4l")},6W:H(a){I a.1x},4E:H(a){I!a.1x},8y:H(a,i,m){I(a.6O||a.8x||D(a).1r()||"").1h(m[3])>=0},4j:H(a){I"1G"!=a.O&&D.1g(a,"18")!="2F"&&D.1g(a,"5g")!="1G"},1G:H(a){I"1G"==a.O||D.1g(a,"18")=="2F"||D.1g(a,"5g")=="1G"},8w:H(a){I!a.3R},3R:H(a){I a.3R},4J:H(a){I a.4J},2W:H(a){I a.2W||D.1K(a,"2W")},1r:H(a){I"1r"==a.O},5O:H(a){I"5O"==a.O},5L:H(a){I"5L"==a.O},5p:H(a){I"5p"==a.O},3Q:H(a){I"3Q"==a.O},5o:H(a){I"5o"==a.O},6A:H(a){I"6A"==a.O},6z:H(a){I"6z"==a.O},2s:H(a){I"2s"==a.O||D.Y(a,"2s")},4T:H(a){I/4T|2A|6y|2s/i.11(a.Y)},3T:H(a,i,m){I D.2q(m[3],a).K},8t:H(a){I/h\\d/i.11(a.Y)},8s:H(a){I D.3C(D.3O,H(b){I a==b.T}).K}}},6x:[/^(\\[) *@?([\\w-]+) *([!*$^~=]*) *(\'?"?)(.*?)\\4 *\\]/,/^(:)([\\w-]+)\\("?\'?(.*?(\\(.*?\\))?[^(]*?)"?\'?\\)/,2B 4v("^([:.#]*)("+C+"+)")],3g:H(a,c,b){J d,1t=[];1B(a&&a!=d){d=a;J f=D.1E(a,c,b);a=f.t.1o(/^\\s*,\\s*/,"");1t=b?c=f.r:D.2R(1t,f.r)}I 1t},2q:H(t,o){G(1j t!="23")I[t];G(o&&o.16!=1&&o.16!=9)I[];o=o||S;J d=[o],2o=[],3S,Y;1B(t&&3S!=t){J r=[];3S=t;t=D.3k(t);J l=Q,3j=6L,m=3j.2D(t);G(m){Y=m[1].2r();R(J i=0;d[i];i++)R(J c=d[i].1x;c;c=c.2H)G(c.16==1&&(Y=="*"||c.Y.2r()==Y))r.1p(c);d=r;t=t.1o(3j,"");G(t.1h(" ")==0)6M;l=M}N{3j=/^([>+~])\\s*(\\w*)/i;G((m=3j.2D(t))!=U){r=[];J k={};Y=m[2].2r();m=m[1];R(J j=0,3i=d.K;j<3i;j++){J n=m=="~"||m=="+"?d[j].2H:d[j].1x;R(;n;n=n.2H)G(n.16==1){J g=D.L(n);G(m=="~"&&k[g])1X;G(!Y||n.Y.2r()==Y){G(m=="~")k[g]=M;r.1p(n)}G(m=="+")1X}}d=r;t=D.3k(t.1o(3j,""));l=M}}G(t&&!l){G(!t.1h(",")){G(o==d[0])d.4s();2o=D.2R(2o,d);r=d=[o];t=" "+t.6v(1,t.K)}N{J h=6J;J m=h.2D(t);G(m){m=[0,m[2],m[3],m[1]]}N{h=6I;m=h.2D(t)}m[2]=m[2].1o(/\\\\/g,"");J f=d[d.K-1];G(m[1]=="#"&&f&&f.61&&!D.4n(f)){J p=f.61(m[2]);G((D.14.1f||D.14.2G)&&p&&1j p.2v=="23"&&p.2v!=m[2])p=D(\'[@2v="\'+m[2]+\'"]\',f)[0];d=r=p&&(!m[3]||D.Y(p,m[3]))?[p]:[]}N{R(J i=0;d[i];i++){J a=m[1]=="#"&&m[3]?m[3]:m[1]!=""||m[0]==""?"*":m[2];G(a=="*"&&d[i].Y.3y()=="49")a="3n";r=D.2R(r,d[i].3H(a))}G(m[1]==".")r=D.5m(r,m[2]);G(m[1]=="#"){J e=[];R(J i=0;r[i];i++)G(r[i].4G("2v")==m[2]){e=[r[i]];1X}r=e}d=r}t=t.1o(h,"")}}G(t){J b=D.1E(t,r);d=r=b.r;t=D.3k(b.t)}}G(t)d=[];G(d&&o==d[0])d.4s();2o=D.2R(2o,d);I 2o},5m:H(r,m,a){m=" "+m+" ";J c=[];R(J i=0;r[i];i++){J b=(" "+r[i].1F+" ").1h(m)>=0;G(!a&&b||a&&!b)c.1p(r[i])}I c},1E:H(t,r,h){J d;1B(t&&t!=d){d=t;J p=D.6x,m;R(J i=0;p[i];i++){m=p[i].2D(t);G(m){t=t.8r(m[0].K);m[2]=m[2].1o(/\\\\/g,"");1X}}G(!m)1X;G(m[1]==":"&&m[2]=="4Y")r=62.11(m[3])?D.1E(m[3],r,M).r:D(r).4Y(m[3]);N G(m[1]==".")r=D.5m(r,m[2],h);N G(m[1]=="["){J g=[],O=m[3];R(J i=0,3i=r.K;i<3i;i++){J a=r[i],z=a[D.3X[m[2]]||m[2]];G(z==U||/5Q|4d|2W/.11(m[2]))z=D.1K(a,m[2])||\'\';G((O==""&&!!z||O=="="&&z==m[5]||O=="!="&&z!=m[5]||O=="^="&&z&&!z.1h(m[5])||O=="$="&&z.6v(z.K-m[5].K)==m[5]||(O=="*="||O=="~=")&&z.1h(m[5])>=0)^h)g.1p(a)}r=g}N G(m[1]==":"&&m[2]=="3a-4u"){J e={},g=[],11=/(-?)(\\d*)n((?:\\+|-)?\\d*)/.2D(m[3]=="6D"&&"2n"||m[3]=="6C"&&"2n+1"||!/\\D/.11(m[3])&&"8q+"+m[3]||m[3]),3o=(11[1]+(11[2]||1))-0,d=11[3]-0;R(J i=0,3i=r.K;i<3i;i++){J j=r[i],1d=j.1d,2v=D.L(1d);G(!e[2v]){J c=1;R(J n=1d.1x;n;n=n.2H)G(n.16==1)n.4q=c++;e[2v]=M}J b=Q;G(3o==0){G(j.4q==d)b=M}N G((j.4q-d)%3o==0&&(j.4q-d)/3o>=0)b=M;G(b^h)g.1p(j)}r=g}N{J f=D.6H[m[1]];G(1j f=="49")f=f[m[2]];G(1j f=="23")f=6u("Q||H(a,i){I "+f+";}");r=D.3C(r,H(a,i){I f(a,i,m,r)},h)}}I{r:r,t:t}},4S:H(b,c){J a=[],1t=b[c];1B(1t&&1t!=S){G(1t.16==1)a.1p(1t);1t=1t[c]}I a},3a:H(a,e,c,b){e=e||1;J d=0;R(;a;a=a[c])G(a.16==1&&++d==e)1X;I a},5v:H(n,a){J r=[];R(;n;n=n.2H){G(n.16==1&&n!=a)r.1p(n)}I r}});D.W={1e:H(f,i,g,e){G(f.16==3||f.16==8)I;G(D.14.1f&&f.4I)f=1b;G(!g.24)g.24=7.24++;G(e!=12){J h=g;g=7.3M(h,H(){I h.1w(7,19)});g.L=e}J j=D.L(f,"3w")||D.L(f,"3w",{}),1H=D.L(f,"1H")||D.L(f,"1H",H(){G(1j D!="12"&&!D.W.5k)I D.W.1H.1w(19.3L.T,19)});1H.T=f;D.P(i.1R(/\\s+/),H(c,b){J a=b.1R(".");b=a[0];g.O=a[1];J d=j[b];G(!d){d=j[b]={};G(!D.W.2t[b]||D.W.2t[b].4p.1k(f)===Q){G(f.3K)f.3K(b,1H,Q);N G(f.6t)f.6t("4o"+b,1H)}}d[g.24]=g;D.W.26[b]=M});f=U},24:1,26:{},21:H(e,h,f){G(e.16==3||e.16==8)I;J i=D.L(e,"3w"),1L,5i;G(i){G(h==12||(1j h=="23"&&h.8p(0)=="."))R(J g 1n i)7.21(e,g+(h||""));N{G(h.O){f=h.2y;h=h.O}D.P(h.1R(/\\s+/),H(b,a){J c=a.1R(".");a=c[0];G(i[a]){G(f)2U i[a][f.24];N R(f 1n i[a])G(!c[1]||i[a][f].O==c[1])2U i[a][f];R(1L 1n i[a])1X;G(!1L){G(!D.W.2t[a]||D.W.2t[a].4A.1k(e)===Q){G(e.6p)e.6p(a,D.L(e,"1H"),Q);N G(e.6n)e.6n("4o"+a,D.L(e,"1H"))}1L=U;2U i[a]}}})}R(1L 1n i)1X;G(!1L){J d=D.L(e,"1H");G(d)d.T=U;D.3b(e,"3w");D.3b(e,"1H")}}},1P:H(h,c,f,g,i){c=D.2d(c);G(h.1h("!")>=0){h=h.3s(0,-1);J a=M}G(!f){G(7.26[h])D("*").1e([1b,S]).1P(h,c)}N{G(f.16==3||f.16==8)I 12;J b,1L,17=D.1D(f[h]||U),W=!c[0]||!c[0].32;G(W){c.6h({O:h,2J:f,32:H(){},3J:H(){},4C:1z()});c[0][E]=M}c[0].O=h;G(a)c[0].6m=M;J d=D.L(f,"1H");G(d)b=d.1w(f,c);G((!17||(D.Y(f,\'a\')&&h=="4V"))&&f["4o"+h]&&f["4o"+h].1w(f,c)===Q)b=Q;G(W)c.4s();G(i&&D.1D(i)){1L=i.1w(f,b==U?c:c.7d(b));G(1L!==12)b=1L}G(17&&g!==Q&&b!==Q&&!(D.Y(f,\'a\')&&h=="4V")){7.5k=M;1U{f[h]()}1V(e){}}7.5k=Q}I b},1H:H(b){J a,1L,38,5f,4m;b=19[0]=D.W.6l(b||1b.W);38=b.O.1R(".");b.O=38[0];38=38[1];5f=!38&&!b.6m;4m=(D.L(7,"3w")||{})[b.O];R(J j 1n 4m){J c=4m[j];G(5f||c.O==38){b.2y=c;b.L=c.L;1L=c.1w(7,19);G(a!==Q)a=1L;G(1L===Q){b.32();b.3J()}}}I a},6l:H(b){G(b[E]==M)I b;J d=b;b={8o:d};J c="8n 8m 8l 8k 2s 8j 47 5d 6j 5E 8i L 8h 8g 4K 2y 5a 59 8e 8b 58 6f 8a 88 4k 87 86 84 6d 2J 4C 6c O 82 81 35".1R(" ");R(J i=c.K;i;i--)b[c[i]]=d[c[i]];b[E]=M;b.32=H(){G(d.32)d.32();d.80=Q};b.3J=H(){G(d.3J)d.3J();d.7Z=M};b.4C=b.4C||1z();G(!b.2J)b.2J=b.6d||S;G(b.2J.16==3)b.2J=b.2J.1d;G(!b.4k&&b.4K)b.4k=b.4K==b.2J?b.6c:b.4K;G(b.58==U&&b.5d!=U){J a=S.1C,1c=S.1c;b.58=b.5d+(a&&a.2e||1c&&1c.2e||0)-(a.6b||0);b.6f=b.6j+(a&&a.2c||1c&&1c.2c||0)-(a.6a||0)}G(!b.35&&((b.47||b.47===0)?b.47:b.5a))b.35=b.47||b.5a;G(!b.59&&b.5E)b.59=b.5E;G(!b.35&&b.2s)b.35=(b.2s&1?1:(b.2s&2?3:(b.2s&4?2:0)));I b},3M:H(a,b){b.24=a.24=a.24||b.24||7.24++;I b},2t:{27:{4p:H(){55();I},4A:H(){I}},3D:{4p:H(){G(D.14.1f)I Q;D(7).2O("53",D.W.2t.3D.2y);I M},4A:H(){G(D.14.1f)I Q;D(7).4e("53",D.W.2t.3D.2y);I M},2y:H(a){G(F(a,7))I M;a.O="3D";I D.W.1H.1w(7,19)}},3N:{4p:H(){G(D.14.1f)I Q;D(7).2O("51",D.W.2t.3N.2y);I M},4A:H(){G(D.14.1f)I Q;D(7).4e("51",D.W.2t.3N.2y);I M},2y:H(a){G(F(a,7))I M;a.O="3N";I D.W.1H.1w(7,19)}}}};D.17.1l({2O:H(c,a,b){I c=="4X"?7.2V(c,a,b):7.P(H(){D.W.1e(7,c,b||a,b&&a)})},2V:H(d,b,c){J e=D.W.3M(c||b,H(a){D(7).4e(a,e);I(c||b).1w(7,19)});I 7.P(H(){D.W.1e(7,d,e,c&&b)})},4e:H(a,b){I 7.P(H(){D.W.21(7,a,b)})},1P:H(c,a,b){I 7.P(H(){D.W.1P(c,a,7,M,b)})},5C:H(c,a,b){I 7[0]&&D.W.1P(c,a,7[0],Q,b)},2m:H(b){J c=19,i=1;1B(i=0){J i=g.3s(e,g.K);g=g.3s(0,e)}c=c||H(){};J f="2P";G(d)G(D.1D(d)){c=d;d=U}N{d=D.3n(d);f="6g"}J h=7;D.3Y({1a:g,O:f,1O:"2K",L:d,1J:H(a,b){G(b=="1W"||b=="7J")h.2K(i?D("<1v/>").3v(a.4U.1o(/<1m(.|\\s)*?\\/1m>/g,"")).2q(i):a.4U);h.P(c,[a.4U,b,a])}});I 7},aL:H(){I D.3n(7.7I())},7I:H(){I 7.2l(H(){I D.Y(7,"3V")?D.2d(7.aH):7}).1E(H(){I 7.34&&!7.3R&&(7.4J||/2A|6y/i.11(7.Y)||/1r|1G|3Q/i.11(7.O))}).2l(H(i,c){J b=D(7).6e();I b==U?U:b.1q==2p?D.2l(b,H(a,i){I{34:c.34,2x:a}}):{34:c.34,2x:b}}).3p()}});D.P("7H,7G,7F,7D,7C,7B".1R(","),H(i,o){D.17[o]=H(f){I 7.2O(o,f)}});J B=1z();D.1l({3p:H(d,b,a,c){G(D.1D(b)){a=b;b=U}I D.3Y({O:"2P",1a:d,L:b,1W:a,1O:c})},aE:H(b,a){I D.3p(b,U,a,"1m")},aD:H(c,b,a){I D.3p(c,b,a,"3z")},aC:H(d,b,a,c){G(D.1D(b)){a=b;b={}}I D.3Y({O:"6g",1a:d,L:b,1W:a,1O:c})},aA:H(a){D.1l(D.60,a)},60:{1a:5Z.5Q,26:M,O:"2P",2T:0,7z:"4R/x-ax-3V-aw",7x:M,31:M,L:U,5Y:U,3Q:U,4Q:{2N:"4R/2N, 1r/2N",2K:"1r/2K",1m:"1r/4t, 4R/4t",3z:"4R/3z, 1r/4t",1r:"1r/as",4w:"*/*"}},4z:{},3Y:H(s){s=D.1l(M,s,D.1l(M,{},D.60,s));J g,2Z=/=\\?(&|$)/g,1u,L,O=s.O.2r();G(s.L&&s.7x&&1j s.L!="23")s.L=D.3n(s.L);G(s.1O=="4P"){G(O=="2P"){G(!s.1a.1I(2Z))s.1a+=(s.1a.1I(/\\?/)?"&":"?")+(s.4P||"7u")+"=?"}N G(!s.L||!s.L.1I(2Z))s.L=(s.L?s.L+"&":"")+(s.4P||"7u")+"=?";s.1O="3z"}G(s.1O=="3z"&&(s.L&&s.L.1I(2Z)||s.1a.1I(2Z))){g="4P"+B++;G(s.L)s.L=(s.L+"").1o(2Z,"="+g+"$1");s.1a=s.1a.1o(2Z,"="+g+"$1");s.1O="1m";1b[g]=H(a){L=a;1W();1J();1b[g]=12;1U{2U 1b[g]}1V(e){}G(i)i.37(h)}}G(s.1O=="1m"&&s.1Y==U)s.1Y=Q;G(s.1Y===Q&&O=="2P"){J j=1z();J k=s.1a.1o(/(\\?|&)3m=.*?(&|$)/,"$ap="+j+"$2");s.1a=k+((k==s.1a)?(s.1a.1I(/\\?/)?"&":"?")+"3m="+j:"")}G(s.L&&O=="2P"){s.1a+=(s.1a.1I(/\\?/)?"&":"?")+s.L;s.L=U}G(s.26&&!D.4O++)D.W.1P("7H");J n=/^(?:\\w+:)?\\/\\/([^\\/?#]+)/;G(s.1O=="1m"&&O=="2P"&&n.11(s.1a)&&n.2D(s.1a)[1]!=5Z.al){J i=S.3H("6w")[0];J h=S.3h("1m");h.4d=s.1a;G(s.7t)h.aj=s.7t;G(!g){J l=Q;h.ah=h.ag=H(){G(!l&&(!7.3f||7.3f=="68"||7.3f=="1J")){l=M;1W();1J();i.37(h)}}}i.3U(h);I 12}J m=Q;J c=1b.7s?2B 7s("ae.ac"):2B 7r();G(s.5Y)c.6R(O,s.1a,s.31,s.5Y,s.3Q);N c.6R(O,s.1a,s.31);1U{G(s.L)c.4B("ab-aa",s.7z);G(s.5S)c.4B("a9-5R-a8",D.4z[s.1a]||"a7, a6 a5 a4 5N:5N:5N a2");c.4B("X-9Z-9Y","7r");c.4B("9W",s.1O&&s.4Q[s.1O]?s.4Q[s.1O]+", */*":s.4Q.4w)}1V(e){}G(s.7m&&s.7m(c,s)===Q){s.26&&D.4O--;c.7l();I Q}G(s.26)D.W.1P("7B",[c,s]);J d=H(a){G(!m&&c&&(c.3f==4||a=="2T")){m=M;G(f){7k(f);f=U}1u=a=="2T"&&"2T"||!D.7j(c)&&"3e"||s.5S&&D.7h(c,s.1a)&&"7J"||"1W";G(1u=="1W"){1U{L=D.6X(c,s.1O,s.9S)}1V(e){1u="5J"}}G(1u=="1W"){J b;1U{b=c.5I("7g-5R")}1V(e){}G(s.5S&&b)D.4z[s.1a]=b;G(!g)1W()}N D.5H(s,c,1u);1J();G(s.31)c=U}};G(s.31){J f=4I(d,13);G(s.2T>0)3B(H(){G(c){c.7l();G(!m)d("2T")}},s.2T)}1U{c.9P(s.L)}1V(e){D.5H(s,c,U,e)}G(!s.31)d();H 1W(){G(s.1W)s.1W(L,1u);G(s.26)D.W.1P("7C",[c,s])}H 1J(){G(s.1J)s.1J(c,1u);G(s.26)D.W.1P("7F",[c,s]);G(s.26&&!--D.4O)D.W.1P("7G")}I c},5H:H(s,a,b,e){G(s.3e)s.3e(a,b,e);G(s.26)D.W.1P("7D",[a,s,e])},4O:0,7j:H(a){1U{I!a.1u&&5Z.9O=="5p:"||(a.1u>=7e&&a.1u<9N)||a.1u==7c||a.1u==9K||D.14.2k&&a.1u==12}1V(e){}I Q},7h:H(a,c){1U{J b=a.5I("7g-5R");I a.1u==7c||b==D.4z[c]||D.14.2k&&a.1u==12}1V(e){}I Q},6X:H(a,c,b){J d=a.5I("9J-O"),2N=c=="2N"||!c&&d&&d.1h("2N")>=0,L=2N?a.9I:a.4U;G(2N&&L.1C.2j=="5J")7p"5J";G(b)L=b(L,c);G(c=="1m")D.5u(L);G(c=="3z")L=6u("("+L+")");I L},3n:H(a){J s=[];G(a.1q==2p||a.5w)D.P(a,H(){s.1p(3u(7.34)+"="+3u(7.2x))});N R(J j 1n a)G(a[j]&&a[j].1q==2p)D.P(a[j],H(){s.1p(3u(j)+"="+3u(7))});N s.1p(3u(j)+"="+3u(D.1D(a[j])?a[j]():a[j]));I s.6s("&").1o(/%20/g,"+")}});D.17.1l({1N:H(c,b){I c?7.2g({1Z:"1N",2h:"1N",1y:"1N"},c,b):7.1E(":1G").P(H(){7.V.18=7.5D||"";G(D.1g(7,"18")=="2F"){J a=D("<"+7.2j+" />").6P("1c");7.V.18=a.1g("18");G(7.V.18=="2F")7.V.18="3I";a.21()}}).3l()},1M:H(b,a){I b?7.2g({1Z:"1M",2h:"1M",1y:"1M"},b,a):7.1E(":4j").P(H(){7.5D=7.5D||D.1g(7,"18");7.V.18="2F"}).3l()},78:D.17.2m,2m:H(a,b){I D.1D(a)&&D.1D(b)?7.78.1w(7,19):a?7.2g({1Z:"2m",2h:"2m",1y:"2m"},a,b):7.P(H(){D(7)[D(7).3F(":1G")?"1N":"1M"]()})},9G:H(b,a){I 7.2g({1Z:"1N"},b,a)},9F:H(b,a){I 7.2g({1Z:"1M"},b,a)},9E:H(b,a){I 7.2g({1Z:"2m"},b,a)},9D:H(b,a){I 7.2g({1y:"1N"},b,a)},9M:H(b,a){I 7.2g({1y:"1M"},b,a)},9C:H(c,a,b){I 7.2g({1y:a},c,b)},2g:H(k,j,i,g){J h=D.77(j,i,g);I 7[h.36===Q?"P":"36"](H(){G(7.16!=1)I Q;J f=D.1l({},h),p,1G=D(7).3F(":1G"),46=7;R(p 1n k){G(k[p]=="1M"&&1G||k[p]=="1N"&&!1G)I f.1J.1k(7);G(p=="1Z"||p=="2h"){f.18=D.1g(7,"18");f.33=7.V.33}}G(f.33!=U)7.V.33="1G";f.45=D.1l({},k);D.P(k,H(c,a){J e=2B D.28(46,f,c);G(/2m|1N|1M/.11(a))e[a=="2m"?1G?"1N":"1M":a](k);N{J b=a.6r().1I(/^([+-]=)?([\\d+-.]+)(.*)$/),2b=e.1t(M)||0;G(b){J d=3d(b[2]),2M=b[3]||"2X";G(2M!="2X"){46.V[c]=(d||1)+2M;2b=((d||1)/e.1t(M))*2b;46.V[c]=2b+2M}G(b[1])d=((b[1]=="-="?-1:1)*d)+2b;e.3G(2b,d,2M)}N e.3G(2b,a,"")}});I M})},36:H(a,b){G(D.1D(a)||(a&&a.1q==2p)){b=a;a="28"}G(!a||(1j a=="23"&&!b))I A(7[0],a);I 7.P(H(){G(b.1q==2p)A(7,a,b);N{A(7,a).1p(b);G(A(7,a).K==1)b.1k(7)}})},9X:H(b,c){J a=D.3O;G(b)7.36([]);7.P(H(){R(J i=a.K-1;i>=0;i--)G(a[i].T==7){G(c)a[i](M);a.7n(i,1)}});G(!c)7.5A();I 7}});J A=H(b,c,a){G(b){c=c||"28";J q=D.L(b,c+"36");G(!q||a)q=D.L(b,c+"36",D.2d(a))}I q};D.17.5A=H(a){a=a||"28";I 7.P(H(){J q=A(7,a);q.4s();G(q.K)q[0].1k(7)})};D.1l({77:H(b,a,c){J d=b&&b.1q==a0?b:{1J:c||!c&&a||D.1D(b)&&b,2u:b,41:c&&a||a&&a.1q!=9t&&a};d.2u=(d.2u&&d.2u.1q==4L?d.2u:D.28.5K[d.2u])||D.28.5K.74;d.5M=d.1J;d.1J=H(){G(d.36!==Q)D(7).5A();G(D.1D(d.5M))d.5M.1k(7)};I d},41:{73:H(p,n,b,a){I b+a*p},5P:H(p,n,b,a){I((-29.9r(p*29.9q)/2)+0.5)*a+b}},3O:[],48:U,28:H(b,c,a){7.15=c;7.T=b;7.1i=a;G(!c.3Z)c.3Z={}}});D.28.44={4D:H(){G(7.15.2Y)7.15.2Y.1k(7.T,7.1z,7);(D.28.2Y[7.1i]||D.28.2Y.4w)(7);G(7.1i=="1Z"||7.1i=="2h")7.T.V.18="3I"},1t:H(a){G(7.T[7.1i]!=U&&7.T.V[7.1i]==U)I 7.T[7.1i];J r=3d(D.1g(7.T,7.1i,a));I r&&r>-9p?r:3d(D.2a(7.T,7.1i))||0},3G:H(c,b,d){7.5V=1z();7.2b=c;7.3l=b;7.2M=d||7.2M||"2X";7.1z=7.2b;7.2S=7.4N=0;7.4D();J e=7;H t(a){I e.2Y(a)}t.T=7.T;D.3O.1p(t);G(D.48==U){D.48=4I(H(){J a=D.3O;R(J i=0;i7.15.2u+7.5V){7.1z=7.3l;7.2S=7.4N=1;7.4D();7.15.45[7.1i]=M;J b=M;R(J i 1n 7.15.45)G(7.15.45[i]!==M)b=Q;G(b){G(7.15.18!=U){7.T.V.33=7.15.33;7.T.V.18=7.15.18;G(D.1g(7.T,"18")=="2F")7.T.V.18="3I"}G(7.15.1M)7.T.V.18="2F";G(7.15.1M||7.15.1N)R(J p 1n 7.15.45)D.1K(7.T.V,p,7.15.3Z[p])}G(b)7.15.1J.1k(7.T);I Q}N{J n=t-7.5V;7.4N=n/7.15.2u;7.2S=D.41[7.15.41||(D.41.5P?"5P":"73")](7.4N,n,0,1,7.15.2u);7.1z=7.2b+((7.3l-7.2b)*7.2S);7.4D()}I M}};D.1l(D.28,{5K:{9l:9j,9i:7e,74:9g},2Y:{2e:H(a){a.T.2e=a.1z},2c:H(a){a.T.2c=a.1z},1y:H(a){D.1K(a.T.V,"1y",a.1z)},4w:H(a){a.T.V[a.1i]=a.1z+a.2M}}});D.17.2i=H(){J b=0,1S=0,T=7[0],3q;G(T)ao(D.14){J d=T.1d,4a=T,1s=T.1s,1Q=T.2z,5U=2k&&3r(5B)<9c&&!/9a/i.11(v),1g=D.2a,3c=1g(T,"30")=="3c";G(T.7y){J c=T.7y();1e(c.1A+29.2f(1Q.1C.2e,1Q.1c.2e),c.1S+29.2f(1Q.1C.2c,1Q.1c.2c));1e(-1Q.1C.6b,-1Q.1C.6a)}N{1e(T.5X,T.5W);1B(1s){1e(1s.5X,1s.5W);G(42&&!/^t(98|d|h)$/i.11(1s.2j)||2k&&!5U)2C(1s);G(!3c&&1g(1s,"30")=="3c")3c=M;4a=/^1c$/i.11(1s.2j)?4a:1s;1s=1s.1s}1B(d&&d.2j&&!/^1c|2K$/i.11(d.2j)){G(!/^96|1T.*$/i.11(1g(d,"18")))1e(-d.2e,-d.2c);G(42&&1g(d,"33")!="4j")2C(d);d=d.1d}G((5U&&(3c||1g(4a,"30")=="5x"))||(42&&1g(4a,"30")!="5x"))1e(-1Q.1c.5X,-1Q.1c.5W);G(3c)1e(29.2f(1Q.1C.2e,1Q.1c.2e),29.2f(1Q.1C.2c,1Q.1c.2c))}3q={1S:1S,1A:b}}H 2C(a){1e(D.2a(a,"6V",M),D.2a(a,"6U",M))}H 1e(l,t){b+=3r(l,10)||0;1S+=3r(t,10)||0}I 3q};D.17.1l({30:H(){J a=0,1S=0,3q;G(7[0]){J b=7.1s(),2i=7.2i(),4c=/^1c|2K$/i.11(b[0].2j)?{1S:0,1A:0}:b.2i();2i.1S-=25(7,\'94\');2i.1A-=25(7,\'aF\');4c.1S+=25(b,\'6U\');4c.1A+=25(b,\'6V\');3q={1S:2i.1S-4c.1S,1A:2i.1A-4c.1A}}I 3q},1s:H(){J a=7[0].1s;1B(a&&(!/^1c|2K$/i.11(a.2j)&&D.1g(a,\'30\')==\'93\'))a=a.1s;I D(a)}});D.P([\'5e\',\'5G\'],H(i,b){J c=\'4y\'+b;D.17[c]=H(a){G(!7[0])I;I a!=12?7.P(H(){7==1b||7==S?1b.92(!i?a:D(1b).2e(),i?a:D(1b).2c()):7[c]=a}):7[0]==1b||7[0]==S?46[i?\'aI\':\'aJ\']||D.71&&S.1C[c]||S.1c[c]:7[0][c]}});D.P(["6N","4b"],H(i,b){J c=i?"5e":"5G",4f=i?"6k":"6i";D.17["5s"+b]=H(){I 7[b.3y()]()+25(7,"57"+c)+25(7,"57"+4f)};D.17["90"+b]=H(a){I 7["5s"+b]()+25(7,"2C"+c+"4b")+25(7,"2C"+4f+"4b")+(a?25(7,"6S"+c)+25(7,"6S"+4f):0)}})})();',62,669,'|||||||this|||||||||||||||||||||||||||||||||||if|function|return|var|length|data|true|else|type|each|false|for|document|elem|null|style|event||nodeName|||test|undefined||browser|options|nodeType|fn|display|arguments|url|window|body|parentNode|add|msie|css|indexOf|prop|typeof|call|extend|script|in|replace|push|constructor|text|offsetParent|cur|status|div|apply|firstChild|opacity|now|left|while|documentElement|isFunction|filter|className|hidden|handle|match|complete|attr|ret|hide|show|dataType|trigger|doc|split|top|table|try|catch|success|break|cache|height||remove|tbody|string|guid|num|global|ready|fx|Math|curCSS|start|scrollTop|makeArray|scrollLeft|max|animate|width|offset|tagName|safari|map|toggle||done|Array|find|toUpperCase|button|special|duration|id|copy|value|handler|ownerDocument|select|new|border|exec|stack|none|opera|nextSibling|pushStack|target|html|inArray|unit|xml|bind|GET|isReady|merge|pos|timeout|delete|one|selected|px|step|jsre|position|async|preventDefault|overflow|name|which|queue|removeChild|namespace|insertBefore|nth|removeData|fixed|parseFloat|error|readyState|multiFilter|createElement|rl|re|trim|end|_|param|first|get|results|parseInt|slice|childNodes|encodeURIComponent|append|events|elems|toLowerCase|json|readyList|setTimeout|grep|mouseenter|color|is|custom|getElementsByTagName|block|stopPropagation|addEventListener|callee|proxy|mouseleave|timers|defaultView|password|disabled|last|has|appendChild|form|domManip|props|ajax|orig|set|easing|mozilla|load|prototype|curAnim|self|charCode|timerId|object|offsetChild|Width|parentOffset|src|unbind|br|currentStyle|clean|float|visible|relatedTarget|previousSibling|handlers|isXMLDoc|on|setup|nodeIndex|unique|shift|javascript|child|RegExp|_default|deep|scroll|lastModified|teardown|setRequestHeader|timeStamp|update|empty|tr|getAttribute|innerHTML|setInterval|checked|fromElement|Number|jQuery|state|active|jsonp|accepts|application|dir|input|responseText|click|styleSheets|unload|not|lastToggle|outline|mouseout|getPropertyValue|mouseover|getComputedStyle|bindReady|String|padding|pageX|metaKey|keyCode|getWH|andSelf|clientX|Left|all|visibility|container|index|init|triggered|removeAttribute|classFilter|prevObject|submit|file|after|windowData|inner|client|globalEval|sibling|jquery|absolute|clone|wrapAll|dequeue|version|triggerHandler|oldblock|ctrlKey|createTextNode|Top|handleError|getResponseHeader|parsererror|speeds|checkbox|old|00|radio|swing|href|Modified|ifModified|lastChild|safari2|startTime|offsetTop|offsetLeft|username|location|ajaxSettings|getElementById|isSimple|values|selectedIndex|runtimeStyle|rsLeft|_load|loaded|DOMContentLoaded|clientTop|clientLeft|toElement|srcElement|val|pageY|POST|unshift|Bottom|clientY|Right|fix|exclusive|detachEvent|cloneNode|removeEventListener|swap|toString|join|attachEvent|eval|substr|head|parse|textarea|reset|image|zoom|odd|even|before|prepend|exclude|expr|quickClass|quickID|uuid|quickChild|continue|Height|textContent|appendTo|contents|open|margin|evalScript|borderTopWidth|borderLeftWidth|parent|httpData|setArray|CSS1Compat|compatMode|boxModel|cssFloat|linear|def|webkit|nodeValue|speed|_toggle|eq|100|replaceWith|304|concat|200|alpha|Last|httpNotModified|getAttributeNode|httpSuccess|clearInterval|abort|beforeSend|splice|styleFloat|throw|colgroup|XMLHttpRequest|ActiveXObject|scriptCharset|callback|fieldset|multiple|processData|getBoundingClientRect|contentType|link|ajaxSend|ajaxSuccess|ajaxError|col|ajaxComplete|ajaxStop|ajaxStart|serializeArray|notmodified|keypress|keydown|change|mouseup|mousedown|dblclick|focus|blur|stylesheet|hasClass|rel|doScroll|black|hover|solid|cancelBubble|returnValue|wheelDelta|view|round|shiftKey|resize|screenY|screenX|relatedNode|mousemove|prevValue|originalTarget|offsetHeight|keyup|newValue|offsetWidth|eventPhase|detail|currentTarget|cancelable|bubbles|attrName|attrChange|altKey|originalEvent|charAt|0n|substring|animated|header|noConflict|line|enabled|innerText|contains|only|weight|font|gt|lt|uFFFF|u0128|size|417|Boolean|Date|toggleClass|removeClass|addClass|removeAttr|replaceAll|insertAfter|prependTo|wrap|contentWindow|contentDocument|iframe|children|siblings|prevAll|wrapInner|nextAll|outer|prev|scrollTo|static|marginTop|next|inline|parents|able|cellSpacing|adobeair|cellspacing|522|maxLength|maxlength|readOnly|400|readonly|fast|600|class|slow|1px|htmlFor|reverse|10000|PI|cos|compatible|Function|setData|ie|ra|it|rv|getData|userAgent|navigator|fadeTo|fadeIn|slideToggle|slideUp|slideDown|ig|responseXML|content|1223|NaN|fadeOut|300|protocol|send|setAttribute|option|dataFilter|cssText|changed|be|Accept|stop|With|Requested|Object|can|GMT|property|1970|Jan|01|Thu|Since|If|Type|Content|XMLHTTP|th|Microsoft|td|onreadystatechange|onload|cap|charset|colg|host|tfoot|specified|with|1_|thead|leg|plain|attributes|opt|embed|urlencoded|www|area|hr|ajaxSetup|meta|post|getJSON|getScript|marginLeft|img|elements|pageYOffset|pageXOffset|abbr|serialize|pixelLeft'.split('|'),0,{})) \ No newline at end of file diff --git "a/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\347\254\224\350\256\260/day05/note/javascript/\346\263\250\345\206\214\351\241\265\351\235\242/\346\263\250\345\206\214-\344\270\252\344\272\272\347\224\250\346\210\267_files/log.ashx" "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\347\254\224\350\256\260/day05/note/javascript/\346\263\250\345\206\214\351\241\265\351\235\242/\346\263\250\345\206\214-\344\270\252\344\272\272\347\224\250\346\210\267_files/log.ashx" new file mode 100644 index 00000000..e69de29b diff --git "a/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\347\254\224\350\256\260/day05/note/javascript/\346\263\250\345\206\214\351\241\265\351\235\242/\346\263\250\345\206\214-\344\270\252\344\272\272\347\224\250\346\210\267_files/logo-2013.png" "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\347\254\224\350\256\260/day05/note/javascript/\346\263\250\345\206\214\351\241\265\351\235\242/\346\263\250\345\206\214-\344\270\252\344\272\272\347\224\250\346\210\267_files/logo-2013.png" new file mode 100644 index 00000000..65278958 Binary files /dev/null and "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\347\254\224\350\256\260/day05/note/javascript/\346\263\250\345\206\214\351\241\265\351\235\242/\346\263\250\345\206\214-\344\270\252\344\272\272\347\224\250\346\210\267_files/logo-2013.png" differ diff --git "a/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\347\254\224\350\256\260/day05/note/javascript/\346\263\250\345\206\214\351\241\265\351\235\242/\346\263\250\345\206\214-\344\270\252\344\272\272\347\224\250\346\210\267_files/passport.base.css" "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\347\254\224\350\256\260/day05/note/javascript/\346\263\250\345\206\214\351\241\265\351\235\242/\346\263\250\345\206\214-\344\270\252\344\272\272\347\224\250\346\210\267_files/passport.base.css" new file mode 100644 index 00000000..ead32767 --- /dev/null +++ "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\347\254\224\350\256\260/day05/note/javascript/\346\263\250\345\206\214\351\241\265\351\235\242/\346\263\250\345\206\214-\344\270\252\344\272\272\347\224\250\346\210\267_files/passport.base.css" @@ -0,0 +1,298 @@ +@charset "gb2312"; +html,body,div,span,iframe,h1,h2,h3,h4,h5,h6,p,blockquote,pre,a,address,big,cite,code,del,em,font,img,ins,small,strong,var,b,u,i,center,dl,dt,dd,ol,ul,li,fieldset,form,label,legend{margin:0;padding:0;}ol,ul{list-style:none;}:focus{outline:0;}a img{border:0;}img{vertical-align:middle;}table{empty-cells:show;}ins{text-decoration:none;}del{text-decoration:line-through;}h1{font-size:20px;font-family:Arial,Lucida,Verdana,"microsoft yahei","",Helvetica,sans-serif;}h2{font-size:14px;}h3{font-size:14px;}h4{font-size:12px;}h5{font-size:12px;}h6{font-size:12px;}.ftx01,.flk01 a:link,.flk01 a:visited,a.flk01:link,a.flk01:visited{color:#FCD410;}.ftx02,.flk02 a:link,.flk02 a:visited,a.flk02:link,a.flk02:visited{color:#F90;}.ftx03,.flk03 a:link,.flk03 a:visited,a.flk03:link,a.flk03:visited{color:#A0410A;}.ftx04,.flk04 a:link,.flk04 a:visited,a.flk04:link,a.flk04:visited{color:#F00;}.ftx05,.flk05 a:link,.flk05 a:visited,a.flk05:link,a.flk05:visited{color:#A40F00;}.ftx11,.flk11 a:link,.flk11 a:visited,a.flk11:link,a.flk11:visited{color:#B8D1EA;}.ftx12,.flk12 a:link,.flk12 a:visited,a.flk12:link,a.flk12:visited{color:#4589BF;}.ftx13,.flk13 a:link,.flk13 a:visited,a.flk13:link,a.flk13:visited{color:#005AA0;}.ftx14,.flk14 a:link,.flk14 a:visited,a.flk14:link,a.flk14:visited{color:#12A000;}.ftx21,.flk21 a:link,.flk21 a:visited,a.flk21:link,a.flk21:visited{color:#FFF;}.ftx22,.flk22 a:link,.flk22 a:visited,a.flk22:link,a.flk22:visited{color:#CCC;}.ftx23,.flk23 a:link,.flk23 a:visited,a.flk23:link,a.flk23:visited{color:#999;}.ftx24,.flk24 a:link,.flk24 a:visited,a.flk24:link,a.flk24:visited{color:#666;}.ftx25,.flk25 a:link,.flk25 a:visited,a.flk25:link,a.flk25:visited{color:#333;}.ftx26,.flk26 a:link,.flk26 a:visited,a.flk26:link,a.flk26:visited{color:#000;} +/*layout*/ +body{margin:0 auto;} +.w{width:990px;padding:0;margin:0 auto;zoom:1;} +body .fl{float:left;}body .fr{float:right;}body .fn{float:none;} +body .al{text-align:left;}body .ac{text-align:center;}body .ar{text-align:right;} +.clr{display:block;overflow:hidden;clear:both;height:0;line-height:0;font-size:0;} +.clearfix:after {content:".";display:block;height:0;clear:both;visibility:hidden;} +.clearfix{display:inline-table;} +/* Hides from IE-mac \*/ +*html .clearfix {height:1%;} +.clearfix{display:block;} +/* End hide from IE-mac */ +*+html .clearfix {min-height:1%;} +.overflow{overflow:hidden;} +.block{display:block;overflow:hidden;cursor:pointer;} +.hide{display:none;} +.invisible{visibility:hidden;} +/*form*/ +.form label,.form input,.form select,.form textarea,.form button,.form .label{float:left;font-size:12px;} +.form .item{overflow:hidden;zoom:1;} +.form .item-hidden{overflow:hidden;zoom:1;display: none;} +.btn-img{cursor:pointer;overflow:hidden;margin:0;padding:0;border:0;text-align:center;} +.btn-text{cursor:pointer;overflow:hidden;margin:0;padding:0;text-align:center;} +.btn-link{display:block;overflow:hidden;text-align:center;} +/*module*/ +.m,.mt,.mc,.mb{overflow:hidden;zoom:1;} +.mt .extra{float:right;} +.m{margin-bottom:10px;} +.lh { overflow:hidden; zoom:1; } +.lh li, .lh dl, .lh .item { float:left; } +.ld { position:relative; zoom:1; } +.ld s, .ld b, .ld .block { position:absolute; overflow:hidden; } +/*tab*/ +.tab{overflow:hidden;zoom:1;} +.tab li,.tab-item{float:left;text-align:center;} +/*text*/ +body{font-family:Arial,"",Lucida,Verdana,Helvetica,sans-serif;font-size:12px;color:#333;line-height:150%;} +/*link*/ +a:link,a:visited{color:#333;text-decoration:none;} +a:hover,a:active{color:#f00;text-decoration:underline;} +#shortcut, +#shortcut .w, +#shortcut .fl b, +#shortcut .menu b{background-image:url(i/20111221C.png);background-repeat:no-repeat;} +#shortcut li{background-image:url(i/20120112B.png);background-repeat:no-repeat;} +#shortcut, +#shortcut .w{height:30px;background-color:#efefef;background-repeat:repeat-x;} +#shortcut{width:100%;padding-bottom:1px;line-height:30px;} +#shortcut li{height:27px;padding:0 10px;background-position:-230px -320px;} +/*#shortcut .fl .fore1{border:solid #DADADA;border-width:1px 1px 0;background:#fff;padding:0 22px 0 2px;margin-top:3px;line-height:24px;} +#shortcut .fl span{padding:0 8px;border-right:1px solid #ddd;} +/*#shortcut .fl .fore2{background:none;}*/ +#shortcut .fl .fore1{padding-left:15px;background:none;} +#shortcut .fl b{top:10px;left:1px;width:10px;height:10px;background-position:-57px -289px;cursor:pointer;} +#shortcut .fr{height:30px;overflow:visible;} +#shortcut .fr .fore1{background:none;} +#shortcut .fr .menu{position:relative;z-index:10;width:83px;padding:3px 0 0;} +#shortcut .menu dl{width:67px;padding:0 7px;} +#shortcut .menu dt{height:24px;padding:0 10px 1px 6px;line-height:24px;cursor:default;} +#shortcut .menu b{top:10px;right:3px;width:7px;height:4px;background-position:-35px -281px;} +#shortcut .menu dd{display:none;padding:4px 0 4px 5px;line-height:21px;} +/*#shortcut .menu:hover dl,*/ +#shortcut .fr .hover{z-index:11;} +#shortcut .hover dl{border:1px solid #ddd;background:#fff;-moz-box-shadow:0 0 5px #ddd;-webkit-box-shadow:0 0 5px #ddd;box-shadow:0 0 5px #ddd;} +/*#shortcut .menu:hover dt,*/ +#shortcut .hover dt{padding-left:5px;border-bottom:1px solid #F3F3F3;line-height:23px;} +/*#shortcut .menu:hover dd,*/ +#shortcut .hover dd{display:block;} +/*#shortcut .menu:hover b,*/ +#shortcut .hover b{top:9px;background-position:-35px -275px;} +#shortcut a.link-logout:link, +#shortcut a.link-logout:visited{color:#999;} +#loginbar a{margin-left:5px;} +#mycity{font-weight:bold;color:#005EA7;} +#quit{color:#999;} +/*#cityselector{display:none;position:absolute;top:26px;left:900px;z-index:11;width:400px;} +#cityselector .smc{background:#fff;} +#cityselector .item{width:374px;padding:6px 0;margin:0 12px;border-top:1px dotted #ccc;overflow:hidden;zoom:1;} +#cityselector .item a{float:left;margin-right:14px;white-space:nowrap;} +#cityselector .fore{border-top:none;} +#cityselector .smc .extra{padding:5px 12px;background:#f3f3f3;color:#f60;} +#cityselector .smc, +#cityselector .smc .extra{border-radius:0 0 5px 5px;-moz-border-radius:0 0 5px 5px;-webkit-border-radius:0 0 5px 5px;}*/ +*html #shortcut .fl{height:27px;overflow:hidden;} +*html #shortcut .fl b{top:8px;} +*html #shortcut li.menu dl{position:absolute;} +/*footer*/ +#footer { padding-bottom:30px; text-align:center; } +#footer .links a, #footer .links span { margin:0 10px; } +#footer .links span a { margin:0; } +#footer .copyright { margin:10px 0; } +#footer .authentication a { margin:0 5px; } +/*logo*/ +#logo{padding:10px 0;position:relative;} +#logo b{position:absolute;background:url(i/regist-word.png) no-repeat;top:18px;left:180px;width:111px;height:46px;} +#shortcut .fl span{display:none} + +#intelligent-regName { + background: none repeat scroll 0 0 #FFFFFF; + border: 1px solid #BBBBBB; + left: 0; + position: absolute; + top: 38px; + width: 268px; + z-index: 100; +} +#intelligent-regName li { + height: 22px; + line-height: 22px; + padding: 0 3px; +} +.o-intelligent-regName { + +} +#select-regName { + overflow: visible; +} +#regist .btn-regist{ + *zoom:1; + display: inline-block; + border:0 none; + font-size: 14px; + font-weight: bold; + text-align:center; + color: #fff +} + +.btn .btn-text {height:25px; padding:0 0 0 10px; float:left; display:block; overflow:hidden; line-height:25px; text-align:left; background-position:0 -25px;} +/*#footer*/ +#footer-2013{padding-bottom:30px;text-align:center;} +#footer-2013 .links a, +#footer-2013 .links span{margin:0 10px;} +#footer-2013 .links span a{margin:0;} +#footer-2013 .copyright{margin:10px 0;} +#footer-2013 .authentication a{margin:0 5px;} + +/*shortcut*/ +#shortcut-2013 .fl b, +#shortcut-2013 .fr b{background-image:url(i/20130330A.png);background-repeat:no-repeat;} +#shortcut-2013, +#shortcut-2013 .w{height:30px;background:#FAFAFA;} +#shortcut-2013{width:100%;border-bottom:1px solid #eee;line-height:30px;} +#shortcut-2013 li{height:30px;padding:0 11px 0 12px;} +#shortcut-2013 li s{top:9px;left:0;width:0px;height:12px;border-left:1px solid #DDD;overflow:hidden;} +#shortcut-2013 b{transition:transform 0.2s ease-in 0s;} +#shortcut-2013 .fl{overflow:visible;} +#shortcut-2013 .fl .fore1{padding-left:16px;z-index:1;} +#shortcut-2013 .fl b{top:8px;left:0;width:13px;height:13px;background-position:-90px -23px;cursor:pointer;} +#shortcut-2013 .fl li:hover b{transform:rotate(720deg);} +#shortcut-2013 .fl .jtip{left:68px;top:6px;width:120px;line-height:16px;} +#shortcut-2013 .fr{height:30px;overflow:visible;} +#shortcut-2013 .fr b{top:13px;right:8px;width:7px;height:4px;background-position:-95px -55px;} +#shortcut-2013 .menu{width:60px;z-index:10;} +#shortcut-2013 .dd{display:none;} +#shortcut-2013 .hover .outline, +#shortcut-2013 .hover .dd{position:absolute;border:1px solid #DDD;background:#fff;-moz-box-shadow:0 0 10px #DDD;-webkit-box-shadow:0 0 10px #DDD;box-shadow:0 0 10px #DDD;} +#shortcut-2013 .hover .outline{z-index:-1;left:5px;top:3px;width:73px;height:28px;} +#shortcut-2013 .hover .blank{position:absolute;z-index:1;top:25px;left:6px;width:73px;height:6px;overflow:hidden;background:#fff;} +#shortcut-2013 .hover .dd{display:block;top:30px;} +#shortcut-2013 .fr .hover b{transform:rotate(180deg);filter:progid:DXImageTransform.Microsoft.BasicImage(rotation=2);} + +#biz-service.hover .dd{left:5px;width:73px;} +#biz-service.hover .dd div{padding-left:6px;line-height:22px;} +#site-nav .dd{left:-164px;width:242px;} +#site-nav .dd dl{width:70px;} +#site-nav .dd .fore2{width:80px;} +#site-nav .dd .fore3{width:90px;} +#site-nav .dd dt{padding:4px 0 4px 9px;line-height:20px;font-weight:bold;} +#site-nav .dd dd{padding-left:9px;line-height:22px;} + +#intelligent-regName li{height:22px;line-height:22px;padding:0 3px;} +body,#regist .mt{background:#f2f2f2;} +#shortcut,#shortcut .w{background:#fafafa;} +#regist { + background:#FFF; +} + +.thickframe { + position: fixed; + top: 0; + left: 0; + z-index: 10000000; + width: 100%; + height: 100%; + background: #000; + border: 0; + filter: alpha(opacity = 0); + opacity: 0; +} + +.thickdiv { + position: fixed; + top: 0; + left: 0; + z-index: 10000001; + width: 100%; + height: 100%; + background: #000; + border: 0; + filter: alpha(opacity = 15); + opacity: .15; +} + +.thickbox { + position: absolute; + z-index: 10000002; + overflow: hidden; + padding: 0; + border: 4px solid rgba(0, 0, 0, 0.1); + border-radius: 5px; + -moz-border-radius: 5px; + -webkit-border-radius: 5px; +} + +.thicktitle { + height: 27px; + padding: 0 10px; + border: solid #C4C4C4; + border-width: 1px 1px 0; + background: #F3F3F3; + line-height: 27px; + font-family: arial, "\5b8b\4f53"; + font-size: 14px; + font-weight: bold; + color: #333; +} + +.thickclose:link, .thickclose:visited { + display: block; + position: absolute; + z-index: 100000; + top: 7px; + right: 12px; + overflow: hidden; + width: 15px; + height: 15px; + background: url(http://misc.360buyimg.com/201007/skin/df/i/bg_thickbox.gif) no-repeat 0 -18px; + font-size: 0; + line-height: 100px; +} + +.thickcon { + overflow: auto; + background: #fff; + border: solid #C4C4C4; + border-width: 1px; + padding: 10px; +} + +.thickloading { + background: url(http://misc.360buyimg.com/201007/skin/df/i/loading.gif) #fff no-repeat center center; +} + +.thickcountdown { + height: 20px; + padding-right: 6px; + margin-top: -20px; + text-align: right; + color: #999; +} + +*html .thickframe { + position: absolute; +} + +*html .thickdiv { + position: absolute; +} + +#thicktitler { + padding: 0 11px; + background: #8DB7DC; + border: none; + color: #fff; +} + +#thickcloser:link, #thickcloser:visited { + top: 6px; + right: 9px; + width: 16px; + height: 17px; + background-position: 0 0; +} + +#thickconr { + border: solid #8DB7DC; + border-width: 1px; +} + +.regist-2013 .btnt{width:322px;margin:20px auto 0;} +.regist-2013 .btnt .btn-img{width:322px;height:34px;line-heiht:34px;background:#e4393c;color:#FFF; -moz-border-radius:3px; -webkit-border-radius:3px;border-radius:3px;font-family:"΢ź";font-size:16px;font-weight:800;} +#protocol-con{height:356px;overflow:auto;padding:10px 20px 0 10px;} +#protocol-con h5{line-height:30px;} +#protocol-con p{line-height:20px;} +#protocol-con p strong{font-weight:normal;} +.thicktitle{padding:0;text-align:center;} \ No newline at end of file diff --git "a/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\347\254\224\350\256\260/day05/note/javascript/\346\263\250\345\206\214\351\241\265\351\235\242/\346\263\250\345\206\214-\344\270\252\344\272\272\347\224\250\346\210\267_files/phone-bg.jpg" "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\347\254\224\350\256\260/day05/note/javascript/\346\263\250\345\206\214\351\241\265\351\235\242/\346\263\250\345\206\214-\344\270\252\344\272\272\347\224\250\346\210\267_files/phone-bg.jpg" new file mode 100644 index 00000000..1067a8f7 Binary files /dev/null and "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\347\254\224\350\256\260/day05/note/javascript/\346\263\250\345\206\214\351\241\265\351\235\242/\346\263\250\345\206\214-\344\270\252\344\272\272\347\224\250\346\210\267_files/phone-bg.jpg" differ diff --git "a/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\347\254\224\350\256\260/day05/note/javascript/\346\263\250\345\206\214\351\241\265\351\235\242/\346\263\250\345\206\214-\344\270\252\344\272\272\347\224\250\346\210\267_files/regist.personal.css" "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\347\254\224\350\256\260/day05/note/javascript/\346\263\250\345\206\214\351\241\265\351\235\242/\346\263\250\345\206\214-\344\270\252\344\272\272\347\224\250\346\210\267_files/regist.personal.css" new file mode 100644 index 00000000..303c7a36 --- /dev/null +++ "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\347\254\224\350\256\260/day05/note/javascript/\346\263\250\345\206\214\351\241\265\351\235\242/\346\263\250\345\206\214-\344\270\252\344\272\272\347\224\250\346\210\267_files/regist.personal.css" @@ -0,0 +1,350 @@ +/*regist*/ +#regist .mt,#regist .mt h2,#regist .mt span{height:32px;line-height:32px;} +#regist .mt{padding-right:10px;position:relative;overflow:visible;margin-bottom:-1px;border-bottom:1px solid #dddddd;} +#regist .mt h2{float:left;padding-left:15px;} +#regist .mt span{float:right;text-align:right;} +#regist .mt b{display:none;} +#regist .mt .extra{position:absolute;right:20px;top:5px;} +#regist .mc{padding:30px 0 20px;border:solid #dddddd;border-width:0px 1px 1px; } +#regist .tab{height:33px;padding-left:277px;} +#regist .tab li{margin-right:5px;margin-top:3px;font-size:14px;width:100px;height:28px;text-align:center;line-height:28px;color:#F79100;} +#regist .tab .new{height:31px;line-height:31px;margin-top:0;} +#regist .tab .curr{position:relative;color:#fff;background:#ffffff;color:#e4393c;height:32px;line-height:32px;font-weight:bold;margin-top:0;-moz-box-shadow:2px 0 2px #DDDDDD; -webkit-box-shadow:2px 0 2px #DDDDDD;box-shadow:2px 0 2px #DDDDDD;border-bottom: none;} +#regist .tab li{background:#f7f7f7;border:1px solid #dddddd;} +#regist .tab li.fore{width:224px;} +#regist .tab li a{display:block;width:100px;height:34px;} +#regist .tab .fore a{width:224px;} +#regist .tab li a:hover,#regist .tab li a:active{ + color: #333; + text-decoration: none; +} +#regist .item{padding-top:9px;height:60px;line-height:34px;position:relative;z-index:1;} +.thickbox-form .item{height:70px;line-height:40px;position:relative;z-index:1;} +.thickbox-form .f-body{height: 170px;} +#regist #select-regName{z-index:5;} +#regist .label,.thickbox-form .label{width:190px;text-align:right;font-size:14px;color:#999;padding-right:10px;} +#regist .label b,.thickbox-form .label b{font-family:"????";margin-right:5px;font-weight:normal;} +#regist .text,.thickbox-form .text{ + width:238px; + height:16px; + padding:10px 25px 10px 5px; + border:1px solid #cccccc; + float:none; + font-size:14px; + font-family:arial,""; + color: #999; + overflow:hidden; +} +#regist .text-1,.thickbox-form .text-1{width:100px;float:left;} +#regist .blank,.thickbox-form .blank{width:16px;height:16px;position:absolute;left:243px;top:7px;padding:3px;float:none;} +#regist .img img,.thickbox-form .img img{height:26px;margin:0 5px;} +#regist .succeed,.thickbox-form .succeed{background:url(i/sucess.png) center no-repeat #ffffff;} +#regist .error-ico,.thickbox-form .error-ico{background:url(i/error.png) center no-repeat #ffffff;} +#regist .cue-ico,.thickbox-form .cue-ico{background:url(i/cue.png) center no-repeat #ffffff;} +#authcode_box{ + padding-top: 5px; + line-height:26px; +} +#regist .btn-regist{width:270px;height:36px;color:#FFF; font-family:"microsoft yahei";font-size:16px;text-indent:-9999px;font-weight:800;overflow:hidden;background:url(i/regist-btn.jpg) no-repeat ;} + +#recom_tips{ + border: 1px solid #ddd; + border-top: 0; + background:#fff; +} +#recom_tips li{ + padding:8px 5px; + font-size:14px; + color: #333; + cursor:pointer; +} +#recom_tips li input{ + vertical-align: middle; +} +#recom_tips .hover{ + background: #eee; +} +#recom_tips .tit{ + background: none; + color: #999 +} +.btn,.btn-15{margin-top: 5px;} +.btn,.btn-comm{ + margin-left: 10px; + border:1px solid #dddddd;; + padding: 0; + width:106px; + height: 36px; + background:#f4f4f4; + margin-top:0; + text-align:center; + line-height:36px; + color: #333; + text-decoration:none; + display:inline-block; +} +.btn:hover,.btn-comm:hover{ + color:#333; +} +.btn span{color:#333;} +.btn-comm{margin:0;width:auto;padding:0 14px;} +.btn-15{ + background-position: 0 -57px; + color: #ccc +} +#regist .highlight1,.thickbox-form .highlight1{border:1px solid #7ABD54;color: #333;} +#regist .highlight2,.thickbox-form .highlight2{border:1px solid #FF0000;color:#f00;} +#regist .highlight3,.thickbox-form .highlight3{border:1px solid #fc0;color:#333;} +#regist .pwdbg,.thickbox-form .pwdbg{background:#FFF8EB;} +#regist .ajax-check,.thickbox-form .ajax-check{position:absolute;margin-left:-21px;padding-left:21px;right:-70px;top:5px;} +#regist .focus,#regist .error,#regist .cue{color:#e4393c;line-height:36px;height:36px;position:absolute;top:0px;right:-275px;width:260px;padding:0 5px;background:#FFEBEB;border:1px solid #ffbdbe;} +#regist .item-ifo-extra .focus,#regist .item-ifo-extra .error,#regist .item-ifo-extra .cue{right:-195px;} +#regist .null,.thickbox-form .null{background:none;border:none;background:none;} +#regist .error span,.focus span,.thickbox-form .error span{padding:5px 0;line-height:13px;display:block;} +#regist .focus,.thickbox-form .focus{color:#666;width:260px;;line-height:36px;background:#f7f7f7;border:1px solid #dddddd;} +#regist .cue,.thickbox-form .cue{width:260px;;line-height:36px;background:#fffdee;border:1px solid #edd28b;color:#f7c600;} + +.thickbox-form .focus,.thickbox-form .success,.thickbox-form .error,.thickbox-form .cue{height:26px;line-height:26px;margin-top: -1px;} +.thickbox-form .success{display:block;width:263px;padding-left:5px;border:1px solid #d0e4c2;color:#71b247;} +.thickbox-form .error{display:block;width:263px;padding-left:5px;border:1px solid #ffbdbe; background:#ffebeb;color:#e4393c;float:none;} +.thickbox-form .focus,.thickbox-form .cue{display:block;width:263px;padding-left:5px;} +#regist .null,#regist .error,.thickbox-form .null,.thickbox-form .error{color:#f00;} +#regist #mobileCodeDiv .focus,#regist #mobileCodeDiv .cue,.thickbox-form #mobileCodeDiv1 .focus,.thickbox-form #mobileCodeDiv1 .cue {background:none;border:none;position:relative;right:0;padding:0;display:inline;} +#regist #mobileCodeDiv .cue,.thickbox-form #mobileCode .cue{color:#f7c600;} +#regist .checkbox{margin-top:8px;*margin-top:5px;_margin-top:6px;} +@media all and (-webkit-min-device-pixel-ratio:0) { #regist .checkbox {margin-top:10px;} } +#regist #referrer,.thickbox-form #referrer{color:#999;font-size:12px;} +#pwdstrength{color:#999;line-height:22px;padding-right:10px;clear: both;float: none;position:absolute;top:41px;right:-9px;} +#pwdstrength b{float:left;width:104px;height:13px;overflow:hidden;margin-top:5px;*margin-top:3px;} +.strengthA b{background:url(i/pwdstrength.gif) no-repeat 0 0;} +.strengthB b{background:url(i/pwdstrength.gif) no-repeat 0 -13px;} +.strengthC b{background:url(i/pwdstrength.gif) no-repeat 0 -26px;} + +/*service*/ +.service{overflow:hidden;zoom:1;margin-bottom:13px;padding:15px;background:#F7F7F7;} +.service li{float:left;overflow:hidden;height:14px;padding:0 17px;border-left:1px solid #ccc;background-image:url(i/bg20110922.png);background-repeat:no-repeat;font-size:0;line-height:100px;} +.service li.fore{border:none;} +.service .bl1{width:162px;background-position:17px 0;} +.service .bl2{width:187px;background-position:17px -15px;} +.service .bl3{width:162px;background-position:17px -30px;} +.service .bl4{width:254px;background-position:17px -45px;} +/*-moz-*/ +@-moz-document url-prefix(){#regist .btn-regist{padding-bottom:5px;}} +@-moz-document url-prefix(){#regist .checkbox{margin-top:11px;}} +/**/ +.form { + float:left;width:750px; +} +.phone { + float:left; + margin-top: 9px; + width: 220px; + height:182px; +} +.item-protocol{ + margin: -10px 0 10px 200px; +} +.item-protocol a:hover{ + color: #c00; +} +.protocol-box{ + padding:10px; + border: 1px solid #CCC; + color: #666666; + height: 80px; + margin:0 auto; + overflow-y: scroll; + padding: 8px; + width: 600px; +} +.protocol-box h4{padding-bottom:10px;font-size:14px;text-align:center;} +.protocol-box h5{padding:5px 0;text-indent:2em;} +.protocol-box p{text-indent:2em;} +.protocol-box em{font-style:italic;} +.protocol-box strong{margin-right:5px;} +#regist .item .item-ifo,.thickbox-form .item .item-ifo { + position: relative; + width:270px; +} +.thickbox-form .item .item-ifo { + position: relative; + width:330px; +} +#regist .item .item-ifo-extra,.thickbox-form .item .item-ifo-extra { + position: relative; + width:350px; +} +#regist #mobileCodeDiv .item-ifo,.thickbox-form.thickbox-form #mobileCodeDiv .item-ifo{width:255px;} +#regist #authcodeDiv .item-ifo,.thickbox-form #authcodeDiv .item-ifo {width:380px;} +#regist .item-ifo i,.thickbox-form .item-ifo i { + position: absolute; + right: 8px; +} +#regist .item-ifo .i-name,.thickbox-form .item-ifo .i-name { + background:url(i/one4.jpg) no-repeat scroll 0 0 transparent; + height: 16px; + top: 9px; + width: 16px; +} +#regist .item-ifo .i-pass,.thickbox-form .item-ifo .i-pass { + background: url(i/one5.jpg) no-repeat scroll 0 0 transparent; + height: 19px; + top: 10px; + width: 14px; +} +#regist .item-ifo .i-phone,.thickbox-form .item-ifo .i-phone { + background: url("i/one6.jpg") no-repeat scroll 0 0 transparent; + height: 21px; + top: 8px; + width: 14px; + left:250px; +} +#regist a.blue:link,#regist a.blue:visited{color:#005AA0;} +#countDown{position:absolute;top:36px;left:1px;width:470px;} +#regist #mobileCodeDiv .error,.thickbox-form #mobileCodeDiv .error{right:-265px;width:255px;top:0px;} +#regist #regName_error,.thickbox-form #regName_error{margin-top:0;float:none;cursor:pointer;} + +.intelligent-error{ + background: none repeat scroll 0 0 #ffebeb; + border: 1px solid #ffbdbe; + left: 0px; + position: absolute; + top: 38px; + width: 268px; + z-index:20; +} +.intelligent-error .error-ifo{padding:3px 3px 0;color:#e4393c;line-height:18px;} +.intelligent-error h5{padding:0 3px;font-weight:normal;color:#999999;margin-top:1px;} +.intelligent-error .item-fore{padding:0 3px;height:24px;line-height:24px;overflow:hidden;} +.intelligent-error .item-fore label{font-size:14px;} +@-moz-document url-prefix(){.intelligent-error .item-fore .radio{margin-top:5px;}} + + #intelligent-regName{width:268px;} +#regist #authcode.text{color:#333;float:left;} +#regist .item-new{padding-top:0;height:49px;} +#regist .hover-btn{background:url(i/hover-btn.jpg) no-repeat;} +#regist .wait-btn{background:url(i/wait-btn.jpg) no-repeat;} +#hnschool ,#schoolid, #hnseli{display:none;} +.o-intelligent-regName{z-index:3;} +#sendMobileCode{float:left;margin-right:0;} +.regist-2013 .btnt .btn-img{line-height:34px;} +#regist{margin-bottom:10px;} + + +.form{ + position: relative; +} +#capslock{ + display: none; + position: absolute; + top:44px; + left:200px; + z-index: 6; + width: 248px; + background-color: #fffdee; + height:30px; + line-height: 30px; + border:1px solid #edd288; + color:#f60; + padding:0 10px; +} +#capslock i{ + background:url(i/tip-cue.png) center center no-repeat; + display: inline-block; + height: 30px; + width:20px; + margin-right: 10px; + vertical-align: middle; + +} +#capslock s{ + position: absolute; + background:url(i/tip-arrow.png) center center no-repeat; + height: 12px; + width:18px; + bottom:-10px; + left:38px; +} +.ftx01,.ftx-01{color:#e4393c}.ftx02,.ftx-02{color:#71b247}.ftx03,.ftx-03{color:#999}.ftx04,.ftx-04{color:#ff8a15}.ftx05,.ftx-05,a.ftx-05:link, a.ftx-05:visited{color:#005ea7}.ftx06,.ftx-06{color:#666} +.mt20{margin-top:20px;}.mt10{margin-top: 10px;}.mr10{margin-right: 10px;}.mb10{margin-bottom:10px;}.ml10{margin-left: 10px;}.ml5{margin-left: 5px;} +.thickbox .thicktitle{padding:0 10px;text-align: left;} +.thickbox-form {width:500px;background: #fff;padding-top:20px;} +.thickbox-form .label{width:130px;} +.thickbox-form .btn-verify,.thickbox-tip .btn-red{ + background-color: #e74649; + background-image: -moz-linear-gradient(top,#e74649,#df3033); + background-image: -webkit-gradient(linear,left top,left bottom,color-stop(0,#e74649),color-stop(1,#df3033)); + filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#e74649', endColorstr='#df3033', GradientType='0'); + -ms-filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#e74649', endColorstr='#df3033'); + background-image: linear-gradient(to top,#e74649 0,#df3033 100%); + -webkit-border-radius: 2px; + -moz-border-radius: 2px; + border-radius: 2px; + display: inline-block; + *display: inline; + *zoom: 1; + height:34px; + line-height: 34px; + padding: 0 40px; + color: #fff; + font-family: "microsoft yahei"; + font-size:16px; + font-weight: bold; +} +.thickbox-form .btn-verify:hover,.thickbox-tip .btn-red:hover{ + background-color: #f05356; + background-image: -moz-linear-gradient(top,#f05356,#eb3c3f); + background-image: -webkit-gradient(linear,left top,left bottom,color-stop(0,#f05356),color-stop(1,#eb3c3f)); + filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#f05356', endColorstr='#eb3c3f', GradientType='0'); + -ms-filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#f05356', endColorstr='#eb3c3f'); + background-image: linear-gradient(to top,#f05356 0,#eb3c3f 100%); + text-decoration: none; +} +.thickbox-form .btn-verify:link,.thickbox-form .btn-verify:visited { + color: #fff; + text-decoration: none +} +.thickbox-tip{ + font-size:14px; + line-height: 25px; + padding:10px 40px; + font-family: verdana; +} +.icon-box { + position: relative; + _height: 48px; + _overflow: visible +} +.icon-box .info-succ,.icon-box h2{ + font-size:22px; + font-family: 'microsoft yahei'; + line-height: 50px; + height:50px; + font-weight:bold; +} +.icon-box h2{font-size:16px;height:auto;line-height:22px;padding-top:10px;} +.icon-box .m-icon { + display: inline-block; + *display: inline; + *zoom: 1; + position: absolute; + top: 0; + left: 0; + height: 0; + width: 48px; + height: 48px; + background: url(i/icon48.png) no-repeat +} + +.icon-box .succ-icon { + background-position: 0 0 +} + +.icon-box .warn-icon { + background-position: -96px 0 +} + +.icon-box .item-fore { + margin:5px 0 25px 58px; +} +.thickbox-form .msg-txt{line-height: 22px;} \ No newline at end of file diff --git "a/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\347\254\224\350\256\260/day05/note/javascript/\346\263\250\345\206\214\351\241\265\351\235\242/\346\263\250\345\206\214-\344\270\252\344\272\272\347\224\250\346\210\267_files/wl.js" "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\347\254\224\350\256\260/day05/note/javascript/\346\263\250\345\206\214\351\241\265\351\235\242/\346\263\250\345\206\214-\344\270\252\344\272\272\347\224\250\346\210\267_files/wl.js" new file mode 100644 index 00000000..00c3c645 --- /dev/null +++ "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\347\254\224\350\256\260/day05/note/javascript/\346\263\250\345\206\214\351\241\265\351\235\242/\346\263\250\345\206\214-\344\270\252\344\272\272\347\224\250\346\210\267_files/wl.js" @@ -0,0 +1 @@ +(function($){var escapeable=/["\\\x00-\x1f\x7f-\x9f]/g,meta={"\b":"\\b","\t":"\\t","\n":"\\n","\f":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"};$.toJSON=typeof JSON==="object"&&JSON.stringify?JSON.stringify:function(o){if(o===null){return"null"}var type=typeof o;if(type==="undefined"){return undefined}if(type==="number"||type==="boolean"){return""+o}if(type==="string"){return $.quoteString(o)}if(type==="object"){if(typeof o.toJSON==="function"){return $.toJSON(o.toJSON())}if(o.constructor===Date){var month=o.getUTCMonth()+1,day=o.getUTCDate(),year=o.getUTCFullYear(),hours=o.getUTCHours(),minutes=o.getUTCMinutes(),seconds=o.getUTCSeconds(),milli=o.getUTCMilliseconds();if(month<10){month="0"+month}if(day<10){day="0"+day}if(hours<10){hours="0"+hours}if(minutes<10){minutes="0"+minutes}if(seconds<10){seconds="0"+seconds}if(milli<100){milli="0"+milli}if(milli<10){milli="0"+milli}return'"'+year+"-"+month+"-"+day+"T"+hours+":"+minutes+":"+seconds+"."+milli+'Z"'}if(o.constructor===Array){var ret=[];for(var i=0;i=0?".360buy.com":".jd.com";document.cookie=b+"="+escape(c)+";expires="+d.toGMTString()+";path=/;domain="+a}function getCookie(b){var a=document.cookie.match(new RegExp("(^| )"+b+"=([^;]*)(;|$)"));if(a!=null){return unescape(a[2])}return null}function deleteCookie(a){var b=getCookie(a);if(b!=null){setCookieMills(a,"",-1)}}function seClick(b,d,f){var a="seWids"+b;var c=getCookie(a);if(c!=null){var e=c.toString().indexOf(f);if(e<0){c=c+","+f}}else{c=f}setCookieMills(a,c,86400000);log(2,2,d,f)}function appendJSONCookie(cookieName,key,wid,Mills){var ns=eval("("+getCookie(cookieName)+")");if(ns==null||ns==""){ns=new Object()}if(ns[key]==null){ns[key]=""}var pos=ns[key].indexOf(wid);if(pos<0){ns[key]=ns[key]+","+wid}setCookieMills(cookieName,$.toJSON(ns),Mills)}function reBook(b,f,a){var e="_rtbook";var c=f.toString().split("#")[0];appendJSONCookie(e,b,c,86400000);log(3,b,c,a)}function fe(a,b,c){log("f",a,b,c)}function reClick2012(a,e,b){var d="reHome2012";var c=e.toString().split("#")[0];appendJSONCookie(d,a,c,86400000);log(3,a,c,b)}function reClickCube(e,b){var a="_rdCube";appendJSONCookie(a,"p"+e,b,86400000)}function mark(b,a){log(1,a,b)}function isMeta(b){if(b.metaKey||b.altKey||b.ctrlKey||b.shiftKey){return true}var c=b.which,a=b.button;if(!c&&a!==undefined){return(!a&1)&&(!a&2)&&(a&4)}else{if(c===2){return true}else{if(a===2){return true}}}return false}document.onclick=function(h){h=h||event;if(!h.clientX&&!h.clientY&&!h.pageX&&!h.pageY){return}var u=document,b=window;var a=tag=h.srcElement||h.target;var l=$(tag).attr("clstag");var q="";while(!l){tag=tag.parentNode;if(!tag||(tag.nodeName=="BODY")){break}l=$(tag).attr("clstag")}if(l){var f=l.split("|"),c=f[1],p=f[2],r=f[3];if(c==="keycount"){$(a).attr("href")?log(p,r,"Q",$(a).attr("href")):log(p,r,"Q");q=p+"|"+r;if($(a).attr("href")&&/http:\/\/.*?/.exec($(a).attr("href"))&&$(a).attr("target")!=="_blank"&&!isMeta(h)){h.preventDefault?h.preventDefault():h.returnValue=false;setTimeout(function(){b.location.href=$(a).attr("href")},200)}}}var i=this.location.hostname.toLowerCase();if(/(sale|mall|jmall|pop).(jd|360buy).com/.test(i)||b.ja_heat_map){var o=0,n=0,g=b.screen.width>=1210&&i=="item.jd.com"?1210:990,m=u.body.clientWidth>g?Math.round((u.body.clientWidth-g)/2):0;if(h.pageX||h.pageY){o=h.pageX;n=h.pageY}else{o=h.clientX+u.body.scrollLeft-u.body.clientLeft;n=h.clientY+u.body.scrollTop-u.body.clientTop}log("d","c",q||"-",o+"x"+n,u.body.scrollWidth+"x"+u.body.scrollHeight,m)}};function HashMap(){this.values=new Object()}HashMap.prototype.Set=function(a,b){this.values[a]=b};HashMap.prototype.Get=function(a){return this.values[a]};HashMap.prototype.Contains=function(a){return this.values.hasOwnProperty(a)};HashMap.prototype.Remove=function(a){delete this.values[a]};var SucInfoMethod={Init:function(){this.orderDetailMap=new HashMap();this.rSM=new HashMap();var b=SucInfo_OrderDetail.toString().split(",");for(var c=0;c0){var l=g[d].toString().split("#")[0];if(SucInfoMethod.Contains(l)){if(h){log(e,a,j.concat(".o"),c,f,b,l+":"+SucInfoMethod.GetSkuNum(l));log("4","R"+j.concat(".o"),c,f,b,l,SucInfoMethod.GetSkuNum(l))}else{log(e,a+j,c,f,b,l,SucInfoMethod.GetSkuNum(l))}}}}}function isChecked(){SucInfo_OrderId=window.SucInfo_OrderId||JA.util.getParameter(document.location.href,"suc_orderid")||undefined;SucInfo_OrderType=window.SucInfo_OrderType||JA.util.getParameter(document.location.href,"suc_ordertype")||undefined;SucInfo_OrderDetail=window.SucInfo_OrderDetail||decodeURIComponent(JA.util.getParameter(document.location.href,"suc_sku"))||undefined;return SucInfo_OrderId&&SucInfo_OrderDetail}function funLoad(){var a=getCookie("pin");if(a!=null&&a.length>0){setCookieMills("rpin",a,259200000)}}function Clublog(){var b=this.location.pathname.toLowerCase();var a=this.location.hostname.toLowerCase();if((b.indexOf("/cart.html",0)>=0)||(b.indexOf("shoppingcart",0)>=0)){log("R2&Page","Show")}else{if(b.indexOf("user_home",0)>=0){log("R3&Page","Show")}else{if((b.indexOf("initcart.html",0)>=0)||(b.indexOf("addtocart.html",0)>=0)||(b.indexOf("initcart.aspx",0)>=0)){log("R4R5&Page","Show")}else{if((b.indexOf("normal/list.action",0)>=0)||(b.indexOf("orderlist.aspx",0)>=0)){log("DDR&Page","Show")}else{if(a=="home.360buy.com"){if(b=="/"){log("R3&Page","Show")}}}}}}}function getHistory(){var b=decodeURIComponent(escape(getCookie("pin")));var d=getCookie("_ghis");var c=window.document.location.host.toLowerCase().indexOf("360buy.com")>=0?"360buy":"jd";if(d==null&&b!=null){var a="http://gh."+c+".com/BuyHistory.aspx?mid="+encodeURIComponent(b);$.ajax({url:a,type:"GET",dataType:"jsonp",success:function(e){var f=e.SSkus;var g=e.UserInsterest;if(f.toString().length>0){setCookieMills("_ghis",f.toString().substring(0,51))}if(g.toString().length>0){setCookieMills("_ghit",g)}}})}}(function(){function HashMap(){this.values=new Object()}HashMap.prototype.Set=function(key,value){this.values[key]=value};HashMap.prototype.Get=function(key){return this.values[key]};HashMap.prototype.Contains=function(key){return this.values.hasOwnProperty(key)};HashMap.prototype.Remove=function(key){delete this.values[key]};function SortedHashMap(IComparer,IGetKey){this.IComparer=IComparer;this.IGetKey=IGetKey;this.a=new Array();this.h=new HashMap()}SortedHashMap.prototype.Add=function(key,value){if(this.ContainsKey(key)){this.Remove(key)}this.a.push(value);this.a.sort(this.IComparer);for(var i=0;i=maxlength){this.a.splice(maxlength-1,1)}this.a.unshift(value)};SortedHashMap.prototype.Get=function(key){return this.a[this.h.Get(key)]};SortedHashMap.prototype.Count=function(){return this.a.length};SortedHashMap.prototype.Remove=function(key){if(!this.h.Contains(key)){return}var index=this.h.Get(key);this.a.splice(index,1);this.h.Remove(key)};SortedHashMap.prototype.ContainsKey=function(key){return this.h.Contains(key)};SortedHashMap.prototype.Clear=function(){this.a=new Array();this.h=new HashMap()};SortedHashMap.prototype.GetJson=function(){return $.toJSON(this.a)};function ThirdType(thirdType,sku,value){this.t=thirdType;this.v=5;this.s=0;if(arguments.length>1){this.s=sku}if(arguments.length>2){this.v=value}}ThirdType.prototype.Increase=function(){this.v=this.v+2};ThirdType.prototype.Decrease=function(){this.v=this.v-1};ThirdType.prototype.SetSku=function(sku){this.s=sku};Ttracker={IComparer:function(a,b){return b.v-a.v},IGetKey:function(a){return a.t},isbook:function(id){return id>10000000&&id<20000000},trace:function(){if(typeof pageConfig!="object"||typeof pageConfig.product!="object"){return}var sortid=pageConfig.product.cat instanceof Array&&pageConfig.product.cat[2];if(!sortid){return}var wid=$("#name").attr("PshowSkuid")||pageConfig.product.skuid;this.view(sortid,wid);this.viewtypewid()},viewtypewid:function(){var maps=Ttracker.util.Vv("typewid");if(maps){Ttracker.util.Wv("typewid","",-63072000000)}},viewhisotry:function(t,s,cname){var nview={t:t,s:s};var bookmap=new SortedHashMap(this.IComparer,this.IGetKey);var bview=Ttracker.util.Vv(cname);if(bview){try{if(bview.indexOf(".")>0){var viewarray=bview.split("|");for(var j=viewarray.length-1;j>=0;j--){var book=viewarray[j].split(".");bookmap.Insert({t:Number(book[0]),s:Number(book[1])},8)}}else{var bviews=eval("("+bview+")");if(bviews.length>0&&bviews[0].d!=undefined){Ttracker.util.Wv(cname,"",-63072000000)}else{for(var i=bviews.length-1;i>=0;i--){bookmap.Insert(bviews[i],8)}}}}catch(e){Ttracker.util.Wv(cname,"",-63072000000)}}bookmap.Insert(nview,8);var cvalue="";for(var k=0,klen=bookmap.a.length;k0){var ratearray=vrate.split("|");for(var j=ratearray.length-1;j>=0;j--){var tw=ratearray[j].split(".");var tv=Number(tw[2]||0),tid=Number(tw[0]);tv=t===tid?tv:(tv-1);sitesortmap.Add(Number(tw[0]),{t:Number(tw[0]),s:Number(tw[1]),v:tv},8)}}else{var vrates=eval("("+vrate+")");if(vrates.length>0&&vrates[0].d!=undefined){Ttracker.util.Wv(cname,"",-63072000000)}else{for(var i=0;i8){var del=sitesortmap.a[sitesortmap.Count()-1];sitesortmap.Remove(del.t)}var cvalue="";for(var k=0,klen=sitesortmap.a.length;k=0?".360buy.com":".jd.com";n=n+"="+v+"; path=/; ";t&&(n+="expires="+(new Date(new Date().getTime()+t)).toGMTString()+"; ");n+="domain="+d+";";document.cookie=n},Vv:function(n){for(var b=[],c=document.cookie.split(";"),n=RegExp("^\\s*"+n+"=\\s*(.*?)\\s*$"),d=0;d=0?"360buy.com":"jd.com";this.set(I,l);this.set(ag,k());this.set(d,Math.round((new Date).getTime()/1000));this.set(aK,15552000000);this.set(X,1296000000);this.set(ap,1800000);this.set(aQ,T());var g=ab();this.set(Z,g.name);this.set(U,g.version);this.set(B,G());var t=aJ();this.set(z,t.D);this.set(M,t.C);this.set(aB,t.language);this.set(n,t.javaEnabled);this.set(A,t.characterSet);this.set(aL,an);this.set(aU,new Date().getTime());var s=r.util.Vv("pin");this.set(aO,s[Q]?s[0]:"-");var p="",y;if((y=r.util.Vv("pinId"))&&y[Q]){p=y[0]}this.set(aj,p||"-")};var an="baidu:wd,baidu:word,haosou.com:q,so.com:q,so.360.cn:q,360so.com:q,360sou.com:q,baidu:q1,m.baidu:word,m.baidu:w,wap.soso:key,m.so:q,page.yicha:key,sz.roboo:q,i.easou:q,wap.sogou:keyword,google:q,soso:w,sogou:query,youdao:q,ucweb:keyword,ucweb:word,114so:kw,yahoo:p,yahoo:q,live:q,msn:q,bing:q,aol:query,aol:q,daum:q,eniro:search_word,naver:query,pchome:q,images.google:q,lycos:query,ask:q,netscape:query,cnn:query,about:terms,mamma:q,voila:rdata,virgilio:qs,alice:qs,yandex:text,najdi:q,seznam:q,search:q,wp:szukaj,onet:qt,szukacz:q,yam:k,kvasir:q,ozu:q,terra:query,rambler:query".split(","),aT=function(){return Math.round((new Date).getTime()/1000)},v=function(){return Math.round(Math.random()*2147483647)},Y=function(){return v()^am()&2147483647},k=function(){return V(ao.domain)},aJ=function(){var l={},g=ac.navigator,p=ac.screen;l.D=p?p.width+"x"+p.height:"-";l.C=p?p.colorDepth+"-bit":"-";l.language=(g&&(g.language||g.browserLanguage)||"-")[H]();l.javaEnabled=g&&g.javaEnabled()?1:0;l.characterSet=ao.characterSet||ao.charset||"-";return l},T=function(){var D,C,y,t;y="ShockwaveFlash";if((D=(D=window.navigator)?D.plugins:R)&&D[Q]>0){for(C=0;C-1&&(t=y.description[J]("Shockwave Flash ")[1])}}else{y=y+"."+y;try{C=new ActiveXObject(y+".7"),t=C.GetVariable("$version")}catch(s){}if(!t){try{C=new ActiveXObject(y+".6"),t="WIN 6,0,21,0",C.AllowScriptAccess="always",t=C.GetVariable("$version")}catch(p){}}if(!t){try{C=new ActiveXObject(y),t=C.GetVariable("$version")}catch(l){}}t&&(t=t[J](" ")[1][J](","),t=t[0]+"."+t[1]+" r"+t[2])}var K=r.util.Vv("_r2");D=t?(t+(K[Q]>0?("_"+K[0]):"")):"-";var g=r.util.Vv("limgs");D=D+(g[Q]>0?("_"+g[0]):"");return D},ar=function(g){return R==g||"-"==g||""==g},V=function(l){var g=1,s=0,p;if(!ar(l)){g=0;for(p=l[Q]-1;p>=0;p--){s=l.charCodeAt(p),g=(g<<6&268435455)+s+(s<<14),s=g&266338304,g=s!=0?g^s>>21:g}}return g},am=function(){var p=aJ();for(var l=p,g=ac.navigator,l=g.appName+g.version+l.language+g.platform+g.userAgent+l.javaEnabled+l.D+l.C+(ao.cookie?ao.cookie:"")+(ao.referrer?ao.referrer:""),g=l.length,s=ac.history.length;s>0;){l+=s--^g++}return V(l)},ab=function(){var g={name:"other",version:"0"},s=navigator.userAgent.toLowerCase();browserRegExp={se360:/360se/,se360_2x:/qihu/,ie:/msie[ ]([\w.]+)/,firefox:/firefox[|\/]([\w.]+)/,chrome:/chrome[|\/]([\w.]+)/,safari:/version[|\/]([\w.]+)(\s\w.+)?\s?safari/,opera:/opera[|\/]([\w.]+)/};for(var p in browserRegExp){var l=browserRegExp[p].exec(s);if(l){g.name=p;g.version=l[1]||"0";break}}return g},G=function(){var g=/(win|android|linux|nokia|ipad|iphone|ipod|mac|sunos|solaris)/.exec(navigator.platform.toLowerCase());return g==null?"other":g[0]},aH=function(){var p="",y=["jwotest_product","jwotest_list","jwotest_cart","jwotest_orderinfo","jwotest_homepage","jwotest_other1","jwotest_other2","jwotest_other3"];for(var t=0,g=y.length;t0?g[0][J]("."):null;t.set(ae,L&&!ar(L[1])?L[1]:Y());t.set(i,L?L[2]:t.get(d));t.set(a,L?L[3]:t.get(d));t.set(aN,L?L[4]:t.get(d));t.set(aw,L?L[5]:1);var C=r.util.Vv("__jdv"),y=C[Q]>0?C[0][J]("|"):null,l=y&&y.length==5?1:0;t.set(f,y?y[0+l]:"direct");t.set(au,y?y[1+l]:"-");t.set(c,y?y[2+l]:"none");t.set(aq,y?y[3+l]:"-");var K=r.util.Vv("__jdb"),D=K[Q]>0?K[0][J]("."):null,l=D&&D.length==4?1:0;t.set(P,D?D[0+l]:0);t.set(b,aH()||"-");var s=JA.util.Vv("clickid"),p=s[Q]&&s[0];t.set(ax,p);return !0},aD=function(){var l=r.util.Vv("__jdb"),g=l[Q]>0?l[0][J]("."):null;if(g&&g.length==1){return g[0]*1}else{if(g&&g.length==4){return g[1]*1}else{return 0}}},aE=function(aZ){var s=ao.location.search,C=ao.referrer,aW=aZ.get(I),y=r.util.getParameter(s,"utm_source"),t=[],O=aZ.get(f),L=aZ.get(au),K=aZ.get(c),g=r.util.Vv("__jdb")[Q]==0;if(y){var l=r.util.getParameter(s,"utm_campaign"),aY=r.util.getParameter(s,"utm_medium"),W=r.util.getParameter(s,"utm_term");t[N](y);t[N](l||"-");t[N](aY||"-");t[N](W||"not set");aZ.set(aq,t[3])}else{var p=C&&C[J]("/")[2],aX=false;if(p&&p[w](aW)<0){for(var aa=aZ.get(aL),ak=0;ak-1&&C[w]((aV[1]+"=")[H]())>-1){var D=r.util.getParameter(C,aV[1]);t[N](aV[0]);t[N]("-");t[N]("organic");t[N](D||"not set");aZ.set(aq,t[3]);aX=true;break}}if(!aX){if(p[w]("zol.com.cn")>-1){t[N]("zol.com.cn");t[N]("-");t[N]("cpc");t[N]("not set")}else{t[N](p);t[N]("-");t[N]("referral");t[N]("-")}}}}if(g||(!g&&t[Q]>0&&(t[0]!==O||t[1]!==L||t[2]!==K)&&t[2]!=="referral")){aZ.set(f,t[0]||aZ.get(f));aZ.set(au,t[1]||aZ.get(au));aZ.set(c,t[2]||aZ.get(c));aZ.set(aq,t[3]||aZ.get(aq));at(aZ)}else{h(aZ)}},j=function(l,g){var p=g.split(".");l.set(i,p[2]);l.set(a,p[4]);l.set(aN,aT());l.m(aw);l.set(P,1)},E=function(l){var g=l.get(d);l.set(ae,Y());l.set(i,g);l.set(a,g);l.set(aN,g);l.set(aw,1);l.set(P,1)},h=function(g){g.m(P)},u=function(g){return[g.get(ag),g.get(ae)||"-",g.get(i)||"-",g.get(a)||"-",g.get(aN)||"-",g.get(aw)||1][F](".")},e=function(g){return[g.get(ag),g.get(P)||1,g.get(ae)+"|"+g.get(aw)||1,g.get(aN)||g.get(d)][F](".")},x=function(g){return[g.get(ag),g.get(f)||ao.domain,g.get(au)||"(direct)",g.get(c)||"direct",g.get(aq)||"-"][F]("|")},at=function(g){var l=r.util.Vv("__jda");l.length==0?E(g):j(g,l[0])};var q=new aP(),av=function(){this.a={};this.add=function(g,l){this.a[g]=l};this.get=function(g){return this.a[g]};this.toString=function(){return this.a[F]("&")}},o=function(l,g){g.add("jdac",l.get(al)),g.add("jduid",l.get(ae)),g.add("jdsid",l.get(ae)+"|"+l.get(aw)),g.add("jdje",l.get(n)),g.add("jdsc",l.get(M)),g.add("jdsr",l.get(z)),g.add("jdul",l.get(aB)),g.add("jdcs",l.get(A)),g.add("jddt",l.get(ai)||"-"),g.add("jdmr",aC(l.get(ay))),g.add("jdhn",l.get(af)||"-"),g.add("jdfl",l.get(aQ)),g.add("jdos",l.get(B)),g.add("jdbr",l.get(Z)),g.add("jdbv",l.get(U)),g.add("jdwb",l.get(i)),g.add("jdxb",l.get(a)),g.add("jdyb",l.get(aN)),g.add("jdzb",l.get(aw)),g.add("jdcb",l.get(P)),g.add("jdusc",l.get(f)||"direct"),g.add("jducp",l.get(au)||"-"),g.add("jdumd",l.get(c)||"-"),g.add("jduct",l.get(aq)||"-"),g.add("jdlt",typeof jdpts!="object"?0:jdpts._st==undefined?0:l.get(aU)-jdpts._st),g.add("jdtad",l.get(b)),g.add("jdak",l.get(ax)),g.add("pinid",l.get(aj))},aS=function(l,g,p,s){g.add("jdac",l.get(al)),g.add("jduid",l.get(ae)),g.add("jdsid",l.get(ae)+"|"+l.get(aw)),g.add("jdje","-"),g.add("jdsc","-"),g.add("jdsr","-"),g.add("jdul","-"),g.add("jdcs","-"),g.add("jddt","-"),g.add("jdmr",aC(l.get(ay))),g.add("jdhn","-"),g.add("jdfl","-"),g.add("jdos","-"),g.add("jdbr","-"),g.add("jdbv","-"),g.add("jdwb","-"),g.add("jdxb","-"),g.add("jdyb","-"),g.add("jdzb",l.get(aw)),g.add("jdcb",s?(aD()+s):l.get(P)),g.add("jdusc","-"),g.add("jducp","-"),g.add("jdumd","-"),g.add("jduct","-"),g.add("jdlt",0),g.add("jdtad",p),g.add("jdak",l.get(ax)),g.add("pinid",l.get(aj))},aR=function(){aF(q)&&aE(q);var l=new av(),g=q.get(I);o(q,l);r.util.Wv("__jda",u(q),g,q.get(aK));r.util.Wv("__jdb",e(q),g,q.get(ap));r.util.Wv("__jdc",q.get(ag),g);r.util.Wv("__jdv",x(q),g,q.get(X));r.util.Wv("clickid","0",g,-84600000);return l.a},aA=function(){var g=new av();o(q,g);return g.a},aM=function(g,l){var p=new av();aS(q,p,g,l);return p.a};r.tracker={sendOld:function(s,p,l,t){var y=l&&(l.jdac+"||"+l.jdje+"||"+l.jdsc+"||"+l.jdsr+"||"+l.jdul+"||"+l.jdcs+"||"+aC(l.jddt)+"||"+l.jdhn+"||"+l.jdfl+"||"+l.jdos+"||"+l.jdbr+"||"+l.jdbv+"||"+l.jdwb+"||"+l.jdxb+"||"+l.jdyb+"||"+l.jdzb+"||"+l.jdcb+"||"+l.jdusc+"||"+l.jducp+"||"+l.jdumd+"||"+l.jduct+"||"+l.jdlt+"||"+l.jdtad);if(y){y+="||"+aC(l.pinid)}var g=("https:"==document.location.protocol?"https://cscssl":"http://csc")+".jd.com/log.ashx?type1="+aC(s)+"&type2="+aC(p)+"&pin="+aC(q.get(aO))+"&uuid="+l.jduid+"&sid="+l.jdsid+(l.jdak?("&utmp="+document.location.href+aC("&clickid="+l.jdak)):"")+"&referrer="+aC(l.jdmr||"-")+"&jinfo="+y+"&data="+aC(t)+"&callback=?";$.getJSON(g,function(){})},sendNew:function(l,s){var p=aA();var g=("https:"==document.location.protocol?"https://mercuryssl":"http://mercury")+".jd.com/log.gif?t="+l+"&m="+q.get(al)+"&pin="+aC(q.get(aO))+"&uid="+p.jduid+"&sid="+p.jdsid+(p.jdak?("&cul="+document.location.href+aC("&clickid="+p.jdak)):"")+"&v="+aC(s)+"&ref="+aC(ao.referrer)+"&rm="+(new Date).getTime();var y=new Image(1,1);y.src=g;y.onload=function(){y.onload=null;y.onerror=null};y.onerror=function(){y.onload=null;y.onerror=null}},ngloader:function(l,s){var p="";for(var g in s){p+=((g+"="+s[g])+"$")}p+="pinid="+q.get(aj)+"$";p=p.substring(0,p.length-1);this.sendNew(l,p)},ngloaderJSON:function(g,l){l.pinid=q.get(aj);this.sendNew(g,$.toJSON(l))},bloading:function(p,g,s){var l=aR();this.loading(p,g,l,s);var t={je:l.jdje,sc:l.jdsc,sr:l.jdsr,ul:l.jdul,cs:l.jdcs,dt:l.jddt,hn:l.jdhn,fl:l.jdfl,os:l.jdos,br:l.jdbr,bv:l.jdbv,wb:l.jdwb,xb:l.jdxb,yb:l.jdyb,zb:l.jdzb,cb:l.jdcb,usc:l.jdusc,ucp:l.jducp,umd:l.jdumd,uct:l.jduct,lt:l.jdlt,ct:s,tad:l.jdtad};this.ngloader("www.100000",t);(l.jduid%1000)===1&&this.ngloader("jsver.000000",{jsfile:"wl",jsver:"20141223"})},loading:function(p,l,g,s){this.sendOld(p,l,g,JA.util.join(s))},aloading:function(p,l,s){var g=aA();this.loading(p,l,g,s)},aloadingJSON:function(p,l,s){var g=aA();this.sendOld(p,l,g,$.toJSON(s))},adshow:function(l){var g=aM(l);this.loading("AD","IM",g,"")},adclick:function(l){var g=aM(l,1);this.loading("AD","CL",g,"")}};window.JA=r;r.tracker.bloading("J","A",new Date().getTime());var S=$(".w .crumb a").length===5&&/e.jd.com\/products\/(\d*)-(\d*)-(\d*).html[\w\W]*?e.jd.com\/(\d*).html/.exec($(".w .crumb").html());if((window.pageConfig&&window.pageConfig.product&&window.pageConfig.product.cat)||S){r.tracker.ngloader("item.010001",{sku:S[4]||window.pageConfig.product.skuid,cid1:S[1]||window.pageConfig.product.cat[0],cid2:S[2]||window.pageConfig.product.cat[1],cid3:S[3]||window.pageConfig.product.cat[2],brand:S?"0":window.pageConfig.product.brand})}(function(){if(isChecked()){SucInfoMethod.Init();var t=getCookie("_distM");if(t&&t==SucInfo_OrderId){return true}var g=["p000","p100","np000","np100"];for(var s=0;s һ + -
    ʾеһ + - ͷ + - + - ע⣺ûдthead tbody tfootԶtableһtbody + ҽеtrŵtbodyУtrtbodyԪأtableԪ + - ĵײ + +2. + - ԽûϢύ + - + - һ + - ԣ + action:Ҫһַύʱеݽᱻύõַ + - + - + - Ըݲͬtypeֵɲͬı + - type="text" ı + - type="password" + - type="radio" ѡť + - type="checkbox" ѡ + - type="submit" ύť + - type="reset" ðť + - type="button" ͨť + + - + + + + + + - + + + +3.JavaScript + - JavaScriptҳеĵΪ + - һ˵Ľűԡ + - JSıдλ + 1.Աдǩָ + + + + 2.Աдscriptǩ ***** + + + 3.ԽдⲿjsļУȻͨǩ ***** + + + - + - alert("Ҫ"); + - еһ + + - document.write("Ҫ"); + - ݽᱻдbodyǩУҳʾ + + - console.log("Ҫ"); + - ݻᱻд߹ߵĿ̨ + + - ﷨ + - ע + - ע + //ע + - ע + /* + ע + */ + + - JSϸִСд + - JSÿԷֺ(;)β + - JSлԶԶոͻУǿÿոͻжԴиʽ + + - ͱ + - + - ʵϾһЩ̶ֵ 1 2 3 4 true false null NaN "hello" + DzԸıġ + - ǺܷʹãJSкֱʹ + + - + - ҿԱ + - һ㶼ͨʹֱʹҲͨһ + - + - ʹvarؼһ + var a; + var b; + var c; + + - Ϊֵ + a = 1; + b = 2; + c = 3; + + - ͸ֵͬʱ ***** + var d = 456; + var e = 789; + + - ʶ + - JSеĿݣΪһʶ + DZʶӦرʶĹ淶 + - 磺 + - 淶 + 1.ʶпԺĸ֡_$ + 2.ʶֿͷ + 3.ʶJSеĹؼֺͱ + 4.ʶһշ + xxxYyyZzz + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git "a/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\347\254\224\350\256\260/day07/note/\346\265\201\347\250\213\346\216\247\345\210\266.png" "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\347\254\224\350\256\260/day07/note/\346\265\201\347\250\213\346\216\247\345\210\266.png" new file mode 100644 index 00000000..f58ece3e Binary files /dev/null and "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\347\254\224\350\256\260/day07/note/\346\265\201\347\250\213\346\216\247\345\210\266.png" differ diff --git "a/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\347\254\224\350\256\260/day07/note/\347\254\224\350\256\260.txt" "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\347\254\224\350\256\260/day07/note/\347\254\224\350\256\260.txt" new file mode 100644 index 00000000..b48084b1 --- /dev/null +++ "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\347\254\224\350\256\260/day07/note/\347\254\224\350\256\260.txt" @@ -0,0 +1,207 @@ +1. + - JSһֳ + - String ַ + - Number ֵ + - Boolean ֵ + - Null ֵ + - Undefined δ + - Object + - л + - String ַ + - JSеַҪʹ˫ŻŶ + - ַʹ\Ϊתַ + \' ==> ' + \" ==> " + \n ==> + \t ==> Ʊ + \\ ==> \ + + - ʹtypeofַʱ᷵"string" + + - Number ֵ + - JSе͸Number + - + Infinity + -Infinity + NaN Ƿ֣Not A Number + - Ƶֵıʾ + 0b ͷʾƣDzе֧ + 0 ͷʾ˽ + 0x ͷʾʮ + + - ʹtypeofһNumber͵ʱ᷵"number" + NaN Infinity + + - Boolean ֵ + - ֵҪ߼жϣֵֻ + - true ߼ + - false ߼ļ + - ʹtypeofһֵʱ᷵"boolean" + + - Null ֵ + - ֵרʾΪյĶNull͵ֵֻһ + - null + - ʹtypeofһNull͵ֵʱ᷵"object" + + - Undefined δ + - һûΪֵʱֵundefined + - ͵ֵֻһ undefined + - ʹtypeofһUndefined͵ֵʱ᷵"undefined" + + - + - Object + + - ת + - תָͣתΪString Number Boolean + - תΪString + - ʽһǿת + - ñתݵtoString() + - ӣ + var a = 123; + a = a.toString(); + - ע⣺nullundefined + ͵ûзԵtoString()ʱᱨ + + - ʽǿת + - String() + - ӣ + var a = 123; + a = String(a); + - ԭNumber Boolean StringǵtoString()תΪַ + nullֱֵתΪַ"null"undefinedֱתΪַ"undefined" + + - ʽʽת: ***** + - Ϊ +"" + - ӣ + var a = true; + a = a + ""; + - ԭString()һ + + - תΪNumber + - ʽһǿת + - Number() + - ӣ + var s = "123"; + s = Number(s); + - ת + 1.ַ --> + - ַһϷֱ֣תΪӦ + - ַһǷ֣תΪNaN + - һմ򴿿ոַתΪ0 + 2.ֵ --> + - trueתΪ1 + - falseתΪ0 + 3.ֵ --> + - nullתΪ0 + 4.δ --> + - undefined תΪNaN + + - ʽǿת + - parseInt()parseFloat() + - רһַתΪֵ + - parseInt() + - ԽһַеЧλȡתΪNumber + - ӣ + var a = "123.456px"; + a = parseInt(a); //123 + - ҪparseInt()ָһڶָ + + - parseFloat() + - ԽһַеЧСλȡתΪNumber + - ӣ + var a = "123.456px"; + a = parseFloat(a); //123.456 + + - ʽʽת + - ʹһԪ+ʽת + - ӣ + var a = "123"; + a = +a; + + - ԭNumber()һ + + - תΪֵ + - ʽһǿת + - ʹBoolean() + - ӣ + var s = "false"; + s = Boolean(s); //true + - ת + ַ --> + - ˿մȫtrue + + ֵ --> + - 0NaNȫtrue + + nullundefined ---> + - false + + ---> + - true + + - ʽʽת + - Ϊη㣬ɽתΪֵ + - ӣ + var a = "hello"; + a = !!a; //true + + + - + - ҲΪ + - ͨԶһֵ + - typeof + - һ + - ﷨typeof + - ᷵һ͵ַΪ + + - + + ֵмӷ㲢ؽ + - ֵм㲢ؽ + * ֵг˷㲢ؽ + / ֵг㲢ؽ + % ֵȡ㲢ؽ + + - ˼ӷ⣬ԷNumber͵ֵʱתΪNumberȻ㡣 + - ӷʱַӣƴַΪһַ + - κֵַӷתΪַȻƴ + + - һԪ + - һԪֻҪһ + - һԪ+ + - ţֵκӰ죬ǿԽһתΪ + - ӣ + var a = true; + a = +a; + + - һԪ- + - ǸţԶһֽзλȡ + - ӣ + var a = 10; + a = -a; + + - + - ʹԭֵĻ1 + - ʹ ++ + - ʹ ǰ++++a++(a++) + - ++a a++ʹԭ1 + ͬ++aa++ֵDzͬģ + ++aֵDZֵֵ + a++ֵDZԭֵǰֵ + + - Լ + - ԼʹԭֵĻԼ1 + - Լʹ -- + - Լʹ ǰ----a--(a--) + - --a a--ʹԭԼ1 + ͬ--aa--ֵDzͬģ + --aֵDZֵԼֵ + a--ֵDZԭֵԼǰֵ + + + + + + + + + \ No newline at end of file diff --git "a/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\347\254\224\350\256\260/day07/note/\347\273\203\344\271\240/for.txt" "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\347\254\224\350\256\260/day07/note/\347\273\203\344\271\240/for.txt" new file mode 100644 index 00000000..02c8275d --- /dev/null +++ "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\347\254\224\350\256\260/day07/note/\347\273\203\344\271\240/for.txt" @@ -0,0 +1,9 @@ +1.ӡ1-100֮֮ + + +2.ӡ1-100֮7ıĸܺ + + +3.ˮɻ +ˮɻָһ3λÿλϵֵ3 ֮͵ +磺1^3 + 5^3+ 3^3 = 153,ӡеˮɻ diff --git "a/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\347\254\224\350\256\260/day07/note/\347\273\203\344\271\240/if/if-exer1.html" "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\347\254\224\350\256\260/day07/note/\347\273\203\344\271\240/if/if-exer1.html" new file mode 100644 index 00000000..92862bea --- /dev/null +++ "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\347\254\224\350\256\260/day07/note/\347\273\203\344\271\240/if/if-exer1.html" @@ -0,0 +1,19 @@ + + + + + if练习1 + + + + + + diff --git "a/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\347\254\224\350\256\260/day07/note/\347\273\203\344\271\240/if/if-exer2.html" "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\347\254\224\350\256\260/day07/note/\347\273\203\344\271\240/if/if-exer2.html" new file mode 100644 index 00000000..9f68ff70 --- /dev/null +++ "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\347\254\224\350\256\260/day07/note/\347\273\203\344\271\240/if/if-exer2.html" @@ -0,0 +1,19 @@ + + + + + if练习2 + + + + + + diff --git "a/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\347\254\224\350\256\260/day07/note/\347\273\203\344\271\240/if/if-exer3.html" "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\347\254\224\350\256\260/day07/note/\347\273\203\344\271\240/if/if-exer3.html" new file mode 100644 index 00000000..e96bfaaa --- /dev/null +++ "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\347\254\224\350\256\260/day07/note/\347\273\203\344\271\240/if/if-exer3.html" @@ -0,0 +1,16 @@ + + + + + if练习3 + + + + + + diff --git "a/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\347\254\224\350\256\260/day07/note/\347\273\203\344\271\240/switch/switch-exer1.html" "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\347\254\224\350\256\260/day07/note/\347\273\203\344\271\240/switch/switch-exer1.html" new file mode 100644 index 00000000..d19457a8 --- /dev/null +++ "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\347\254\224\350\256\260/day07/note/\347\273\203\344\271\240/switch/switch-exer1.html" @@ -0,0 +1,13 @@ + + + + + switch练习1 + + + + diff --git "a/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\347\254\224\350\256\260/day07/note/\347\273\203\344\271\240/switch/switch-exer2.html" "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\347\254\224\350\256\260/day07/note/\347\273\203\344\271\240/switch/switch-exer2.html" new file mode 100644 index 00000000..1b073233 --- /dev/null +++ "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\347\254\224\350\256\260/day07/note/\347\273\203\344\271\240/switch/switch-exer2.html" @@ -0,0 +1,13 @@ + + + + + switch练习2 + + + + diff --git "a/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\347\254\224\350\256\260/day08/note/\347\254\224\350\256\260.txt" "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\347\254\224\350\256\260/day08/note/\347\254\224\350\256\260.txt" new file mode 100644 index 00000000..6be143d8 --- /dev/null +++ "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\347\254\224\350\256\260/day08/note/\347\254\224\350\256\260.txt" @@ -0,0 +1,153 @@ +1. + ߼ + ! + - Զһֵȡtruefalse falsetrue + - ԷDzֵʹ!ʱȽתΪֵȻȡ + - ǿ!תΪֵ + + && + - &&ԶԷֵ + - ֻ˵ֵΪtrueʱŻ᷵trueֻҪһfalseͻ᷵false + - һ·룬һֵfalseټڶֵ + - ڷDzֵὫתΪֵȻ㣬ԭֵ + - + 1.һֵΪfalse򷵻صһֵ + 2.һֵΪtrue򷵻صڶֵ + + || + - ||ԶԷֵл + - ֻ˶falseʱŻ᷵falseֻҪһtrueͻ᷵true + - һ·Ļһֵtrueټڶֵ + - ڷDzֵὫתΪֵȻ㣬ԭֵ + - + 1.һֵΪtrue򷵻صһֵ + 2.һֵΪfalse򷵻صڶֵ + + ֵ + = + - ԽҲֵֵ + + += + - a += 5 ൱ a = a+5 + - var str = "hello"; str += "world"; + + -= + - a -= 5 ൱ a = a-5 + + *= + - a *= 5 ൱ a = a*5 + + /= + - a /= 5 ൱ a = a/5 + + %= + - a %= 5 ൱ a = a%5 + + + ϵ + - ϵȽֵ֮ĴСϵ + > + >= + < + <= + - ϵĹѧһ£Ƚֵ֮Ĺϵ + ϵ򷵻trueϵ򷵻false + - ȽϵֵǷֵὫתΪNumberȻٱȽϡ + - ȽϵֵַʱȽַUnicode룬תΪNumber + + + == + - ȣжֵǷȣȷtrueȷfalse + - ȻԶֵתԲͬͽбȽϣὫתΪͬȻٱȽϣ + תҲ᷵true + != + - ȣжֵǷ񲻵ȣ򷵻true򷵻false + - ҲԶת + + === + - ȫȣжֵǷȫȣƣֻԶת + ֵͲֱͬӷfalse + + !== + - ȫȣͲƣԶתֵͲֱͬӷtrue + + ֵ + - nullundefined + - undefinednullnull == undefined ᷵true + null === undefined ᷵false + + - NaN + - NaNκֵȣ NaN == NaN //false + + - жһֵǷNaN + - ʹisNaN() + + Ԫ + ?: + - ﷨ʽ?1:2; + - ִ̣ + ȶʽֵжϣ + жϽΪtrueִ1ִн + жϽΪfalseִ2ִн + + ȼ + - ѧһJSеҲǾȼģ + ȳ˳ Ӽ + - ȼԲοȼıڱԽϵȼԽߣ + ȼԽߵԽȼ㣬ȼͬģҼ㡣 + - ȼҪ䣬Խò׼ģʹ()ıȼ + +2.̿ + - µ˳ִеģ + ͨ̿Ըıִе˳򣬻߷ִijһεij + - ࣺ + 1.ж + 2.֧ + 3.ѭ + + ж + - жҲΪif + - ﷨һ + if(ʽ){ + ... + } + + - ִ̣ + ifִʱȶʽֵжϣ + ֵΪtrueִif + ֵΪfalseִ + + - ﷨ + if(ʽ){ + ... + }else{ + ... + } + + - ִ̣ + if...elseִʱʽֵжϣ + ֵΪtrueִif + ֵΪfalseִelse + + - ﷨ + if(ʽ){ + ... + }else if(ʽ){ + ... + }else if(ʽ){ + ... + }else if(ʽ){ + ... + }else{ + ... + } + + - ִ + - if...else if...elseִʱζʽֵжϣ + жϽΪtrueִеǰif䣬ִɺ + жϽΪfalseжϣֱҵΪtrueΪֹ + еʽfalseִelse + + + + \ No newline at end of file diff --git "a/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\347\254\224\350\256\260/day09/note/\347\224\273\345\233\276.pptx" "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\347\254\224\350\256\260/day09/note/\347\224\273\345\233\276.pptx" new file mode 100644 index 00000000..dbb80c0d Binary files /dev/null and "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\347\254\224\350\256\260/day09/note/\347\224\273\345\233\276.pptx" differ diff --git "a/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\347\254\224\350\256\260/day09/note/\347\254\224\350\256\260.txt" "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\347\254\224\350\256\260/day09/note/\347\254\224\350\256\260.txt" new file mode 100644 index 00000000..61239f68 --- /dev/null +++ "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\347\254\224\350\256\260/day09/note/\347\254\224\350\256\260.txt" @@ -0,0 +1,87 @@ +1.֧ + - switch + - ﷨: + switch(ʽ){ + case ʽ: + ... + break; + case ʽ: + ... + break; + case ʽ: + ... + break; + default: + ... + break; + } + + - ִ̣ + - switch...case...ִʱνcaseıʽֵswitchıʽֵȫȱȽϣ + ȽϽΪfalse±ȽϡȽϽΪtrueӵǰcaseʼִд롣 + еcaseжϽΪfalsedefaultʼִд롣 + +2.ѭ + - ͨѭԷִijЩ + - whileѭ + - ﷨ + while(ʽ){ + ... + } + + - ִ̣ + whileִʱȶʽֵжϣ + жϽΪfalseֹѭ + жϽΪtrueִѭ + ѭִϣʽֵжϣ + + - do...whileѭ + - ﷨: + do{ + ... + }while(ʽ) + + - ִ + do...whileִʱִdoѭ壬Ȼڶʽжϣ + жжϽΪfalseֹѭ + жϽΪtrueִѭ壬 + + - while + whileжϺִ + do...while: ִкж + - do...whileȷѭִһΡ + + + - forѭ + - ﷨ + for(ٳʼʽ ; ʽ ; ܸ±ʽ){ + ... + } + - ִ̣ + ִТٳʼʽʼһ + ȻԢʽֵжϣΪfalseֹѭ + жϽΪtrueִТѭ + ѭִϣִТܸ±ʽԱи¡ + ±ʽִظ + + - ѭ + while(true){ + + } + + for(;;){ + + } + + + + + + + + + + + + + \ No newline at end of file diff --git "a/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\347\254\224\350\256\260/day10/note/\345\207\275\346\225\260\344\275\234\347\224\250\345\237\237.txt" "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\347\254\224\350\256\260/day10/note/\345\207\275\346\225\260\344\275\234\347\224\250\345\237\237.txt" new file mode 100644 index 00000000..7c91c7bf --- /dev/null +++ "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\347\254\224\350\256\260/day10/note/\345\207\275\346\225\260\344\275\234\347\224\250\345\237\237.txt" @@ -0,0 +1,63 @@ +说出以下代码的执行结果 + +========================================= + +var a = 123; +function fun(){ + alert(a); +} +fun(); + +========================================= + +var a = 123; +function fun(){ + alert(a); + var a = 456; +} +fun(); +alert(a); + +========================================= + +var a = 123; +function fun(){ + alert(a); + a = 456; +} +fun(); +alert(a); + +========================================= + +var a = 123; +function fun(a){ + alert(a); + a = 456; +} +fun(); +alert(a); + +========================================= + +var a = 123; +function fun(a){ + alert(a); + a = 456; +} +fun(123); +alert(a); + + + + + + + + + + + + + + diff --git "a/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\347\254\224\350\256\260/day10/note/\347\254\224\350\256\260.txt" "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\347\254\224\350\256\260/day10/note/\347\254\224\350\256\260.txt" new file mode 100644 index 00000000..fb8b6151 --- /dev/null +++ "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\347\254\224\350\256\260/day10/note/\347\254\224\350\256\260.txt" @@ -0,0 +1,108 @@ +1.Object + - JSе + - һָͣڶпԱͬ͵ + - ʹtypeofһʱ᷵object + - + - ʽһ + - var obj = new Object(); + - ʽ + - var obj = {}; + + - + - ﷨ + . = ֵ; + [""] = ֵ; + + - ûκҪ󣬲ҪرʶĹ淶 + ڿУձʶҪȥд + - ֵҲ͡ + + - ȡе + - ﷨ + . + [""] + - ȡһûеԣᱨǷһundefined + + - ɾе + - ﷨ + delete . + delete [""] + + - ʹinǷָ + - ﷨"" in + - ڶкиԣ򷵻true + û򷵻false + + - ʹöڴʱֱ + ﷨ + var obj = { + :ֵ, + :ֵ, + :ֵ, + :ֵ + } + + - ͺ + - + String Number Boolean Null Undefined + - + Object + - ͵ݣֱӱֵ + ֮ǻģ޸һӰı + - ͵ݣDZĶãڴַ + ָͬһ󣬴ʱ޸һԣӰı + - ȽʱڻͣȽϵľֵ + ͱȽϵǵַַͬͬ + +2.Function + - ҲһҲͨĹ + - пԷװһЩ룬ҪʱȥúִЩ + - ʹtypeofһʱ᷵function + - + - + function ([β1,β2...βN]){ + ... + } + + - ʽ + var = function([β1,β2...βN]){ + ... + }; + + - ú + - ﷨([ʵ1,ʵ2...ʵN]); + fun() sum() alert() Number() parseInt() + - ǵúʱзװĴᰴձд˳ִ + + - βκʵ + - βΣʽ + - 庯ʱ()жһβΣβ֮ʹ, + βξ൱ں˶ӦıDzֵ + βλڵʱŸֵ + + - ʵΣʵʲ + - úʱ()ʵΣݵʵλḳֵӦβ, + úʱJSʵεͺ͸Դ͵ֵ + ʵεβΣʵνḳֵ + ʵεСβΣûжӦʵεβνḳֵundefined + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git "a/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\347\254\224\350\256\260/day11/note/\347\224\273\345\233\276.pptx" "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\347\254\224\350\256\260/day11/note/\347\224\273\345\233\276.pptx" new file mode 100644 index 00000000..a6d96f0a Binary files /dev/null and "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\347\254\224\350\256\260/day11/note/\347\224\273\345\233\276.pptx" differ diff --git "a/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\347\254\224\350\256\260/day11/note/\347\254\224\350\256\260.txt" "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\347\254\224\350\256\260/day11/note/\347\254\224\350\256\260.txt" new file mode 100644 index 00000000..c85b16fd --- /dev/null +++ "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\347\254\224\350\256\260/day11/note/\347\254\224\350\256\260.txt" @@ -0,0 +1,116 @@ +1. + - ֵǺִеĽ + - ʹreturn úķֵ + - ﷨return ֵ; + - ֵͻΪķֵͨһշֵ + - returnߵĴ붼ִУһִеreturnʱ˳ + - returnԸ͵ֵǻͣҲһ + - return󲻸ֵDzдreturnĬϷundefined + - breakcontinuereturn + - break + - ˳ѭ + - continue + - ѭ + - return + - ˳ + + - ʵҲ͡ + + - method + - ԽһΪһԣ + һһʱ + dzǸöķ + - .(); + - (); + +2. + - ˵һ÷Χ + - JSֳ֣ + 1.ȫ + - ֱscriptǩбдĴ붼ȫ + - ȫڴҳʱҳرʱ١ + - ȫһȫֶwindowwindowṩ + ҳֱʹãĴڡ + - ȫдıΪwindowԱ + ȫдĺΪwindowķ + - ȫдıͺҳλ÷ʡ + ںҲԷʵȫı + - Ҫȫд + + 2. + - Ǻִʱÿεúᴴһµĺ + - ںִʱںִнʱ١ + - ںдıȫзʡ + - ںʹһʱѰң + ҵֱʹãûҵһѰң + ҵʹãҲңһֱ + + - ǰ + - ȫУʹvarؼıеĴִ֮ǰDzḳֵ + ǿڱǰʹñDzʹvarؼıᱻǰ + - ںУҲиԣʹvarؼıںеĴִǰ + ûʹvarؼȫֱ + + - ǰ + - ȫУʹúĺfunction fun(){},еĴִ֮ǰ + Ҳǿںǰȥúʹúʽ(var fun = function(){})ĺûи + - ںУʹúĺеĺеĴִ֮ǰͱˡ + +3.thisĶ + - ÿεúʱὫһĶΪIJݽ + ʹthisĶ󣬸ݺĵʽͬthisֵҲͬ + - thisIJͬ + 1.Ժʽʱthiswindow + 2.Էʽʱthisǵ÷Ķ + 3.Թ캯ʽʱthis´Ķ + +4.캯 + - 캯רĺ + - һ캯ҲԳΪһ + - ͨһ캯ĶdzƸöʱ캯ʵ + - ͨͬһ캯ĶdzΪһ + - 캯һͨĺֻĵ÷ʽͬ + ֱӵãһͨ + ʹnewãһ캯 + + - ӣ + function Person(){ + + } + + - 캯ִ̣ + 1.һµĶ + 2.µĶΪĶthis + 3.ִкеĴ + 4.½Ķ󷵻 + + - instanceof һǷһʵ + - ﷨ instanceof 캯 + - öʱ캯ʵ򷵻true򷵻false + - ObjectжȣκζObjectinstanceof᷵true + + - öٶе + for...in + ﷨ + for(var in ){ + + } + + for...inѭִжΣмԾͻִмΣ + ÿνһֵǶıǿͨȡе + + + + + + + + + + + + + + + + \ No newline at end of file diff --git "a/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\347\254\224\350\256\260/day12/note/\347\254\224\350\256\260.txt" "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\347\254\224\350\256\260/day12/note/\347\254\224\350\256\260.txt" new file mode 100644 index 00000000..6c379e0c --- /dev/null +++ "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\347\254\224\350\256\260/day12/note/\347\254\224\350\256\260.txt" @@ -0,0 +1,116 @@ +1.ԭͣprototype + - һԺ󣬽Ĭںһprototype + prototypeָһdzΪԭͶ + - Ϊ캯ʹãĶжһִиԭͶ + Կͨ.__proto__ʡ + - ԭͶ൱һ򣬷ͨͬһ캯ĶͨԷʵͬԭͶ + ǿԽйеԺͷͳһӵԭͶУ + ֻҪһΣͿʹеĶ󶼿ʹá + - ȥʶһԻöһʱѰң + ҵˣֱʹá + ûҵȥԭͶѰңҵʹã + ûҵȥԭ͵ԭѰңơֱҵObjectԭΪֹObjectԭ͵ԭΪnull + Ȼûҵ򷵻undefined + - hasOwnProperty() + - Ƿij + - ﷨.hasOwnProperty("") + +2.飨Array + - Ҳһһ洢ݵĶ + ObjectƣĴ洢ЧʱͨҪ + - бdzΪԪ + - ʹindexԪ + - ָ0ʼ + - IJ + - + - var arr = new Array(); + - var arr = []; + + - Ԫ + - ﷨ + [] = ֵ; + arr[0] = 123; + arr[1] = "hello"; + + - ʱֱԪ + - ﷨ + var arr = [Ԫ1,Ԫ2....ԪN]; + - ӣ + var arr = [123,"hello",true,null]; + + - ȡ޸ij + - ʹlengthij + - ȡȣ + .length + - lengthȡ+1 + - 飬lengthȡľԪصĸ + - ޸ij + .length = ³ + - ޸ĺlengthԭȣIJֻճ + - ޸ĺlengthСԭȣԭжԪػᱻɾ + - Ԫ + [.length] = ֵ; + + - ķ + - push() + - ĩβһԪأµij + - ﷨.push(Ԫ1,Ԫ2,ԪN) + - pop() + - ɾһԪأرɾԪ + - unshift() + - ǰһԪأµij + - shift() + - ɾǰߵһԪأرɾԪ + - slice() + - ԴһнȡָԪ + - ÷Ӱԭ飬ǽȡݷװΪһµ鲢 + - + 1.ȡʼλõʼλã + 2.ȡλõλã + - ڶʡԲддһֱȡ + - ԴһֵǸֵӺǰ + - splice() + - ɾָԪأʹµԪ滻 + ÷ὫɾԪطװз + - + 1.ɾʼλõ + 2.ɾĸ + 3.Ժ󣬶滻ԪأЩԪؽ뵽ʼλǰ + + - + - ǽԪضȡ + - һǶʹforѭ飺 + for(var i=0 ; i<.length ; i++){ + //[i] + } + + - ʹforEach()飨IE8 + + .forEach(function(value , index , obj){ + + }); + + forEach()ҪһصΪ + мԪأصͻᱻüΣ + ÿεʱὫϢʵεʽݽ + ǿԶβȡЩϢ + value:ڱԪ + index:ڱԪص + obj: + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git "a/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\347\254\224\350\256\260/day13/note/DOM/01.dom\346\237\245\350\257\242.html" "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\347\254\224\350\256\260/day13/note/DOM/01.dom\346\237\245\350\257\242.html" new file mode 100644 index 00000000..7081fd04 --- /dev/null +++ "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\347\254\224\350\256\260/day13/note/DOM/01.dom\346\237\245\350\257\242.html" @@ -0,0 +1,87 @@ + + + + + Untitled Document + + + + +
    +
    +

    + 你喜欢哪个城市? +

    + +
      +
    • 北京
    • +
    • 上海
    • +
    • 东京
    • +
    • 首尔
    • +
    + +
    +
    + +

    + 你喜欢哪款单机游戏? +

    + +
      +
    • 红警
    • +
    • 实况
    • +
    • 极品飞车
    • +
    • 魔兽
    • +
    + +
    +
    + +

    + 你手机的操作系统是? +

    + +
    • IOS
    • Android
    • Windows Phone
    +
    + +
    + gender: + + Male + + Female +
    +
    + name: + +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    + + diff --git "a/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\347\254\224\350\256\260/day13/note/DOM/02.dom\345\242\236\345\210\240\346\224\271.html" "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\347\254\224\350\256\260/day13/note/DOM/02.dom\345\242\236\345\210\240\346\224\271.html" new file mode 100644 index 00000000..34587473 --- /dev/null +++ "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\347\254\224\350\256\260/day13/note/DOM/02.dom\345\242\236\345\210\240\346\224\271.html" @@ -0,0 +1,53 @@ + + + + + Untitled Document + + + + + +
    +
    +

    + 你喜欢哪个城市? +

    + +
      +
    • 北京
    • +
    • 上海
    • +
    • 东京
    • +
    • 首尔
    • +
    + +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    + + diff --git "a/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\347\254\224\350\256\260/day13/note/DOM/style/css.css" "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\347\254\224\350\256\260/day13/note/DOM/style/css.css" new file mode 100644 index 00000000..107e0a88 --- /dev/null +++ "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\347\254\224\350\256\260/day13/note/DOM/style/css.css" @@ -0,0 +1,45 @@ +@CHARSET "UTF-8"; + +body { + width: 800px; + margin-left: auto; + margin-right: auto; +} + +button { + width: 300px; + margin-bottom: 10px; +} + +#btnList { + float:left; +} + +#total{ + width: 450px; + float:left; +} + +ul{ + list-style-type: none; + margin: 0px; + padding: 0px; +} + +.inner li{ + border-style: solid; + border-width: 1px; + padding: 5px; + margin: 5px; + background-color: #99ff99; + float:left; +} + +.inner{ + width:400px; + border-style: solid; + border-width: 1px; + margin-bottom: 10px; + padding: 10px; + float: left; +} diff --git "a/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\347\254\224\350\256\260/day13/note/DOM/\347\273\203\344\271\2401 Checkbox\345\205\250\351\200\211/ex-1.html" "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\347\254\224\350\256\260/day13/note/DOM/\347\273\203\344\271\2401 Checkbox\345\205\250\351\200\211/ex-1.html" new file mode 100644 index 00000000..b3f336ff --- /dev/null +++ "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\347\254\224\350\256\260/day13/note/DOM/\347\273\203\344\271\2401 Checkbox\345\205\250\351\200\211/ex-1.html" @@ -0,0 +1,120 @@ + + + + +全选练习 + + + + + + 你爱好的运动是?全选/全不选 + +
    + 足球 + 篮球 + 羽毛球 + 乒乓球 +
    + + + + + + + + \ No newline at end of file diff --git "a/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\347\254\224\350\256\260/day13/note/DOM/\347\273\203\344\271\2401 Checkbox\345\205\250\351\200\211/ex-1\347\251\272\347\231\275.html" "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\347\254\224\350\256\260/day13/note/DOM/\347\273\203\344\271\2401 Checkbox\345\205\250\351\200\211/ex-1\347\251\272\347\231\275.html" new file mode 100644 index 00000000..6ca5e7d6 --- /dev/null +++ "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\347\254\224\350\256\260/day13/note/DOM/\347\273\203\344\271\2401 Checkbox\345\205\250\351\200\211/ex-1\347\251\272\347\231\275.html" @@ -0,0 +1,37 @@ + + + + +全选练习 + + + + + + 你爱好的运动是?全选/全不选 + +
    + 足球 + 篮球 + 羽毛球 + 乒乓球 +
    + + + + + + + + \ No newline at end of file diff --git "a/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\347\254\224\350\256\260/day13/note/DOM/\347\273\203\344\271\2402 \346\267\273\345\212\240\345\210\240\351\231\244\350\256\260\345\275\225/ex-2.html" "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\347\254\224\350\256\260/day13/note/DOM/\347\273\203\344\271\2402 \346\267\273\345\212\240\345\210\240\351\231\244\350\256\260\345\275\225/ex-2.html" new file mode 100644 index 00000000..d583a410 --- /dev/null +++ "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\347\254\224\350\256\260/day13/note/DOM/\347\273\203\344\271\2402 \346\267\273\345\212\240\345\210\240\351\231\244\350\256\260\345\275\225/ex-2.html" @@ -0,0 +1,140 @@ + + + + +添加删除记录练习 + + + + + +
    ʾͷеĵԪ + - ʾеĵԪ + - ԣ + colspan ĺϲԪ + rowspan ĺϲԪ + - ӣ + + + + + + + + + +
    + + - + -
    + + + + + + + + + + + + + + + + + + + + + + + + +
    NameEmailSalary 
    Tomtom@tom.com5000Delete
    Jerryjerry@sohu.com8000Delete
    Bobbob@tom.com10000Delete
    + +
    + +

    添加新员工

    + + + + + + + + + + + + + + + + + +
    name: + +
    email: + +
    salary: + +
    + +
    + +
    + + + diff --git "a/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\347\254\224\350\256\260/day13/note/DOM/\347\273\203\344\271\2402 \346\267\273\345\212\240\345\210\240\351\231\244\350\256\260\345\275\225/ex-2\347\251\272\347\231\275.html" "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\347\254\224\350\256\260/day13/note/DOM/\347\273\203\344\271\2402 \346\267\273\345\212\240\345\210\240\351\231\244\350\256\260\345\275\225/ex-2\347\251\272\347\231\275.html" new file mode 100644 index 00000000..95191c7f --- /dev/null +++ "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\347\254\224\350\256\260/day13/note/DOM/\347\273\203\344\271\2402 \346\267\273\345\212\240\345\210\240\351\231\244\350\256\260\345\275\225/ex-2\347\251\272\347\231\275.html" @@ -0,0 +1,76 @@ + + + + +添加删除记录练习 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameEmailSalary 
    Tomtom@tom.com5000Delete
    Jerryjerry@sohu.com8000Delete
    Bobbob@tom.com10000Delete
    + +
    + +

    添加新员工

    + + + + + + + + + + + + + + + + + +
    name: + +
    email: + +
    salary: + +
    + +
    + +
    + + + diff --git "a/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\347\254\224\350\256\260/day13/note/DOM/\347\273\203\344\271\2402 \346\267\273\345\212\240\345\210\240\351\231\244\350\256\260\345\275\225/ex_2_style/css.css" "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\347\254\224\350\256\260/day13/note/DOM/\347\273\203\344\271\2402 \346\267\273\345\212\240\345\210\240\351\231\244\350\256\260\345\275\225/ex_2_style/css.css" new file mode 100644 index 00000000..b89411a1 --- /dev/null +++ "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\347\254\224\350\256\260/day13/note/DOM/\347\273\203\344\271\2402 \346\267\273\345\212\240\345\210\240\351\231\244\350\256\260\345\275\225/ex_2_style/css.css" @@ -0,0 +1,58 @@ +@CHARSET "UTF-8"; +#total { + width: 450px; + margin-left: auto; + margin-right: auto; +} + +ul { + list-style-type: none; +} + +li { + border-style: solid; + border-width: 1px; + padding: 5px; + margin: 5px; + background-color: #99ff99; + float: left; +} + +.inner { + width: 400px; + border-style: solid; + border-width: 1px; + margin: 10px; + padding: 10px; + float: left; +} + +#employeeTable { + border-spacing: 1px; + background-color: black; + margin: 80px auto 10px auto; +} + +th,td { + background-color: white; +} + +#formDiv { + width: 250px; + border-style: solid; + border-width: 1px; + margin: 50px auto 10px auto; + padding: 10px; +} + +#formDiv input { + width: 100%; +} + +.word { + width: 40px; +} + +.inp { + width: 200px; +} \ No newline at end of file diff --git "a/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\347\254\224\350\256\260/day13/note/\345\244\215\344\271\240.txt" "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\347\254\224\350\256\260/day13/note/\345\244\215\344\271\240.txt" new file mode 100644 index 00000000..115fe13e --- /dev/null +++ "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\347\254\224\350\256\260/day13/note/\345\244\215\344\271\240.txt" @@ -0,0 +1,222 @@ +1.鷽 + reverse() + - תһ飬ԭӰ + concat() + - 飬Ӱԭ飬Ϊֵ + join() + - ԽһתΪһַ + - + ҪһַΪַΪӷеԪ + ָӷĬʹ, + sort() + - ԶһеݽĬǰUnicode + Ժ󣬻ֱ޸ԭ顣 + - ԼָĹҪһصΪ + function(a,b){ + + // + //return a-b; + + // + return b-a; + } + +2. + - call() + - apply() + - ǺķҪͨ + - ֱͨӵúҿͨһʵָthis + - ͬcallֱӴݺʵζapplyҪʵηװһд + - arguments + - argumentsthisƣǺеIJ + - argumentsһԪأװִйеʵ + ԼʹβΣҲͨargumentsʹʵ + - argumentsһcalleeʾǰִеĺ + + - this + - thisǺĶ󣬸ݺĵ÷ʽִͬͬĶ + 1.Ժʽʱthiswindow + 2.Էʽʱthisǵ÷Ķ + 3.Թ캯ʽʱthis½Ǹ + 4.ʹcallapplyʱthisָǸ + 5.ȫthiswindow + +3.װ + - JSΪṩװࣺ + String() Boolean() Number() + - ͨװԴ͵Ķ + ӣ + var num = new Number(2); + var str = new String("hello"); + var bool = new Boolean(true); + - ʵӦǧҪôɡ + + - ȥһ͵Ժͷʱ + ʱתΪӦİװ࣬ȻȥԺͷ + Ժٽʱ١ + +4.ַصķ + length + - ȡַij + charAt() + - ȡַָ + charCodeAt() + - ȡַָ + String.fromCharCode() + - ַȡַ + indexOf() + lastIndexOf() + - һַмָ + - ҪһַΪַҪݣ + ҵݣ᷵һγֵûҵ򷵻-1 + - ָһڶʾʼҵλ + - indexOf()Ǵǰ + - lastIndexOf()ǴӺǰ + slice() + - ԴһַнȡָݣȡݷأӰԭ + - + һȡʼλãʼ + ڶȡλã + - ʡԵڶʡһֱȡ + - ԴǸӺǰ + substr() + - slice()һ£ͬڶǽȡ + + substring() + - slice()һ£ֵܸͬܽΪһֵԶΪ0 + substring()ڶСڵһԶλ + toLowerCase() + - ַתΪСд + toUpperCase() + - ַתΪд + split() + - ԸָݽһַΪһ + - + - ҪһַΪַȥ + Խһʽʱʽȥ + + match() + - Խַкʽƥȡ + - + - ʽԸݸʽַзҪȡ + ҷװһз + + replace() + - Խַָ滻Ϊµ + - + - һ滻ݣһʽ + - ڶ滻 + + search() + - Ըʽȥַвָ + - + ʽݸñʽѯݣ + ҽһƥ䵽ݵأûƥ䵽κݣ򷵻-1 + +5.ʽ + - һЩַĹ򣬳ԸЩжһַǷϹ + ҲԽһַзϹȡ + - ʽ + - var reg = new RegExp("","ƥģʽ"); + - var reg = /ʽ/ƥģʽ + + - ﷨ + ƥģʽ + i:ԴСд + g:ȫƥģʽ + - ƥģʽʱԶãҲ1Ҳȫãʱû˳Ҫ + + ﷨ + | + [] + [^ ] + [a-z] Сдĸ + [A-Z] дĸ + [A-z] ĸ + [0-9] + + - + test() + - һַǷʽ + - Ϸtrue򷵻false + +6.Date + - ڵĶJSͨDateʾһʱ + - + - һǰʱ + var d = new Date(); + - һָʱ + var d = new Date("// ʱ::"); + + - + getDate() + - ǰڶǼգ1-31 + + getDay() + - صǰڶʱܼ0-6 + - 0 + - 1 һ + + getMonth() + - صǰڶ·ݣ0-11 + - 0 һ 1 + getFullYear() Date λַݡ + + getHours() Date Сʱ (0 ~ 23) + getMinutes() Date ķ (0 ~ 59) + getSeconds() Date (0 ~ 59) + getMilliseconds() Date ĺ(0 ~ 999) + + getTime() + - صǰڶʱ + - ʱָǴ19701 0ʱ00룬ʱĺ + ײ㱣ʱ䶼ʱʽġ + + Date.now() + - Իȡǰִʱʱ + + +7.Math + - Mathһ࣬ҪǴ߷װصijͷ + ǿֱʹѧصIJ + - + Math.PI + - Բ + Math.abs() + - ֵ + Math.ceil() + - ȡ + Math.floor() + - ȡ + Math.round() + - ȡ + Math.random() + - һ0-1֮ + - һx-y֮ + Math.round(Math.random()*(y-x)+x); + Math.pow(x,y) + - xy + Math.sqrt() + - һп + Math.max() + - ֵ + Math.min() + - еСֵ + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git "a/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\347\254\224\350\256\260/day14/note/\347\254\224\350\256\260.txt" "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\347\254\224\350\256\260/day14/note/\347\254\224\350\256\260.txt" new file mode 100644 index 00000000..c452fd65 --- /dev/null +++ "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\347\254\224\350\256\260/day14/note/\347\254\224\350\256\260.txt" @@ -0,0 +1,150 @@ +1.ʽ + - ﷨ + - + {n} n + {m,n} m-n + {m,} m + + 1 {1,} + ? 0λ1 {0,1} + * 0λ {0,} + + - תַ + \ ʽʹ\Ϊתַ + \. ʾ. + \\ ʾ\ + . ʾַ + \w + - ൱[A-z0-9_] + \W + - ൱[^A-z0-9_] + \d + - + \D + - + \s + - ո + \S + - ˿ո + \b + - ʱ߽ + \B + - ˵ʱ߽ + ^ ʾʼ + $ ʾ + +2.DOM + - Document Object Model + - ĵģͣͨDOM޸ҳи + - ĵ + - ĵָҳһҳһĵ + - + - ָҳеÿһڵ㶼תΪ + תԺ󣬾Ϳһִʽҳ + - ģ + - ģʾڵͽڵ֮Ĺϵҳ + - ڵ㣨Node + - ڵǹҳĵԪҳеÿһֶԳΪһڵ + - Ȼǽڵ㣬ǽڵȴDzͬ + - õĽڵ + - ĵڵ Documentҳ + - Ԫؽڵ㣨Elementҳеıǩ + - Խڵ㣨Attributeǩе + - ıڵ㣨Textҳеı + + - DOM + - DOMѯ + - ҳѾΪṩdocument + ҳwindowԣҳֱʹá + - documentѯ + - ԪصidԲѯһԪؽڵ + - document.getElementById("idֵ"); + - ԪصnameֵѯһԪؽڵ: + - document.getElementsByName("nameֵ"); + - ݱǩѯһԪؽڵ + - document.getElementsByTagName("ǩ"); + + - Ԫصԣ + - ȡԪصԣ + ﷨Ԫ. + ӣele.name + ele.id + ele.value + ele.className + + - ޸Ԫصԣ + ﷨Ԫ. = ֵ + + - innerHTML + - ʹøԿԻȡԪڲHTML + + + - ¼Event + - ¼ָû֮ĽΪ磺ťرմڡƶ + - ǿΪ¼󶨻صӦ¼ + - ¼ķʽ + 1.ڱǩ¼ӦJS + ӣ + + 2.ͨΪָ¼ûصʽ¼ + ӣ + + + + - ĵļ + - ڼһҳʱǰµ˳صģһִһС + - jsдҳϱߣִʱҳеDOMûмأ + ʱ޷ȡDOM󣬵DOMʧܡ + - ʽһ + - Խjsдbody± + + + + + + - ʽ + - jsдwindow.onload = function(){} + - window.onload ӦĻصҳԺִУ + ԿȷִʱDOMѾ + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git "a/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\347\254\224\350\256\260/day15/note/eventObj.html" "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\347\254\224\350\256\260/day15/note/eventObj.html" new file mode 100644 index 00000000..e457e868 --- /dev/null +++ "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\347\254\224\350\256\260/day15/note/eventObj.html" @@ -0,0 +1,42 @@ + + + + +Insert title here + + + + + +
    +
    + + + \ No newline at end of file diff --git "a/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\347\254\224\350\256\260/day15/note/\345\233\276\347\211\207.png" "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\347\254\224\350\256\260/day15/note/\345\233\276\347\211\207.png" new file mode 100644 index 00000000..d600a21d Binary files /dev/null and "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\347\254\224\350\256\260/day15/note/\345\233\276\347\211\207.png" differ diff --git "a/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\347\254\224\350\256\260/day15/note/\347\254\224\350\256\260.txt" "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\347\254\224\350\256\260/day15/note/\347\254\224\350\256\260.txt" new file mode 100644 index 00000000..099e1f73 --- /dev/null +++ "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\347\254\224\350\256\260/day15/note/\347\254\224\350\256\260.txt" @@ -0,0 +1,95 @@ +1.DOMѯ + - ͨԪؽڵѯ + - Ԫ.getElementsByTagName() + - ͨǩѯǰԪصָԪ + + - Ԫ.childNodes + - ȡǰԪصӽڵ + - ȡհ׵ıӽڵ + + - Ԫ.children + - ȡǰԪصԪ + + - Ԫ.firstChild + - ȡǰԪصĵһӽڵ + + - Ԫ.lastChild + - ȡǰԪصһӽڵ + + - Ԫ.parentNode + - ȡǰԪصĸԪ + + - Ԫ.previousSibling + - ȡǰԪصǰһֵܽڵ + + - Ԫ.nextSibling + - ȡǰԪصĺһֵܽڵ + + innerHTMLinnerText + - ԲûDOM׼壬Ǵ󲿷֧ + - ƣԻȡǩڲݣ + ͬinnerHTMLȡhtmlǩinnerTextԶȥǩ + - ʹñǩڲʱûκ + + ȡǩڲı +

    h1еı

    + Ԫ.firstChild.nodeValue + + - documentԺͷ + document.all + - ȡҳеԪأ൱document.getElementsByTagName("*"); + + document.documentElement + - ȡҳhtmlԪ + + document.body + - ȡҳеbodyԪ + + document.getElementsByClassName() + - ԪصclassֵѯһԪؽڵ + - ֧IE8µ + + document.querySelector() + - CSSѡȥҳвѯһԪ + - ƥ䵽Ԫж᷵زѯĵһԪ + + document.querySelectorAll() + - CSSѡȥҳвѯһԪ + - Ὣƥ䵽Ԫطװһзأʹֻƥ䵽һ + +2.DOM޸ + document.createElement() + - ԸݱǩһԪؽڵ + + document.createTextNode() + - Ըıݴһıڵ + + ڵ.appendChild(ӽڵ) + - 򸸽ڵָӽڵ + + ڵ.insertBefore(½ڵ,ɽڵ) + - һµĽڵ뵽ɽڵǰ + + ڵ.replaceChild(½ڵ,ɽڵ) + - ʹһµĽڵȥ滻ɽڵ + + ڵ.removeChild(ӽڵ) + - ɾָӽڵ + - Ƽʽӽڵ.parentNode.removeChild(ӽڵ) + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git "a/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\347\254\224\350\256\260/day16/note/\344\272\213\344\273\266\347\232\204\344\274\240\346\222\255.png" "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\347\254\224\350\256\260/day16/note/\344\272\213\344\273\266\347\232\204\344\274\240\346\222\255.png" new file mode 100644 index 00000000..f9053acc Binary files /dev/null and "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\347\254\224\350\256\260/day16/note/\344\272\213\344\273\266\347\232\204\344\274\240\346\222\255.png" differ diff --git "a/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\347\254\224\350\256\260/day16/note/\346\213\226\346\213\275.png" "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\347\254\224\350\256\260/day16/note/\346\213\226\346\213\275.png" new file mode 100644 index 00000000..de855f7b Binary files /dev/null and "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\347\254\224\350\256\260/day16/note/\346\213\226\346\213\275.png" differ diff --git "a/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\347\254\224\350\256\260/day16/note/\347\254\224\350\256\260.txt" "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\347\254\224\350\256\260/day16/note/\347\254\224\350\256\260.txt" new file mode 100644 index 00000000..95a97e48 --- /dev/null +++ "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\347\254\224\350\256\260/day16/note/\347\254\224\350\256\260.txt" @@ -0,0 +1,107 @@ +1.DOMCSSIJ + - ȡ޸ʽ + - ʹstyleԪصʽ + - ȡʽ + ﷨Ԫ.style.ʽ + - ӣ + Ԫ.style.width + Ԫ.style.height + - ע⣺ʽд-Ҫʽ޸Ϊշ + -ȥȻ-ĸĴд + - 磺background-color --> backgroundColor + border-width ---> borderWidth + + - ޸ʽ + ﷨Ԫ.style.ʽ = ʽֵ + - ͨstyle޸ĵʽʽʽȼȽϸߣ + ͨJS޸ĵʽЧ + ʽ!importantʽЧ + + - ȡԪصĵǰʽ + - + - ʹgetComputedStyle() + - windowķԷһбŵǰԪЧʽ + - + 1.ҪȡʽԪ + 2.ԴһαԪأһ㴫null + - ӣ + ȡԪصĿ + getComputedStyle(box , null)["width"]; + - ͨ÷ȡʽֻIJ޸ + + - IE8 + - ʹcurrentStyle + - ﷨ + Ԫ.currentStyle.ʽ + - ӣ + box.currentStyle["width"] + - ͨԶȡʽֻIJ޸ + + - ʽص + ע⣺ʽֻ + + clientHeight + - ԪصĿɼ߶ȣָԪصڱ߾ĸ߶ + clientWidth + - ԪصĿɼȣָԪصڱ߾Ŀ + offsetHeight + - Ԫصĸ߶ȣڱ߾ࡢ߿ + offfsetWidth + - ԪصĿȣڱ߾ࡢ߿ + offsetParent + - ǰԪصĶλԪ + - Ŀ˶λԪأеԪضûпλ򷵻body + offsetLeft + offsetTop + - ǰԪغͶλԪ֮ƫ + - offsetLeftˮƽƫ offsetTopֱƫ + + scrollHeight + scrollWidth + - ȡԪعĸ߶ȺͿ + + scrollTop + scrollLeft + - ȡԪشֱˮƽľ + + жϹǷ + - ֱ + scrollHeight - scrollTop = clientHeight + + - ˮƽ + scrollWidth - scrollLeft = clientWidth + +2.¼Event + - ¼ + - ӦʱÿζὫһ¼ΪʵδݽӦУ + ¼зװ˵ǰ¼Ϣ磺̵꣬İİֵķ򡣡 + - ӦжһβΣʹ¼󣬵IE8¼ûʵδݣΪwindowԱ + - ӣ + Ԫ.¼ = function(event){ + event = event || window.event; + + }; + + Ԫ.¼ = function(e){ + e = e || event; + + }; + + - ¼ðݣBubble + - ¼ðָ¼ϴԪϵ¼ʱᵼԪϵͬ¼Ҳᴥ + - ¼ðݴ󲿷¶ģҪȡðݣҪʹ¼ȡ + - Խ¼cancelBubbleΪtrueȡð + - ӣ + Ԫ.¼ = function(event){ + event = event || window.event; + event.cancelBubble = true; + }; + + + + + + + + + \ No newline at end of file diff --git "a/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\347\254\224\350\256\260/day17/note/\347\273\203\344\271\240/01.\350\275\256\346\222\255\345\233\276.html" "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\347\254\224\350\256\260/day17/note/\347\273\203\344\271\240/01.\350\275\256\346\222\255\345\233\276.html" new file mode 100644 index 00000000..7ee2c5de --- /dev/null +++ "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\347\254\224\350\256\260/day17/note/\347\273\203\344\271\240/01.\350\275\256\346\222\255\345\233\276.html" @@ -0,0 +1,248 @@ + + + + + + + + + + + + + +
    + + +
      +
    • 冰棍
    • +
    • 冰棍
    • +
    • 冰棍
    • +
    • 冰棍
    • +
    • 冰棍
    • +
    • 冰棍
    • +
    + + + + +
    + + + diff --git "a/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\347\254\224\350\256\260/day17/note/\347\273\203\344\271\240/img/1.jpg" "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\347\254\224\350\256\260/day17/note/\347\273\203\344\271\240/img/1.jpg" new file mode 100644 index 00000000..03afb30c Binary files /dev/null and "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\347\254\224\350\256\260/day17/note/\347\273\203\344\271\240/img/1.jpg" differ diff --git "a/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\347\254\224\350\256\260/day17/note/\347\273\203\344\271\240/img/2.jpg" "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\347\254\224\350\256\260/day17/note/\347\273\203\344\271\240/img/2.jpg" new file mode 100644 index 00000000..b88750dc Binary files /dev/null and "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\347\254\224\350\256\260/day17/note/\347\273\203\344\271\240/img/2.jpg" differ diff --git "a/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\347\254\224\350\256\260/day17/note/\347\273\203\344\271\240/img/3.jpg" "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\347\254\224\350\256\260/day17/note/\347\273\203\344\271\240/img/3.jpg" new file mode 100644 index 00000000..eb0d14e8 Binary files /dev/null and "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\347\254\224\350\256\260/day17/note/\347\273\203\344\271\240/img/3.jpg" differ diff --git "a/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\347\254\224\350\256\260/day17/note/\347\273\203\344\271\240/img/4.jpg" "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\347\254\224\350\256\260/day17/note/\347\273\203\344\271\240/img/4.jpg" new file mode 100644 index 00000000..018c9a16 Binary files /dev/null and "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\347\254\224\350\256\260/day17/note/\347\273\203\344\271\240/img/4.jpg" differ diff --git "a/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\347\254\224\350\256\260/day17/note/\347\273\203\344\271\240/img/5.jpg" "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\347\254\224\350\256\260/day17/note/\347\273\203\344\271\240/img/5.jpg" new file mode 100644 index 00000000..95136fd2 Binary files /dev/null and "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\347\254\224\350\256\260/day17/note/\347\273\203\344\271\240/img/5.jpg" differ diff --git "a/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\347\254\224\350\256\260/day17/note/\347\273\203\344\271\240/js/json2.js" "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\347\254\224\350\256\260/day17/note/\347\273\203\344\271\240/js/json2.js" new file mode 100644 index 00000000..d4720c0f --- /dev/null +++ "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\347\254\224\350\256\260/day17/note/\347\273\203\344\271\240/js/json2.js" @@ -0,0 +1,506 @@ +// json2.js +// 2016-05-01 +// Public Domain. +// NO WARRANTY EXPRESSED OR IMPLIED. USE AT YOUR OWN RISK. +// See http://www.JSON.org/js.html +// This code should be minified before deployment. +// See http://javascript.crockford.com/jsmin.html + +// USE YOUR OWN COPY. IT IS EXTREMELY UNWISE TO LOAD CODE FROM SERVERS YOU DO +// NOT CONTROL. + +// This file creates a global JSON object containing two methods: stringify +// and parse. This file is provides the ES5 JSON capability to ES3 systems. +// If a project might run on IE8 or earlier, then this file should be included. +// This file does nothing on ES5 systems. + +// JSON.stringify(value, replacer, space) +// value any JavaScript value, usually an object or array. +// replacer an optional parameter that determines how object +// values are stringified for objects. It can be a +// function or an array of strings. +// space an optional parameter that specifies the indentation +// of nested structures. If it is omitted, the text will +// be packed without extra whitespace. If it is a number, +// it will specify the number of spaces to indent at each +// level. If it is a string (such as "\t" or " "), +// it contains the characters used to indent at each level. +// This method produces a JSON text from a JavaScript value. +// When an object value is found, if the object contains a toJSON +// method, its toJSON method will be called and the result will be +// stringified. A toJSON method does not serialize: it returns the +// value represented by the name/value pair that should be serialized, +// or undefined if nothing should be serialized. The toJSON method +// will be passed the key associated with the value, and this will be +// bound to the value. + +// For example, this would serialize Dates as ISO strings. + +// Date.prototype.toJSON = function (key) { +// function f(n) { +// // Format integers to have at least two digits. +// return (n < 10) +// ? "0" + n +// : n; +// } +// return this.getUTCFullYear() + "-" + +// f(this.getUTCMonth() + 1) + "-" + +// f(this.getUTCDate()) + "T" + +// f(this.getUTCHours()) + ":" + +// f(this.getUTCMinutes()) + ":" + +// f(this.getUTCSeconds()) + "Z"; +// }; + +// You can provide an optional replacer method. It will be passed the +// key and value of each member, with this bound to the containing +// object. The value that is returned from your method will be +// serialized. If your method returns undefined, then the member will +// be excluded from the serialization. + +// If the replacer parameter is an array of strings, then it will be +// used to select the members to be serialized. It filters the results +// such that only members with keys listed in the replacer array are +// stringified. + +// Values that do not have JSON representations, such as undefined or +// functions, will not be serialized. Such values in objects will be +// dropped; in arrays they will be replaced with null. You can use +// a replacer function to replace those with JSON values. + +// JSON.stringify(undefined) returns undefined. + +// The optional space parameter produces a stringification of the +// value that is filled with line breaks and indentation to make it +// easier to read. + +// If the space parameter is a non-empty string, then that string will +// be used for indentation. If the space parameter is a number, then +// the indentation will be that many spaces. + +// Example: + +// text = JSON.stringify(["e", {pluribus: "unum"}]); +// // text is '["e",{"pluribus":"unum"}]' + +// text = JSON.stringify(["e", {pluribus: "unum"}], null, "\t"); +// // text is '[\n\t"e",\n\t{\n\t\t"pluribus": "unum"\n\t}\n]' + +// text = JSON.stringify([new Date()], function (key, value) { +// return this[key] instanceof Date +// ? "Date(" + this[key] + ")" +// : value; +// }); +// // text is '["Date(---current time---)"]' + +// JSON.parse(text, reviver) +// This method parses a JSON text to produce an object or array. +// It can throw a SyntaxError exception. + +// The optional reviver parameter is a function that can filter and +// transform the results. It receives each of the keys and values, +// and its return value is used instead of the original value. +// If it returns what it received, then the structure is not modified. +// If it returns undefined then the member is deleted. + +// Example: + +// // Parse the text. Values that look like ISO date strings will +// // be converted to Date objects. + +// myData = JSON.parse(text, function (key, value) { +// var a; +// if (typeof value === "string") { +// a = +// /^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2}(?:\.\d*)?)Z$/.exec(value); +// if (a) { +// return new Date(Date.UTC(+a[1], +a[2] - 1, +a[3], +a[4], +// +a[5], +a[6])); +// } +// } +// return value; +// }); + +// myData = JSON.parse('["Date(09/09/2001)"]', function (key, value) { +// var d; +// if (typeof value === "string" && +// value.slice(0, 5) === "Date(" && +// value.slice(-1) === ")") { +// d = new Date(value.slice(5, -1)); +// if (d) { +// return d; +// } +// } +// return value; +// }); + +// This is a reference implementation. You are free to copy, modify, or +// redistribute. + +/*jslint + eval, for, this +*/ + +/*property + JSON, apply, call, charCodeAt, getUTCDate, getUTCFullYear, getUTCHours, + getUTCMinutes, getUTCMonth, getUTCSeconds, hasOwnProperty, join, + lastIndex, length, parse, prototype, push, replace, slice, stringify, + test, toJSON, toString, valueOf +*/ + + +// Create a JSON object only if one does not already exist. We create the +// methods in a closure to avoid creating global variables. + +if (typeof JSON !== "object") { + JSON = {}; +} + +(function () { + "use strict"; + + var rx_one = /^[\],:{}\s]*$/; + var rx_two = /\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g; + var rx_three = /"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g; + var rx_four = /(?:^|:|,)(?:\s*\[)+/g; + var rx_escapable = /[\\\"\u0000-\u001f\u007f-\u009f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g; + var rx_dangerous = /[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g; + + function f(n) { + // Format integers to have at least two digits. + return n < 10 + ? "0" + n + : n; + } + + function this_value() { + return this.valueOf(); + } + + if (typeof Date.prototype.toJSON !== "function") { + + Date.prototype.toJSON = function () { + + return isFinite(this.valueOf()) + ? this.getUTCFullYear() + "-" + + f(this.getUTCMonth() + 1) + "-" + + f(this.getUTCDate()) + "T" + + f(this.getUTCHours()) + ":" + + f(this.getUTCMinutes()) + ":" + + f(this.getUTCSeconds()) + "Z" + : null; + }; + + Boolean.prototype.toJSON = this_value; + Number.prototype.toJSON = this_value; + String.prototype.toJSON = this_value; + } + + var gap; + var indent; + var meta; + var rep; + + + function quote(string) { + +// If the string contains no control characters, no quote characters, and no +// backslash characters, then we can safely slap some quotes around it. +// Otherwise we must also replace the offending characters with safe escape +// sequences. + + rx_escapable.lastIndex = 0; + return rx_escapable.test(string) + ? "\"" + string.replace(rx_escapable, function (a) { + var c = meta[a]; + return typeof c === "string" + ? c + : "\\u" + ("0000" + a.charCodeAt(0).toString(16)).slice(-4); + }) + "\"" + : "\"" + string + "\""; + } + + + function str(key, holder) { + +// Produce a string from holder[key]. + + var i; // The loop counter. + var k; // The member key. + var v; // The member value. + var length; + var mind = gap; + var partial; + var value = holder[key]; + +// If the value has a toJSON method, call it to obtain a replacement value. + + if (value && typeof value === "object" && + typeof value.toJSON === "function") { + value = value.toJSON(key); + } + +// If we were called with a replacer function, then call the replacer to +// obtain a replacement value. + + if (typeof rep === "function") { + value = rep.call(holder, key, value); + } + +// What happens next depends on the value's type. + + switch (typeof value) { + case "string": + return quote(value); + + case "number": + +// JSON numbers must be finite. Encode non-finite numbers as null. + + return isFinite(value) + ? String(value) + : "null"; + + case "boolean": + case "null": + +// If the value is a boolean or null, convert it to a string. Note: +// typeof null does not produce "null". The case is included here in +// the remote chance that this gets fixed someday. + + return String(value); + +// If the type is "object", we might be dealing with an object or an array or +// null. + + case "object": + +// Due to a specification blunder in ECMAScript, typeof null is "object", +// so watch out for that case. + + if (!value) { + return "null"; + } + +// Make an array to hold the partial results of stringifying this object value. + + gap += indent; + partial = []; + +// Is the value an array? + + if (Object.prototype.toString.apply(value) === "[object Array]") { + +// The value is an array. Stringify every element. Use null as a placeholder +// for non-JSON values. + + length = value.length; + for (i = 0; i < length; i += 1) { + partial[i] = str(i, value) || "null"; + } + +// Join all of the elements together, separated with commas, and wrap them in +// brackets. + + v = partial.length === 0 + ? "[]" + : gap + ? "[\n" + gap + partial.join(",\n" + gap) + "\n" + mind + "]" + : "[" + partial.join(",") + "]"; + gap = mind; + return v; + } + +// If the replacer is an array, use it to select the members to be stringified. + + if (rep && typeof rep === "object") { + length = rep.length; + for (i = 0; i < length; i += 1) { + if (typeof rep[i] === "string") { + k = rep[i]; + v = str(k, value); + if (v) { + partial.push(quote(k) + ( + gap + ? ": " + : ":" + ) + v); + } + } + } + } else { + +// Otherwise, iterate through all of the keys in the object. + + for (k in value) { + if (Object.prototype.hasOwnProperty.call(value, k)) { + v = str(k, value); + if (v) { + partial.push(quote(k) + ( + gap + ? ": " + : ":" + ) + v); + } + } + } + } + +// Join all of the member texts together, separated with commas, +// and wrap them in braces. + + v = partial.length === 0 + ? "{}" + : gap + ? "{\n" + gap + partial.join(",\n" + gap) + "\n" + mind + "}" + : "{" + partial.join(",") + "}"; + gap = mind; + return v; + } + } + +// If the JSON object does not yet have a stringify method, give it one. + + if (typeof JSON.stringify !== "function") { + meta = { // table of character substitutions + "\b": "\\b", + "\t": "\\t", + "\n": "\\n", + "\f": "\\f", + "\r": "\\r", + "\"": "\\\"", + "\\": "\\\\" + }; + JSON.stringify = function (value, replacer, space) { + +// The stringify method takes a value and an optional replacer, and an optional +// space parameter, and returns a JSON text. The replacer can be a function +// that can replace values, or an array of strings that will select the keys. +// A default replacer method can be provided. Use of the space parameter can +// produce text that is more easily readable. + + var i; + gap = ""; + indent = ""; + +// If the space parameter is a number, make an indent string containing that +// many spaces. + + if (typeof space === "number") { + for (i = 0; i < space; i += 1) { + indent += " "; + } + +// If the space parameter is a string, it will be used as the indent string. + + } else if (typeof space === "string") { + indent = space; + } + +// If there is a replacer, it must be a function or an array. +// Otherwise, throw an error. + + rep = replacer; + if (replacer && typeof replacer !== "function" && + (typeof replacer !== "object" || + typeof replacer.length !== "number")) { + throw new Error("JSON.stringify"); + } + +// Make a fake root object containing our value under the key of "". +// Return the result of stringifying the value. + + return str("", {"": value}); + }; + } + + +// If the JSON object does not yet have a parse method, give it one. + + if (typeof JSON.parse !== "function") { + JSON.parse = function (text, reviver) { + +// The parse method takes a text and an optional reviver function, and returns +// a JavaScript value if the text is a valid JSON text. + + var j; + + function walk(holder, key) { + +// The walk method is used to recursively walk the resulting structure so +// that modifications can be made. + + var k; + var v; + var value = holder[key]; + if (value && typeof value === "object") { + for (k in value) { + if (Object.prototype.hasOwnProperty.call(value, k)) { + v = walk(value, k); + if (v !== undefined) { + value[k] = v; + } else { + delete value[k]; + } + } + } + } + return reviver.call(holder, key, value); + } + + +// Parsing happens in four stages. In the first stage, we replace certain +// Unicode characters with escape sequences. JavaScript handles many characters +// incorrectly, either silently deleting them, or treating them as line endings. + + text = String(text); + rx_dangerous.lastIndex = 0; + if (rx_dangerous.test(text)) { + text = text.replace(rx_dangerous, function (a) { + return "\\u" + + ("0000" + a.charCodeAt(0).toString(16)).slice(-4); + }); + } + +// In the second stage, we run the text against regular expressions that look +// for non-JSON patterns. We are especially concerned with "()" and "new" +// because they can cause invocation, and "=" because it can cause mutation. +// But just to be safe, we want to reject all unexpected forms. + +// We split the second stage into 4 regexp operations in order to work around +// crippling inefficiencies in IE's and Safari's regexp engines. First we +// replace the JSON backslash pairs with "@" (a non-JSON character). Second, we +// replace all simple value tokens with "]" characters. Third, we delete all +// open brackets that follow a colon or comma or that begin the text. Finally, +// we look to see that the remaining characters are only whitespace or "]" or +// "," or ":" or "{" or "}". If that is so, then the text is safe for eval. + + if ( + rx_one.test( + text + .replace(rx_two, "@") + .replace(rx_three, "]") + .replace(rx_four, "") + ) + ) { + +// In the third stage we use the eval function to compile the text into a +// JavaScript structure. The "{" operator is subject to a syntactic ambiguity +// in JavaScript: it can begin a block or an object literal. We wrap the text +// in parens to eliminate the ambiguity. + + j = eval("(" + text + ")"); + +// In the optional fourth stage, we recursively walk the new structure, passing +// each name/value pair to a reviver function for possible transformation. + + return (typeof reviver === "function") + ? walk({"": j}, "") + : j; + } + +// If the text is not JSON parseable, then a SyntaxError is thrown. + + throw new SyntaxError("JSON.parse"); + }; + } +}()); diff --git "a/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\347\254\224\350\256\260/day17/note/\347\273\203\344\271\240/js/tools.js" "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\347\254\224\350\256\260/day17/note/\347\273\203\344\271\240/js/tools.js" new file mode 100644 index 00000000..ed9e23c2 --- /dev/null +++ "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\347\254\224\350\256\260/day17/note/\347\273\203\344\271\240/js/tools.js" @@ -0,0 +1,121 @@ +/* + * 可以用来获取任意的样式 + */ +function getStyle(obj, name) { + + return window.getComputedStyle && getComputedStyle(obj, null)[name] || obj.currentStyle[name]; +} + +/* + * 提取出一个函数,可以处理一些简单的动画效果 + * 参数: + * obj: 要执行动画的元素 + * attr: 执行动画是要修改的属性 + * target: 执行动画的目标位置 + * speed: 执行动画的速度 + * callback: 回调函数,这个函数将会在动画执行完毕之后被调用 + */ +function move(obj, attr, target, speed, callback) { + //开启定时器前,关闭上一个 + /* + * 这里我们的timer是一个全局变量,所有的动画执行时,都会共享同一个timer + * 这样将会导致我们执行box2的动画时,会使box1的动画也立即终止 + * 所以我们定时器的标识不能作为全局变量保存,而应该保存到要执行动画的对象上 + */ + clearInterval(obj.timer); + + //获取当前值,动画执行的起始位置 + var current = parseInt(getStyle(obj, attr)); + //起始位置 大于 目标位置 speed为负 + //起始位置 小于 目标位置 speed为正 + if(current > target) { + //此时speed应该是负数 + speed = -speed; + } + + //开启一个定时器,用来移动box1 + obj.timer = setInterval(function() { + //获取box1的left属性值 + var oldValue = parseInt(getStyle(obj, attr)); + //修改值 + var newValue = oldValue + speed; + //如果newValue大于800 + //如果向右移动,则newValue > target speed为正 + //如果向左移动,则newValue < target speed为负 + if(speed > 0 && newValue > target || speed < 0 && newValue < target) { + newValue = target + } + //将其赋值给box1 + obj.style[attr] = newValue + "px"; + //当运行800px时,停止执行动画 + if(newValue == target) { + clearInterval(obj.timer); + //动画执行完毕,调用回调函数 + callback && callback(); + + } + + }, 30); +} + +/* + * 定义一个函数,专门用来为一个元素添加class属性值 + * 参数 + * obj 要添加class属性的元素 + * cn 要添加的class的值 + * + */ +function addClass(obj, cn) { + + //判断obj中是否含有cn这个class + if(!hasClass(obj, cn)) { + obj.className += " " + cn; + } + +} + +/* + * 判断一个对象中是否含有指定的class属性 + * 参数: + * obj:要检查的对象 + * cn:要检查class值 + * 如果对象中具有该class则返回true,否则返回false + */ +function hasClass(obj, cn) { + + //检查obj中是否与b2这个class + //var reg = /\bb2\b/; + var reg = new RegExp("\\b" + cn + "\\b"); + + return reg.test(obj.className); + +} + +/* + * 删除一个元素中的class + */ +function removeClass(obj, cn) { + + //创建一个正则表达式 + var reg = new RegExp("\\b" + cn + "\\b"); + + //将class属性中符合正则表达式的内容,替换为空串 + obj.className = obj.className.replace(reg, ""); + +} + +/* + * 切换一个元素的class属性值 + * 如果有,则删除 + * 如果没有,则添加 + */ +function toggleClass(obj, cn) { + //判断obj中是否有cn + if(hasClass(obj, cn)) { + //如果有,则删除 + removeClass(obj, cn); + } else { + //如果没有,则添加 + addClass(obj, cn); + } +} \ No newline at end of file diff --git "a/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\347\254\224\350\256\260/day18/note/json2.js" "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\347\254\224\350\256\260/day18/note/json2.js" new file mode 100644 index 00000000..d4720c0f --- /dev/null +++ "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\347\254\224\350\256\260/day18/note/json2.js" @@ -0,0 +1,506 @@ +// json2.js +// 2016-05-01 +// Public Domain. +// NO WARRANTY EXPRESSED OR IMPLIED. USE AT YOUR OWN RISK. +// See http://www.JSON.org/js.html +// This code should be minified before deployment. +// See http://javascript.crockford.com/jsmin.html + +// USE YOUR OWN COPY. IT IS EXTREMELY UNWISE TO LOAD CODE FROM SERVERS YOU DO +// NOT CONTROL. + +// This file creates a global JSON object containing two methods: stringify +// and parse. This file is provides the ES5 JSON capability to ES3 systems. +// If a project might run on IE8 or earlier, then this file should be included. +// This file does nothing on ES5 systems. + +// JSON.stringify(value, replacer, space) +// value any JavaScript value, usually an object or array. +// replacer an optional parameter that determines how object +// values are stringified for objects. It can be a +// function or an array of strings. +// space an optional parameter that specifies the indentation +// of nested structures. If it is omitted, the text will +// be packed without extra whitespace. If it is a number, +// it will specify the number of spaces to indent at each +// level. If it is a string (such as "\t" or " "), +// it contains the characters used to indent at each level. +// This method produces a JSON text from a JavaScript value. +// When an object value is found, if the object contains a toJSON +// method, its toJSON method will be called and the result will be +// stringified. A toJSON method does not serialize: it returns the +// value represented by the name/value pair that should be serialized, +// or undefined if nothing should be serialized. The toJSON method +// will be passed the key associated with the value, and this will be +// bound to the value. + +// For example, this would serialize Dates as ISO strings. + +// Date.prototype.toJSON = function (key) { +// function f(n) { +// // Format integers to have at least two digits. +// return (n < 10) +// ? "0" + n +// : n; +// } +// return this.getUTCFullYear() + "-" + +// f(this.getUTCMonth() + 1) + "-" + +// f(this.getUTCDate()) + "T" + +// f(this.getUTCHours()) + ":" + +// f(this.getUTCMinutes()) + ":" + +// f(this.getUTCSeconds()) + "Z"; +// }; + +// You can provide an optional replacer method. It will be passed the +// key and value of each member, with this bound to the containing +// object. The value that is returned from your method will be +// serialized. If your method returns undefined, then the member will +// be excluded from the serialization. + +// If the replacer parameter is an array of strings, then it will be +// used to select the members to be serialized. It filters the results +// such that only members with keys listed in the replacer array are +// stringified. + +// Values that do not have JSON representations, such as undefined or +// functions, will not be serialized. Such values in objects will be +// dropped; in arrays they will be replaced with null. You can use +// a replacer function to replace those with JSON values. + +// JSON.stringify(undefined) returns undefined. + +// The optional space parameter produces a stringification of the +// value that is filled with line breaks and indentation to make it +// easier to read. + +// If the space parameter is a non-empty string, then that string will +// be used for indentation. If the space parameter is a number, then +// the indentation will be that many spaces. + +// Example: + +// text = JSON.stringify(["e", {pluribus: "unum"}]); +// // text is '["e",{"pluribus":"unum"}]' + +// text = JSON.stringify(["e", {pluribus: "unum"}], null, "\t"); +// // text is '[\n\t"e",\n\t{\n\t\t"pluribus": "unum"\n\t}\n]' + +// text = JSON.stringify([new Date()], function (key, value) { +// return this[key] instanceof Date +// ? "Date(" + this[key] + ")" +// : value; +// }); +// // text is '["Date(---current time---)"]' + +// JSON.parse(text, reviver) +// This method parses a JSON text to produce an object or array. +// It can throw a SyntaxError exception. + +// The optional reviver parameter is a function that can filter and +// transform the results. It receives each of the keys and values, +// and its return value is used instead of the original value. +// If it returns what it received, then the structure is not modified. +// If it returns undefined then the member is deleted. + +// Example: + +// // Parse the text. Values that look like ISO date strings will +// // be converted to Date objects. + +// myData = JSON.parse(text, function (key, value) { +// var a; +// if (typeof value === "string") { +// a = +// /^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2}(?:\.\d*)?)Z$/.exec(value); +// if (a) { +// return new Date(Date.UTC(+a[1], +a[2] - 1, +a[3], +a[4], +// +a[5], +a[6])); +// } +// } +// return value; +// }); + +// myData = JSON.parse('["Date(09/09/2001)"]', function (key, value) { +// var d; +// if (typeof value === "string" && +// value.slice(0, 5) === "Date(" && +// value.slice(-1) === ")") { +// d = new Date(value.slice(5, -1)); +// if (d) { +// return d; +// } +// } +// return value; +// }); + +// This is a reference implementation. You are free to copy, modify, or +// redistribute. + +/*jslint + eval, for, this +*/ + +/*property + JSON, apply, call, charCodeAt, getUTCDate, getUTCFullYear, getUTCHours, + getUTCMinutes, getUTCMonth, getUTCSeconds, hasOwnProperty, join, + lastIndex, length, parse, prototype, push, replace, slice, stringify, + test, toJSON, toString, valueOf +*/ + + +// Create a JSON object only if one does not already exist. We create the +// methods in a closure to avoid creating global variables. + +if (typeof JSON !== "object") { + JSON = {}; +} + +(function () { + "use strict"; + + var rx_one = /^[\],:{}\s]*$/; + var rx_two = /\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g; + var rx_three = /"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g; + var rx_four = /(?:^|:|,)(?:\s*\[)+/g; + var rx_escapable = /[\\\"\u0000-\u001f\u007f-\u009f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g; + var rx_dangerous = /[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g; + + function f(n) { + // Format integers to have at least two digits. + return n < 10 + ? "0" + n + : n; + } + + function this_value() { + return this.valueOf(); + } + + if (typeof Date.prototype.toJSON !== "function") { + + Date.prototype.toJSON = function () { + + return isFinite(this.valueOf()) + ? this.getUTCFullYear() + "-" + + f(this.getUTCMonth() + 1) + "-" + + f(this.getUTCDate()) + "T" + + f(this.getUTCHours()) + ":" + + f(this.getUTCMinutes()) + ":" + + f(this.getUTCSeconds()) + "Z" + : null; + }; + + Boolean.prototype.toJSON = this_value; + Number.prototype.toJSON = this_value; + String.prototype.toJSON = this_value; + } + + var gap; + var indent; + var meta; + var rep; + + + function quote(string) { + +// If the string contains no control characters, no quote characters, and no +// backslash characters, then we can safely slap some quotes around it. +// Otherwise we must also replace the offending characters with safe escape +// sequences. + + rx_escapable.lastIndex = 0; + return rx_escapable.test(string) + ? "\"" + string.replace(rx_escapable, function (a) { + var c = meta[a]; + return typeof c === "string" + ? c + : "\\u" + ("0000" + a.charCodeAt(0).toString(16)).slice(-4); + }) + "\"" + : "\"" + string + "\""; + } + + + function str(key, holder) { + +// Produce a string from holder[key]. + + var i; // The loop counter. + var k; // The member key. + var v; // The member value. + var length; + var mind = gap; + var partial; + var value = holder[key]; + +// If the value has a toJSON method, call it to obtain a replacement value. + + if (value && typeof value === "object" && + typeof value.toJSON === "function") { + value = value.toJSON(key); + } + +// If we were called with a replacer function, then call the replacer to +// obtain a replacement value. + + if (typeof rep === "function") { + value = rep.call(holder, key, value); + } + +// What happens next depends on the value's type. + + switch (typeof value) { + case "string": + return quote(value); + + case "number": + +// JSON numbers must be finite. Encode non-finite numbers as null. + + return isFinite(value) + ? String(value) + : "null"; + + case "boolean": + case "null": + +// If the value is a boolean or null, convert it to a string. Note: +// typeof null does not produce "null". The case is included here in +// the remote chance that this gets fixed someday. + + return String(value); + +// If the type is "object", we might be dealing with an object or an array or +// null. + + case "object": + +// Due to a specification blunder in ECMAScript, typeof null is "object", +// so watch out for that case. + + if (!value) { + return "null"; + } + +// Make an array to hold the partial results of stringifying this object value. + + gap += indent; + partial = []; + +// Is the value an array? + + if (Object.prototype.toString.apply(value) === "[object Array]") { + +// The value is an array. Stringify every element. Use null as a placeholder +// for non-JSON values. + + length = value.length; + for (i = 0; i < length; i += 1) { + partial[i] = str(i, value) || "null"; + } + +// Join all of the elements together, separated with commas, and wrap them in +// brackets. + + v = partial.length === 0 + ? "[]" + : gap + ? "[\n" + gap + partial.join(",\n" + gap) + "\n" + mind + "]" + : "[" + partial.join(",") + "]"; + gap = mind; + return v; + } + +// If the replacer is an array, use it to select the members to be stringified. + + if (rep && typeof rep === "object") { + length = rep.length; + for (i = 0; i < length; i += 1) { + if (typeof rep[i] === "string") { + k = rep[i]; + v = str(k, value); + if (v) { + partial.push(quote(k) + ( + gap + ? ": " + : ":" + ) + v); + } + } + } + } else { + +// Otherwise, iterate through all of the keys in the object. + + for (k in value) { + if (Object.prototype.hasOwnProperty.call(value, k)) { + v = str(k, value); + if (v) { + partial.push(quote(k) + ( + gap + ? ": " + : ":" + ) + v); + } + } + } + } + +// Join all of the member texts together, separated with commas, +// and wrap them in braces. + + v = partial.length === 0 + ? "{}" + : gap + ? "{\n" + gap + partial.join(",\n" + gap) + "\n" + mind + "}" + : "{" + partial.join(",") + "}"; + gap = mind; + return v; + } + } + +// If the JSON object does not yet have a stringify method, give it one. + + if (typeof JSON.stringify !== "function") { + meta = { // table of character substitutions + "\b": "\\b", + "\t": "\\t", + "\n": "\\n", + "\f": "\\f", + "\r": "\\r", + "\"": "\\\"", + "\\": "\\\\" + }; + JSON.stringify = function (value, replacer, space) { + +// The stringify method takes a value and an optional replacer, and an optional +// space parameter, and returns a JSON text. The replacer can be a function +// that can replace values, or an array of strings that will select the keys. +// A default replacer method can be provided. Use of the space parameter can +// produce text that is more easily readable. + + var i; + gap = ""; + indent = ""; + +// If the space parameter is a number, make an indent string containing that +// many spaces. + + if (typeof space === "number") { + for (i = 0; i < space; i += 1) { + indent += " "; + } + +// If the space parameter is a string, it will be used as the indent string. + + } else if (typeof space === "string") { + indent = space; + } + +// If there is a replacer, it must be a function or an array. +// Otherwise, throw an error. + + rep = replacer; + if (replacer && typeof replacer !== "function" && + (typeof replacer !== "object" || + typeof replacer.length !== "number")) { + throw new Error("JSON.stringify"); + } + +// Make a fake root object containing our value under the key of "". +// Return the result of stringifying the value. + + return str("", {"": value}); + }; + } + + +// If the JSON object does not yet have a parse method, give it one. + + if (typeof JSON.parse !== "function") { + JSON.parse = function (text, reviver) { + +// The parse method takes a text and an optional reviver function, and returns +// a JavaScript value if the text is a valid JSON text. + + var j; + + function walk(holder, key) { + +// The walk method is used to recursively walk the resulting structure so +// that modifications can be made. + + var k; + var v; + var value = holder[key]; + if (value && typeof value === "object") { + for (k in value) { + if (Object.prototype.hasOwnProperty.call(value, k)) { + v = walk(value, k); + if (v !== undefined) { + value[k] = v; + } else { + delete value[k]; + } + } + } + } + return reviver.call(holder, key, value); + } + + +// Parsing happens in four stages. In the first stage, we replace certain +// Unicode characters with escape sequences. JavaScript handles many characters +// incorrectly, either silently deleting them, or treating them as line endings. + + text = String(text); + rx_dangerous.lastIndex = 0; + if (rx_dangerous.test(text)) { + text = text.replace(rx_dangerous, function (a) { + return "\\u" + + ("0000" + a.charCodeAt(0).toString(16)).slice(-4); + }); + } + +// In the second stage, we run the text against regular expressions that look +// for non-JSON patterns. We are especially concerned with "()" and "new" +// because they can cause invocation, and "=" because it can cause mutation. +// But just to be safe, we want to reject all unexpected forms. + +// We split the second stage into 4 regexp operations in order to work around +// crippling inefficiencies in IE's and Safari's regexp engines. First we +// replace the JSON backslash pairs with "@" (a non-JSON character). Second, we +// replace all simple value tokens with "]" characters. Third, we delete all +// open brackets that follow a colon or comma or that begin the text. Finally, +// we look to see that the remaining characters are only whitespace or "]" or +// "," or ":" or "{" or "}". If that is so, then the text is safe for eval. + + if ( + rx_one.test( + text + .replace(rx_two, "@") + .replace(rx_three, "]") + .replace(rx_four, "") + ) + ) { + +// In the third stage we use the eval function to compile the text into a +// JavaScript structure. The "{" operator is subject to a syntactic ambiguity +// in JavaScript: it can begin a block or an object literal. We wrap the text +// in parens to eliminate the ambiguity. + + j = eval("(" + text + ")"); + +// In the optional fourth stage, we recursively walk the new structure, passing +// each name/value pair to a reviver function for possible transformation. + + return (typeof reviver === "function") + ? walk({"": j}, "") + : j; + } + +// If the text is not JSON parseable, then a SyntaxError is thrown. + + throw new SyntaxError("JSON.parse"); + }; + } +}()); diff --git "a/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\350\257\276\344\273\266/JavaScript/01.JavaScript\347\256\200\344\273\213/\347\256\200\344\273\213.pdf" "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\350\257\276\344\273\266/JavaScript/01.JavaScript\347\256\200\344\273\213/\347\256\200\344\273\213.pdf" new file mode 100644 index 00000000..bb54bd0b Binary files /dev/null and "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\350\257\276\344\273\266/JavaScript/01.JavaScript\347\256\200\344\273\213/\347\256\200\344\273\213.pdf" differ diff --git "a/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\350\257\276\344\273\266/JavaScript/02.JavaScript\345\237\272\346\234\254\350\257\255\346\263\225/\345\237\272\346\234\254\350\257\255\346\263\225.pdf" "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\350\257\276\344\273\266/JavaScript/02.JavaScript\345\237\272\346\234\254\350\257\255\346\263\225/\345\237\272\346\234\254\350\257\255\346\263\225.pdf" new file mode 100644 index 00000000..9cb30227 Binary files /dev/null and "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\350\257\276\344\273\266/JavaScript/02.JavaScript\345\237\272\346\234\254\350\257\255\346\263\225/\345\237\272\346\234\254\350\257\255\346\263\225.pdf" differ diff --git "a/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\350\257\276\344\273\266/JavaScript/03.JavaScript\345\257\271\350\261\241/\345\257\271\350\261\241.pdf" "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\350\257\276\344\273\266/JavaScript/03.JavaScript\345\257\271\350\261\241/\345\257\271\350\261\241.pdf" new file mode 100644 index 00000000..8460c5e9 Binary files /dev/null and "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\350\257\276\344\273\266/JavaScript/03.JavaScript\345\257\271\350\261\241/\345\257\271\350\261\241.pdf" differ diff --git "a/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\350\257\276\344\273\266/JavaScript/04.DOM/DOM.pdf" "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\350\257\276\344\273\266/JavaScript/04.DOM/DOM.pdf" new file mode 100644 index 00000000..b7a10516 Binary files /dev/null and "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\350\257\276\344\273\266/JavaScript/04.DOM/DOM.pdf" differ diff --git "a/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\350\257\276\344\273\266/JavaScript/05.\344\272\213\344\273\266/\344\272\213\344\273\266.pdf" "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\350\257\276\344\273\266/JavaScript/05.\344\272\213\344\273\266/\344\272\213\344\273\266.pdf" new file mode 100644 index 00000000..0791e44c Binary files /dev/null and "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\350\257\276\344\273\266/JavaScript/05.\344\272\213\344\273\266/\344\272\213\344\273\266.pdf" differ diff --git "a/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\350\257\276\344\273\266/JavaScript/06.BOM/BOM.pdf" "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\350\257\276\344\273\266/JavaScript/06.BOM/BOM.pdf" new file mode 100644 index 00000000..375373f7 Binary files /dev/null and "b/\350\265\204\346\226\231/\345\260\232\347\241\205\350\260\267javascript140\351\233\206/\350\257\276\344\273\266/JavaScript/06.BOM/BOM.pdf" differ