Showing
9 changed files
with
1908 additions
and
203 deletions
| @@ -11,6 +11,7 @@ if (flutterRoot == null) { | @@ -11,6 +11,7 @@ if (flutterRoot == null) { | ||
| 11 | throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.") | 11 | throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.") |
| 12 | } | 12 | } |
| 13 | 13 | ||
| 14 | + | ||
| 14 | def flutterVersionCode = "320" | 15 | def flutterVersionCode = "320" |
| 15 | if (flutterVersionCode == null) { | 16 | if (flutterVersionCode == null) { |
| 16 | flutterVersionCode = '320' | 17 | flutterVersionCode = '320' |
| @@ -20,7 +21,6 @@ def flutterVersionName = "3.2.0" | @@ -20,7 +21,6 @@ def flutterVersionName = "3.2.0" | ||
| 20 | if (flutterVersionName == null) { | 21 | if (flutterVersionName == null) { |
| 21 | flutterVersionName = '3.2.0' | 22 | flutterVersionName = '3.2.0' |
| 22 | } | 23 | } |
| 23 | - | ||
| 24 | apply plugin: 'com.android.application' | 24 | apply plugin: 'com.android.application' |
| 25 | apply plugin: 'kotlin-android' | 25 | apply plugin: 'kotlin-android' |
| 26 | apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" | 26 | apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" |
| @@ -38,7 +38,7 @@ class _FestivalEditPageState extends State<FestivalEditPage> { | @@ -38,7 +38,7 @@ class _FestivalEditPageState extends State<FestivalEditPage> { | ||
| 38 | itemBuilder: (BuildContext context, int index) { | 38 | itemBuilder: (BuildContext context, int index) { |
| 39 | return InkWell( | 39 | return InkWell( |
| 40 | onTap: () { | 40 | onTap: () { |
| 41 | - DialogUtil.festivalAlertDialog(context, 'ggg', 700, | 41 | + DialogUtil.festivalAlertDialog(context, 'ggg', 520, |
| 42 | rCallback: (name) { | 42 | rCallback: (name) { |
| 43 | // _addCookbookClass(name, showLoading: true); | 43 | // _addCookbookClass(name, showLoading: true); |
| 44 | }); | 44 | }); |
| 1 | import 'package:flutter/material.dart'; | 1 | import 'package:flutter/material.dart'; |
| 2 | 2 | ||
| 3 | class MyColours { | 3 | class MyColours { |
| 4 | - | 4 | + static const Color color_d7d7d7 = Color(0xffD7D7D7); |
| 5 | static const Color color_F4FAFF = Color(0xffF4FAFF); | 5 | static const Color color_F4FAFF = Color(0xffF4FAFF); |
| 6 | static const Color app_main = Color(0xFF24A4A8); | 6 | static const Color app_main = Color(0xFF24A4A8); |
| 7 | static const Color color_ffffff = Color(0xffffffff); | 7 | static const Color color_ffffff = Color(0xffffffff); |
| 8 | static const Color color_fefefe = Color(0xfffefefe); | 8 | static const Color color_fefefe = Color(0xfffefefe); |
| 9 | static const Color color_f5f5f5 = Color(0xfff5f5f5); | 9 | static const Color color_f5f5f5 = Color(0xfff5f5f5); |
| 10 | static const Color color_199095 = Color(0xff199095); | 10 | static const Color color_199095 = Color(0xff199095); |
| 11 | + static const Color color_afbcc4 = Color(0xffAFBCC4); | ||
| 11 | static const Color color_999999 = Color(0xff999999); | 12 | static const Color color_999999 = Color(0xff999999); |
| 12 | static const Color color_353535 = Color(0xff353535); | 13 | static const Color color_353535 = Color(0xff353535); |
| 13 | static const Color color_d8d8d8 = Color(0xffD8D8D8); | 14 | static const Color color_d8d8d8 = Color(0xffD8D8D8); |
| @@ -18,6 +18,9 @@ import 'package:one_key/res/colors.dart'; | @@ -18,6 +18,9 @@ import 'package:one_key/res/colors.dart'; | ||
| 18 | import 'package:one_key/utils/NumLengthInputFormatter.dart'; | 18 | import 'package:one_key/utils/NumLengthInputFormatter.dart'; |
| 19 | import 'package:one_key/utils/misc.dart'; | 19 | import 'package:one_key/utils/misc.dart'; |
| 20 | import 'package:one_key/route/navigator_util.dart'; | 20 | import 'package:one_key/route/navigator_util.dart'; |
| 21 | +import 'package:one_key/utils/pick_date_nonli_gongli/pick_calendar_day.dart'; | ||
| 22 | +import 'package:one_key/utils/pick_date_nonli_gongli/pick_calendar_month.dart'; | ||
| 23 | +import 'package:one_key/utils/pick_date_nonli_gongli/pick_calendar_year.dart'; | ||
| 21 | import 'package:one_key/utils/utils.dart'; | 24 | import 'package:one_key/utils/utils.dart'; |
| 22 | import 'package:one_key/widgets/MyDivider.dart'; | 25 | import 'package:one_key/widgets/MyDivider.dart'; |
| 23 | import 'package:one_key/widgets/common_button.dart'; | 26 | import 'package:one_key/widgets/common_button.dart'; |
| @@ -2342,215 +2345,404 @@ class DialogUtil { | @@ -2342,215 +2345,404 @@ class DialogUtil { | ||
| 2342 | static Future festivalAlertDialog( | 2345 | static Future festivalAlertDialog( |
| 2343 | BuildContext context, String name, double height, | 2346 | BuildContext context, String name, double height, |
| 2344 | {CustomCallBack rCallback, double fontSize = 28}) async { | 2347 | {CustomCallBack rCallback, double fontSize = 28}) async { |
| 2348 | + String yearStr = '选填'; | ||
| 2349 | + String monthStr = ''; | ||
| 2350 | + String dayStr = ''; | ||
| 2345 | final action = await showDialog( | 2351 | final action = await showDialog( |
| 2346 | context: context, | 2352 | context: context, |
| 2347 | barrierDismissible: true, | 2353 | barrierDismissible: true, |
| 2348 | builder: (BuildContext context) { | 2354 | builder: (BuildContext context) { |
| 2349 | TextEditingController controller = TextEditingController(); | 2355 | TextEditingController controller = TextEditingController(); |
| 2350 | controller.text = name; | 2356 | controller.text = name; |
| 2351 | - return Scaffold( | ||
| 2352 | - backgroundColor: Colors.transparent, | ||
| 2353 | - body: Center( | ||
| 2354 | - child: Container( | ||
| 2355 | - padding: | ||
| 2356 | - EdgeInsets.symmetric(horizontal: ScreenUtil().setWidth(72)), | ||
| 2357 | - height: ScreenUtil().setWidth(height), | ||
| 2358 | - decoration: BoxDecoration( | ||
| 2359 | - borderRadius: | ||
| 2360 | - BorderRadius.circular(ScreenUtil().setWidth(30))), | ||
| 2361 | - child: Card( | ||
| 2362 | - shape: RoundedRectangleBorder( | ||
| 2363 | - borderRadius: BorderRadius.all( | ||
| 2364 | - Radius.circular(ScreenUtil().setWidth(30)))), //设置圆角 | ||
| 2365 | - child: Padding( | ||
| 2366 | - padding: EdgeInsets.symmetric( | ||
| 2367 | - horizontal: ScreenUtil().setWidth(40)), | ||
| 2368 | - child: Column( | ||
| 2369 | - children: [ | ||
| 2370 | - // VEmptyView(60), | ||
| 2371 | - Stack(children: [ | 2357 | + return StatefulBuilder(builder: (context, stateSetter) { |
| 2358 | + return Scaffold( | ||
| 2359 | + backgroundColor: Colors.transparent, | ||
| 2360 | + body: Center( | ||
| 2361 | + child: Container( | ||
| 2362 | + padding: EdgeInsets.symmetric( | ||
| 2363 | + horizontal: ScreenUtil().setWidth(72)), | ||
| 2364 | + height: ScreenUtil().setWidth(height), | ||
| 2365 | + decoration: BoxDecoration( | ||
| 2366 | + borderRadius: | ||
| 2367 | + BorderRadius.circular(ScreenUtil().setWidth(30))), | ||
| 2368 | + child: SingleChildScrollView( | ||
| 2369 | + child: Card( | ||
| 2370 | + shape: RoundedRectangleBorder( | ||
| 2371 | + borderRadius: BorderRadius.all( | ||
| 2372 | + Radius.circular(ScreenUtil().setWidth(30)))), //设置圆角 | ||
| 2373 | + child: Padding( | ||
| 2374 | + padding: EdgeInsets.symmetric( | ||
| 2375 | + horizontal: ScreenUtil().setWidth(40)), | ||
| 2376 | + child: Column( | ||
| 2377 | + children: [ | ||
| 2378 | + // VEmptyView(60), | ||
| 2379 | + Stack(children: [ | ||
| 2380 | + Container( | ||
| 2381 | + padding: EdgeInsets.only( | ||
| 2382 | + top: ScreenUtil().setWidth(60), | ||
| 2383 | + bottom: ScreenUtil().setWidth(40)), | ||
| 2384 | + // color: Colors.red, | ||
| 2385 | + alignment: Alignment.center, | ||
| 2386 | + child: Text('纪念日名称', | ||
| 2387 | + style: TextStyle( | ||
| 2388 | + fontSize: ScreenUtil().setSp(fontSize), | ||
| 2389 | + color: MyColours.color_353535)), | ||
| 2390 | + ), | ||
| 2391 | + Positioned( | ||
| 2392 | + right: 0, | ||
| 2393 | + top: ScreenUtil().setWidth(36), | ||
| 2394 | + child: Text('删除', | ||
| 2395 | + style: TextStyle( | ||
| 2396 | + decoration: TextDecoration.underline, | ||
| 2397 | + fontSize: ScreenUtil().setSp(26), | ||
| 2398 | + color: MyColours.color_199095))) | ||
| 2399 | + ]), | ||
| 2400 | + | ||
| 2401 | + Container( | ||
| 2402 | + height: ScreenUtil().setWidth(40), | ||
| 2403 | + // color: Colors.red, | ||
| 2404 | + padding: EdgeInsets.symmetric( | ||
| 2405 | + horizontal: ScreenUtil().setWidth(68)), | ||
| 2406 | + alignment: Alignment.center, | ||
| 2407 | + child: Material( | ||
| 2408 | + color: Colors.transparent, | ||
| 2409 | + child: TextField( | ||
| 2410 | + controller: controller, | ||
| 2411 | + maxLines: 1, | ||
| 2412 | + | ||
| 2413 | + // //光标颜色 | ||
| 2414 | + // cursorColor: | ||
| 2415 | + // widget.isSelect ? Colors.white : MyColours.color_199095, | ||
| 2416 | + // //输入文本的样式 | ||
| 2417 | + // inputFormatters: lenghtLimit | ||
| 2418 | + // ? [ | ||
| 2419 | + // LengthLimitingTextInputFormatter(10), | ||
| 2420 | + // ] | ||
| 2421 | + // : [], | ||
| 2422 | + textAlignVertical: | ||
| 2423 | + TextAlignVertical.bottom, | ||
| 2424 | + textAlign: TextAlign.center, | ||
| 2425 | + style: TextStyle( | ||
| 2426 | + fontSize: ScreenUtil().setSp(26), | ||
| 2427 | + ), | ||
| 2428 | + decoration: InputDecoration( | ||
| 2429 | + border: OutlineInputBorder( | ||
| 2430 | + borderSide: BorderSide.none), | ||
| 2431 | + hintText: '例:本人生日', | ||
| 2432 | + hintStyle: TextStyle( | ||
| 2433 | + color: MyColours.color_999999, | ||
| 2434 | + fontSize: ScreenUtil().setSp(26), | ||
| 2435 | + ), | ||
| 2436 | + enabledBorder: | ||
| 2437 | + new UnderlineInputBorder( | ||
| 2438 | + borderSide: BorderSide.none, | ||
| 2439 | + ), | ||
| 2440 | + focusedBorder: | ||
| 2441 | + new UnderlineInputBorder( | ||
| 2442 | + borderSide: BorderSide.none, | ||
| 2443 | + ), | ||
| 2444 | + ), | ||
| 2445 | + onChanged: (value) { | ||
| 2446 | + name = value; | ||
| 2447 | + }, | ||
| 2448 | + onEditingComplete: () { | ||
| 2449 | + FocusScope.of(context).requestFocus( | ||
| 2450 | + FocusNode()); //点击空白处隐藏键盘 | ||
| 2451 | + }, | ||
| 2452 | + keyboardType: TextInputType.text))), | ||
| 2453 | + // VEmptyView(28), | ||
| 2454 | + MyDivider(ScreenUtil().setWidth(280 * 2), | ||
| 2455 | + ScreenUtil().setWidth(2), | ||
| 2456 | + color: MyColours.color_efefef), | ||
| 2372 | Container( | 2457 | Container( |
| 2373 | padding: EdgeInsets.only( | 2458 | padding: EdgeInsets.only( |
| 2374 | - top: ScreenUtil().setWidth(60), | 2459 | + top: ScreenUtil().setWidth(40), |
| 2375 | bottom: ScreenUtil().setWidth(50)), | 2460 | bottom: ScreenUtil().setWidth(50)), |
| 2376 | // color: Colors.red, | 2461 | // color: Colors.red, |
| 2377 | alignment: Alignment.center, | 2462 | alignment: Alignment.center, |
| 2378 | - child: Text('纪念日名称', | 2463 | + child: Text('纪念日日期', |
| 2379 | style: TextStyle( | 2464 | style: TextStyle( |
| 2380 | fontSize: ScreenUtil().setSp(fontSize), | 2465 | fontSize: ScreenUtil().setSp(fontSize), |
| 2381 | color: MyColours.color_353535)), | 2466 | color: MyColours.color_353535)), |
| 2382 | ), | 2467 | ), |
| 2383 | - Positioned( | ||
| 2384 | - right: 0, | ||
| 2385 | - top: ScreenUtil().setWidth(36), | ||
| 2386 | - child: Text('删除', | ||
| 2387 | - style: TextStyle( | ||
| 2388 | - decoration: TextDecoration.underline, | ||
| 2389 | - fontSize: ScreenUtil().setSp(26), | ||
| 2390 | - color: MyColours.color_199095))) | ||
| 2391 | - ]), | ||
| 2392 | - | ||
| 2393 | - Container( | ||
| 2394 | - height: ScreenUtil().setWidth(40), | ||
| 2395 | - // color: Colors.red, | ||
| 2396 | - padding: EdgeInsets.symmetric( | ||
| 2397 | - horizontal: ScreenUtil().setWidth(68)), | ||
| 2398 | - alignment: Alignment.center, | ||
| 2399 | - child: Material( | ||
| 2400 | - color: Colors.transparent, | ||
| 2401 | - child: TextField( | ||
| 2402 | - controller: controller, | ||
| 2403 | - maxLines: 1, | ||
| 2404 | - | ||
| 2405 | - // //光标颜色 | ||
| 2406 | - // cursorColor: | ||
| 2407 | - // widget.isSelect ? Colors.white : MyColours.color_199095, | ||
| 2408 | - // //输入文本的样式 | ||
| 2409 | - // inputFormatters: lenghtLimit | ||
| 2410 | - // ? [ | ||
| 2411 | - // LengthLimitingTextInputFormatter(10), | ||
| 2412 | - // ] | ||
| 2413 | - // : [], | ||
| 2414 | - textAlignVertical: | ||
| 2415 | - TextAlignVertical.bottom, | ||
| 2416 | - textAlign: TextAlign.center, | 2468 | + Row( |
| 2469 | + children: [ | ||
| 2470 | + InkWell( | ||
| 2471 | + child: Container( | ||
| 2472 | + padding: EdgeInsets.symmetric( | ||
| 2473 | + horizontal: ScreenUtil().setWidth(5), | ||
| 2474 | + vertical: ScreenUtil().setWidth(6)), | ||
| 2475 | + decoration: BoxDecoration( | ||
| 2476 | + color: true | ||
| 2477 | + ? MyColours.color_199095 | ||
| 2478 | + : MyColours.color_ffffff, | ||
| 2479 | + borderRadius: BorderRadius.only( | ||
| 2480 | + topLeft: Radius.circular( | ||
| 2481 | + ScreenUtil().setWidth(10)), | ||
| 2482 | + bottomLeft: Radius.circular( | ||
| 2483 | + ScreenUtil().setWidth(10))), | ||
| 2484 | + border: Border.all( | ||
| 2485 | + color: MyColours.color_199095, | ||
| 2486 | + width: ScreenUtil().setWidth(2))), | ||
| 2487 | + child: Text('公历', | ||
| 2417 | style: TextStyle( | 2488 | style: TextStyle( |
| 2418 | - fontSize: ScreenUtil().setSp(26), | 2489 | + fontSize: ScreenUtil().setSp(28), |
| 2490 | + color: true | ||
| 2491 | + ? MyColours.color_ffffff | ||
| 2492 | + : MyColours.color_333333)), | ||
| 2493 | + )), | ||
| 2494 | + InkWell( | ||
| 2495 | + child: Container( | ||
| 2496 | + padding: EdgeInsets.symmetric( | ||
| 2497 | + horizontal: ScreenUtil().setWidth(5), | ||
| 2498 | + vertical: ScreenUtil().setWidth(6)), | ||
| 2499 | + decoration: BoxDecoration( | ||
| 2500 | + color: false | ||
| 2501 | + ? MyColours.color_199095 | ||
| 2502 | + : MyColours.color_ffffff, | ||
| 2503 | + borderRadius: BorderRadius.only( | ||
| 2504 | + topRight: Radius.circular( | ||
| 2505 | + ScreenUtil().setWidth(10)), | ||
| 2506 | + bottomRight: Radius.circular( | ||
| 2507 | + ScreenUtil().setWidth(10))), | ||
| 2508 | + border: Border.all( | ||
| 2509 | + color: MyColours.color_199095, | ||
| 2510 | + width: ScreenUtil().setWidth(2))), | ||
| 2511 | + child: Text('农历', | ||
| 2512 | + style: TextStyle( | ||
| 2513 | + fontSize: ScreenUtil().setSp(28), | ||
| 2514 | + color: false | ||
| 2515 | + ? MyColours.color_ffffff | ||
| 2516 | + : MyColours.color_333333))), | ||
| 2517 | + ), | ||
| 2518 | + HEmptyView(30), | ||
| 2519 | + InkWell( | ||
| 2520 | + onTap: () { | ||
| 2521 | + incrementCounterYear( | ||
| 2522 | + context, | ||
| 2523 | + true, | ||
| 2524 | + yearStr == '选填' | ||
| 2525 | + ? DateTime.now().year.toString() | ||
| 2526 | + : yearStr, (year) { | ||
| 2527 | + print(year); | ||
| 2528 | + stateSetter(() { | ||
| 2529 | + yearStr = year; | ||
| 2530 | + }); | ||
| 2531 | + }); | ||
| 2532 | + }, | ||
| 2533 | + child: Container( | ||
| 2534 | + padding: EdgeInsets.only( | ||
| 2535 | + bottom: ScreenUtil().setWidth(4)), | ||
| 2536 | + decoration: BoxDecoration( | ||
| 2537 | + border: Border( | ||
| 2538 | + bottom: BorderSide( | ||
| 2539 | + color: MyColours.color_E0E0E0, | ||
| 2540 | + width: ScreenUtil().setWidth(2)), | ||
| 2541 | + )), | ||
| 2542 | + child: Row( | ||
| 2543 | + crossAxisAlignment: | ||
| 2544 | + CrossAxisAlignment.end, | ||
| 2545 | + children: [ | ||
| 2546 | + Padding( | ||
| 2547 | + padding: EdgeInsets.zero, | ||
| 2548 | + child: Text(yearStr, | ||
| 2549 | + style: TextStyle( | ||
| 2550 | + fontSize: | ||
| 2551 | + ScreenUtil().setSp(26), | ||
| 2552 | + color: MyColours | ||
| 2553 | + .color_666666)), | ||
| 2554 | + ), | ||
| 2555 | + HEmptyView(6), | ||
| 2556 | + Image.asset( | ||
| 2557 | + Utils.getImgPath(false | ||
| 2558 | + ? 'c_arrow_up' | ||
| 2559 | + : 'c_arrow_down'), | ||
| 2560 | + width: ScreenUtil().setWidth(28), | ||
| 2561 | + // height: ScreenUtil().setWidth(10), | ||
| 2562 | + ), | ||
| 2563 | + ], | ||
| 2419 | ), | 2564 | ), |
| 2420 | - decoration: InputDecoration( | ||
| 2421 | - border: OutlineInputBorder( | ||
| 2422 | - borderSide: BorderSide.none), | ||
| 2423 | - hintText: '例:本人生日', | ||
| 2424 | - hintStyle: TextStyle( | ||
| 2425 | - color: MyColours.color_999999, | ||
| 2426 | - fontSize: ScreenUtil().setSp(26), | ||
| 2427 | - ), | ||
| 2428 | - enabledBorder: new UnderlineInputBorder( | ||
| 2429 | - borderSide: BorderSide.none, | ||
| 2430 | - ), | ||
| 2431 | - focusedBorder: new UnderlineInputBorder( | ||
| 2432 | - borderSide: BorderSide.none, | ||
| 2433 | - ), | 2565 | + )), |
| 2566 | + Text('年', | ||
| 2567 | + style: TextStyle( | ||
| 2568 | + fontSize: ScreenUtil().setSp(28), | ||
| 2569 | + color: MyColours.color_333333)), | ||
| 2570 | + HEmptyView(10), | ||
| 2571 | + InkWell( | ||
| 2572 | + onTap: () { | ||
| 2573 | + incrementCounterMonth( | ||
| 2574 | + context, | ||
| 2575 | + true, | ||
| 2576 | + yearStr == '选填' | ||
| 2577 | + ? DateTime.now().year.toString() | ||
| 2578 | + : yearStr, | ||
| 2579 | + monthStr == '' | ||
| 2580 | + ? DateTime.now().month.toString() | ||
| 2581 | + : monthStr, (month) { | ||
| 2582 | + print(month); | ||
| 2583 | + stateSetter(() { | ||
| 2584 | + monthStr = month; | ||
| 2585 | + }); | ||
| 2586 | + if (dayStr != '') { | ||
| 2587 | + List dayList = updateDay( | ||
| 2588 | + true, | ||
| 2589 | + yearStr == '选填' | ||
| 2590 | + ? DateTime.now() | ||
| 2591 | + .year | ||
| 2592 | + .toString() | ||
| 2593 | + : yearStr, | ||
| 2594 | + monthStr == '' | ||
| 2595 | + ? DateTime.now() | ||
| 2596 | + .month | ||
| 2597 | + .toString() | ||
| 2598 | + : monthStr); | ||
| 2599 | + if (!dayList.contains(dayStr)) { | ||
| 2600 | + stateSetter(() { | ||
| 2601 | + dayStr = ''; | ||
| 2602 | + }); | ||
| 2603 | + } | ||
| 2604 | + } | ||
| 2605 | + }); | ||
| 2606 | + }, | ||
| 2607 | + child: Container( | ||
| 2608 | + padding: EdgeInsets.only( | ||
| 2609 | + bottom: ScreenUtil().setWidth(4)), | ||
| 2610 | + decoration: BoxDecoration( | ||
| 2611 | + border: Border( | ||
| 2612 | + bottom: BorderSide( | ||
| 2613 | + color: MyColours.color_E0E0E0, | ||
| 2614 | + width: ScreenUtil().setWidth(2)), | ||
| 2615 | + )), | ||
| 2616 | + child: Row( | ||
| 2617 | + crossAxisAlignment: | ||
| 2618 | + CrossAxisAlignment.end, | ||
| 2619 | + children: [ | ||
| 2620 | + Padding( | ||
| 2621 | + padding: EdgeInsets.zero, | ||
| 2622 | + child: Text(monthStr, | ||
| 2623 | + style: TextStyle( | ||
| 2624 | + fontSize: | ||
| 2625 | + ScreenUtil().setSp(26), | ||
| 2626 | + color: MyColours | ||
| 2627 | + .color_666666)), | ||
| 2628 | + ), | ||
| 2629 | + HEmptyView(6), | ||
| 2630 | + Image.asset( | ||
| 2631 | + Utils.getImgPath(false | ||
| 2632 | + ? 'c_arrow_up' | ||
| 2633 | + : 'c_arrow_down'), | ||
| 2634 | + width: ScreenUtil().setWidth(28), | ||
| 2635 | + // height: ScreenUtil().setWidth(10), | ||
| 2636 | + ), | ||
| 2637 | + ], | ||
| 2434 | ), | 2638 | ), |
| 2435 | - onChanged: (value) { | ||
| 2436 | - name = value; | ||
| 2437 | - }, | ||
| 2438 | - onEditingComplete: () { | ||
| 2439 | - FocusScope.of(context).requestFocus( | ||
| 2440 | - FocusNode()); //点击空白处隐藏键盘 | ||
| 2441 | - }, | ||
| 2442 | - keyboardType: TextInputType.text))), | ||
| 2443 | - // VEmptyView(28), | ||
| 2444 | - MyDivider(ScreenUtil().setWidth(280 * 2), | ||
| 2445 | - ScreenUtil().setWidth(2), | ||
| 2446 | - color: MyColours.color_efefef), | ||
| 2447 | - Container( | ||
| 2448 | - padding: EdgeInsets.only( | ||
| 2449 | - top: ScreenUtil().setWidth(40), | ||
| 2450 | - bottom: ScreenUtil().setWidth(50)), | ||
| 2451 | - // color: Colors.red, | ||
| 2452 | - alignment: Alignment.center, | ||
| 2453 | - child: Text('纪念日日期', | ||
| 2454 | - style: TextStyle( | ||
| 2455 | - fontSize: ScreenUtil().setSp(fontSize), | ||
| 2456 | - color: MyColours.color_353535)), | ||
| 2457 | - ), | ||
| 2458 | - Row( | ||
| 2459 | - children: [ | ||
| 2460 | - InkWell( | ||
| 2461 | - child: Container( | ||
| 2462 | - padding: EdgeInsets.symmetric( | ||
| 2463 | - horizontal: ScreenUtil().setWidth(10), | ||
| 2464 | - vertical: ScreenUtil().setWidth(10)), | ||
| 2465 | - decoration: BoxDecoration( | ||
| 2466 | - color: true | ||
| 2467 | - ? MyColours.color_199095 | ||
| 2468 | - : MyColours.color_ffffff, | ||
| 2469 | - borderRadius: BorderRadius.only( | ||
| 2470 | - topLeft: Radius.circular( | ||
| 2471 | - ScreenUtil().setWidth(10)), | ||
| 2472 | - bottomLeft: Radius.circular( | ||
| 2473 | - ScreenUtil().setWidth(10))), | ||
| 2474 | - border: Border.all( | ||
| 2475 | - color: MyColours.color_199095, | ||
| 2476 | - width: ScreenUtil().setWidth(2))), | ||
| 2477 | - child: Text('公历', | 2639 | + )), |
| 2640 | + Text('月', | ||
| 2478 | style: TextStyle( | 2641 | style: TextStyle( |
| 2479 | fontSize: ScreenUtil().setSp(28), | 2642 | fontSize: ScreenUtil().setSp(28), |
| 2480 | - color: true | ||
| 2481 | - ? MyColours.color_ffffff | ||
| 2482 | - : MyColours.color_333333)), | ||
| 2483 | - )), | ||
| 2484 | - InkWell( | ||
| 2485 | - child: Container( | ||
| 2486 | - padding: EdgeInsets.symmetric( | ||
| 2487 | - horizontal: ScreenUtil().setWidth(10), | ||
| 2488 | - vertical: ScreenUtil().setWidth(10)), | ||
| 2489 | - decoration: BoxDecoration( | ||
| 2490 | - color: false | ||
| 2491 | - ? MyColours.color_199095 | ||
| 2492 | - : MyColours.color_ffffff, | ||
| 2493 | - borderRadius: BorderRadius.only( | ||
| 2494 | - topRight: Radius.circular( | ||
| 2495 | - ScreenUtil().setWidth(10)), | ||
| 2496 | - bottomRight: Radius.circular( | ||
| 2497 | - ScreenUtil().setWidth(10))), | ||
| 2498 | - border: Border.all( | ||
| 2499 | - color: MyColours.color_199095, | ||
| 2500 | - width: ScreenUtil().setWidth(2))), | ||
| 2501 | - child: Text('农历', | ||
| 2502 | - style: TextStyle( | ||
| 2503 | - fontSize: ScreenUtil().setSp(28), | ||
| 2504 | - color: false | ||
| 2505 | - ? MyColours.color_ffffff | ||
| 2506 | - : MyColours.color_333333))), | ||
| 2507 | - ), | ||
| 2508 | - ], | ||
| 2509 | - ), | ||
| 2510 | - Row( | ||
| 2511 | - children: [ | ||
| 2512 | - InkWell( | ||
| 2513 | - child: Container( | ||
| 2514 | - height: ScreenUtil().setWidth(47 * 2), | ||
| 2515 | - alignment: Alignment.center, | ||
| 2516 | - child: Text( | ||
| 2517 | - '取消', | 2643 | + color: MyColours.color_333333)), |
| 2644 | + HEmptyView(10), | ||
| 2645 | + InkWell( | ||
| 2646 | + onTap: () { | ||
| 2647 | + incrementCounterDay( | ||
| 2648 | + context, | ||
| 2649 | + true, | ||
| 2650 | + yearStr == '选填' | ||
| 2651 | + ? DateTime.now().year.toString() | ||
| 2652 | + : yearStr, | ||
| 2653 | + monthStr == '' | ||
| 2654 | + ? DateTime.now().month.toString() | ||
| 2655 | + : monthStr, | ||
| 2656 | + dayStr == '' | ||
| 2657 | + ? DateTime.now().day.toString() | ||
| 2658 | + : dayStr, (day) { | ||
| 2659 | + print(dayStr); | ||
| 2660 | + stateSetter(() { | ||
| 2661 | + dayStr = day; | ||
| 2662 | + }); | ||
| 2663 | + }); | ||
| 2664 | + }, | ||
| 2665 | + child: Container( | ||
| 2666 | + padding: EdgeInsets.only( | ||
| 2667 | + bottom: ScreenUtil().setWidth(4)), | ||
| 2668 | + decoration: BoxDecoration( | ||
| 2669 | + border: Border( | ||
| 2670 | + bottom: BorderSide( | ||
| 2671 | + color: MyColours.color_E0E0E0, | ||
| 2672 | + width: ScreenUtil().setWidth(2)), | ||
| 2673 | + )), | ||
| 2674 | + child: Row( | ||
| 2675 | + crossAxisAlignment: | ||
| 2676 | + CrossAxisAlignment.end, | ||
| 2677 | + children: [ | ||
| 2678 | + Padding( | ||
| 2679 | + padding: EdgeInsets.zero, | ||
| 2680 | + child: Text(dayStr, | ||
| 2681 | + style: TextStyle( | ||
| 2682 | + fontSize: | ||
| 2683 | + ScreenUtil().setSp(26), | ||
| 2684 | + color: MyColours | ||
| 2685 | + .color_666666)), | ||
| 2686 | + ), | ||
| 2687 | + HEmptyView(6), | ||
| 2688 | + Image.asset( | ||
| 2689 | + Utils.getImgPath(false | ||
| 2690 | + ? 'c_arrow_up' | ||
| 2691 | + : 'c_arrow_down'), | ||
| 2692 | + width: ScreenUtil().setWidth(28), | ||
| 2693 | + // height: ScreenUtil().setWidth(10), | ||
| 2694 | + ), | ||
| 2695 | + ], | ||
| 2696 | + ), | ||
| 2697 | + )), | ||
| 2698 | + Text('日', | ||
| 2518 | style: TextStyle( | 2699 | style: TextStyle( |
| 2519 | - color: MyColours.color_199095, | ||
| 2520 | - fontSize: ScreenUtil().setWidth(34)), | ||
| 2521 | - ), | 2700 | + fontSize: ScreenUtil().setSp(28), |
| 2701 | + color: MyColours.color_333333)), | ||
| 2702 | + ], | ||
| 2703 | + ), | ||
| 2704 | + VEmptyView(60), | ||
| 2705 | + Row( | ||
| 2706 | + mainAxisAlignment: MainAxisAlignment.spaceEvenly, | ||
| 2707 | + children: [ | ||
| 2708 | + RoundButton( | ||
| 2709 | + width: ScreenUtil().setWidth(200), | ||
| 2710 | + height: ScreenUtil().setWidth(70), | ||
| 2711 | + radius: ScreenUtil().setWidth(10), | ||
| 2712 | + text: '取消', | ||
| 2713 | + fontSize: 28, | ||
| 2714 | + borderColor: MyColours.color_199095, | ||
| 2715 | + textColor: MyColours.color_199095, | ||
| 2716 | + gradientStart: MyColours.color_ffffff, | ||
| 2717 | + gradientEnd: MyColours.color_ffffff, | ||
| 2718 | + onPressed: () { | ||
| 2719 | + Navigator.of(context).pop(); | ||
| 2720 | + }, | ||
| 2522 | ), | 2721 | ), |
| 2523 | - onTap: () { | ||
| 2524 | - Navigator.of(context).pop(); | ||
| 2525 | - }, | ||
| 2526 | - ), | ||
| 2527 | - InkWell( | ||
| 2528 | - child: Container( | ||
| 2529 | - height: ScreenUtil().setWidth(47 * 2), | ||
| 2530 | - alignment: Alignment.center, | ||
| 2531 | - child: Text( | ||
| 2532 | - '保存', | ||
| 2533 | - style: TextStyle( | ||
| 2534 | - color: MyColours.color_199095, | ||
| 2535 | - fontSize: ScreenUtil().setWidth(34)), | ||
| 2536 | - ), | 2722 | + RoundButton( |
| 2723 | + width: ScreenUtil().setWidth(200), | ||
| 2724 | + height: ScreenUtil().setWidth(70), | ||
| 2725 | + radius: ScreenUtil().setWidth(10), | ||
| 2726 | + text: '保存', | ||
| 2727 | + fontSize: 28, | ||
| 2728 | + onPressed: () { | ||
| 2729 | + if (name == '' || name.trim().length == 0) { | ||
| 2730 | + Utils.showToast('请输入纪念日名称'); | ||
| 2731 | + return; | ||
| 2732 | + } | ||
| 2733 | + Navigator.of(context).pop(); | ||
| 2734 | + rCallback(name); | ||
| 2735 | + }, | ||
| 2537 | ), | 2736 | ), |
| 2538 | - onTap: () { | ||
| 2539 | - if (name == '' || name.trim().length == 0) { | ||
| 2540 | - Utils.showToast('请输入纪念日名称'); | ||
| 2541 | - return; | ||
| 2542 | - } | ||
| 2543 | - Navigator.of(context).pop(); | ||
| 2544 | - rCallback(name); | ||
| 2545 | - }, | ||
| 2546 | - ) | ||
| 2547 | - ], | ||
| 2548 | - ) | ||
| 2549 | - ], | ||
| 2550 | - )), | 2737 | + ], |
| 2738 | + ), | ||
| 2739 | + VEmptyView(20), | ||
| 2740 | + ], | ||
| 2741 | + )), | ||
| 2742 | + )), | ||
| 2551 | ), | 2743 | ), |
| 2552 | - ), | ||
| 2553 | - )); | 2744 | + )); |
| 2745 | + }); | ||
| 2554 | }, | 2746 | }, |
| 2555 | ); | 2747 | ); |
| 2556 | } | 2748 | } |
| 1 | +// 计算阳历的这个年份这个月份,天数有几天 | ||
| 2 | + | ||
| 3 | +getYangliDay(year, month) { | ||
| 4 | + int count = 0; | ||
| 5 | + | ||
| 6 | +//判断大月份 | ||
| 7 | + | ||
| 8 | + if (month == 1 || | ||
| 9 | + month == 3 || | ||
| 10 | + month == 5 || | ||
| 11 | + month == 7 || | ||
| 12 | + month == 8 || | ||
| 13 | + month == 10 || | ||
| 14 | + month == 12) { | ||
| 15 | + count = 31; | ||
| 16 | + } | ||
| 17 | + | ||
| 18 | +//判断小月 | ||
| 19 | + | ||
| 20 | + if (month == 4 || month == 6 || month == 9 || month == 11) { | ||
| 21 | + count = 30; | ||
| 22 | + } | ||
| 23 | + | ||
| 24 | +//判断平年与闰年 | ||
| 25 | + | ||
| 26 | + if (month == 2) { | ||
| 27 | + if (isLeapYear(year)) { | ||
| 28 | + count = 29; | ||
| 29 | + } else { | ||
| 30 | + count = 28; | ||
| 31 | + } | ||
| 32 | + } | ||
| 33 | + | ||
| 34 | + return count; | ||
| 35 | +} | ||
| 36 | + | ||
| 37 | +/** | ||
| 38 | + | ||
| 39 | +* 是否是闰年 | ||
| 40 | + | ||
| 41 | +*/ | ||
| 42 | + | ||
| 43 | +bool isLeapYear(int year) { | ||
| 44 | + return ((year % 4 == 0) && (year % 100 != 0)) || (year % 400 == 0); | ||
| 45 | +} | ||
| 46 | + | ||
| 47 | +// 计算阳历的这个年份这个月份,天数有几天 | ||
| 48 | + | ||
| 49 | +int getNongliDay(int year, int month) { | ||
| 50 | + if ((LUNAR_INFO[year - 1900] & (0x100000 >> month)) == 0) | ||
| 51 | + return 29; | ||
| 52 | + else | ||
| 53 | + return 30; | ||
| 54 | +} | ||
| 55 | + | ||
| 56 | +/** | ||
| 57 | + | ||
| 58 | +* 用来表示1900年到2099年间农历年份的相关信息,共24位bit的16进制表示,其中: | ||
| 59 | + | ||
| 60 | +* 1. 前4位表示该年闰哪个月; | ||
| 61 | + | ||
| 62 | +* 2. 5-17位表示农历年份13个月的大小月分布,0表示小,1表示大; | ||
| 63 | + | ||
| 64 | +* 3. 最后7位表示农历年首(正月初一)对应的公历日期。 | ||
| 65 | + | ||
| 66 | +* <p/> | ||
| 67 | + | ||
| 68 | +* 以2014年的数据0x955ABF为例说明: | ||
| 69 | + | ||
| 70 | +* 1001 0101 0101 1010 1011 1111 | ||
| 71 | + | ||
| 72 | +* 闰九月 农历正月初一对应公历1月31号 | ||
| 73 | + | ||
| 74 | +*/ | ||
| 75 | + | ||
| 76 | +final List<int> LUNAR_INFO = [ | ||
| 77 | + 0x84B6BF, | ||
| 78 | + | ||
| 79 | +/*1900*/ | ||
| 80 | + | ||
| 81 | + 0x04AE53, | ||
| 82 | + 0x0A5748, | ||
| 83 | + 0x5526BD, | ||
| 84 | + 0x0D2650, | ||
| 85 | + 0x0D9544, | ||
| 86 | + 0x46AAB9, | ||
| 87 | + 0x056A4D, | ||
| 88 | + 0x09AD42, | ||
| 89 | + 0x24AEB6, | ||
| 90 | + 0x04AE4A, | ||
| 91 | + | ||
| 92 | +/*1901-1910*/ | ||
| 93 | + | ||
| 94 | + 0x6A4DBE, | ||
| 95 | + 0x0A4D52, | ||
| 96 | + 0x0D2546, | ||
| 97 | + 0x5D52BA, | ||
| 98 | + 0x0B544E, | ||
| 99 | + 0x0D6A43, | ||
| 100 | + 0x296D37, | ||
| 101 | + 0x095B4B, | ||
| 102 | + 0x749BC1, | ||
| 103 | + 0x049754, | ||
| 104 | + | ||
| 105 | +/*1911-1920*/ | ||
| 106 | + | ||
| 107 | + 0x0A4B48, | ||
| 108 | + 0x5B25BC, | ||
| 109 | + 0x06A550, | ||
| 110 | + 0x06D445, | ||
| 111 | + 0x4ADAB8, | ||
| 112 | + 0x02B64D, | ||
| 113 | + 0x095742, | ||
| 114 | + 0x2497B7, | ||
| 115 | + 0x04974A, | ||
| 116 | + 0x664B3E, | ||
| 117 | + | ||
| 118 | +/*1921-1930*/ | ||
| 119 | + | ||
| 120 | + 0x0D4A51, | ||
| 121 | + 0x0EA546, | ||
| 122 | + 0x56D4BA, | ||
| 123 | + 0x05AD4E, | ||
| 124 | + 0x02B644, | ||
| 125 | + 0x393738, | ||
| 126 | + 0x092E4B, | ||
| 127 | + 0x7C96BF, | ||
| 128 | + 0x0C9553, | ||
| 129 | + 0x0D4A48, | ||
| 130 | + | ||
| 131 | +/*1931-1940*/ | ||
| 132 | + | ||
| 133 | + 0x6DA53B, | ||
| 134 | + 0x0B554F, | ||
| 135 | + 0x056A45, | ||
| 136 | + 0x4AADB9, | ||
| 137 | + 0x025D4D, | ||
| 138 | + 0x092D42, | ||
| 139 | + 0x2C95B6, | ||
| 140 | + 0x0A954A, | ||
| 141 | + 0x7B4ABD, | ||
| 142 | + 0x06CA51, | ||
| 143 | + | ||
| 144 | +/*1941-1950*/ | ||
| 145 | + | ||
| 146 | + 0x0B5546, | ||
| 147 | + 0x555ABB, | ||
| 148 | + 0x04DA4E, | ||
| 149 | + 0x0A5B43, | ||
| 150 | + 0x352BB8, | ||
| 151 | + 0x052B4C, | ||
| 152 | + 0x8A953F, | ||
| 153 | + 0x0E9552, | ||
| 154 | + 0x06AA48, | ||
| 155 | + 0x6AD53C, | ||
| 156 | + | ||
| 157 | +/*1951-1960*/ | ||
| 158 | + | ||
| 159 | + 0x0AB54F, | ||
| 160 | + 0x04B645, | ||
| 161 | + 0x4A5739, | ||
| 162 | + 0x0A574D, | ||
| 163 | + 0x052642, | ||
| 164 | + 0x3E9335, | ||
| 165 | + 0x0D9549, | ||
| 166 | + 0x75AABE, | ||
| 167 | + 0x056A51, | ||
| 168 | + 0x096D46, | ||
| 169 | + | ||
| 170 | +/*1961-1970*/ | ||
| 171 | + | ||
| 172 | + 0x54AEBB, | ||
| 173 | + 0x04AD4F, | ||
| 174 | + 0x0A4D43, | ||
| 175 | + 0x4D26B7, | ||
| 176 | + 0x0D254B, | ||
| 177 | + 0x8D52BF, | ||
| 178 | + 0x0B5452, | ||
| 179 | + 0x0B6A47, | ||
| 180 | + 0x696D3C, | ||
| 181 | + 0x095B50, | ||
| 182 | + | ||
| 183 | +/*1971-1980*/ | ||
| 184 | + | ||
| 185 | + 0x049B45, | ||
| 186 | + 0x4A4BB9, | ||
| 187 | + 0x0A4B4D, | ||
| 188 | + 0xAB25C2, | ||
| 189 | + 0x06A554, | ||
| 190 | + 0x06D449, | ||
| 191 | + 0x6ADA3D, | ||
| 192 | + 0x0AB651, | ||
| 193 | + 0x095746, | ||
| 194 | + 0x5497BB, | ||
| 195 | + | ||
| 196 | +/*1981-1990*/ | ||
| 197 | + | ||
| 198 | + 0x04974F, | ||
| 199 | + 0x064B44, | ||
| 200 | + 0x36A537, | ||
| 201 | + 0x0EA54A, | ||
| 202 | + 0x86B2BF, | ||
| 203 | + 0x05AC53, | ||
| 204 | + 0x0AB647, | ||
| 205 | + 0x5936BC, | ||
| 206 | + 0x092E50, | ||
| 207 | + 0x0C9645, | ||
| 208 | + | ||
| 209 | +/*1991-2000*/ | ||
| 210 | + | ||
| 211 | + 0x4D4AB8, | ||
| 212 | + 0x0D4A4C, | ||
| 213 | + 0x0DA541, | ||
| 214 | + 0x25AAB6, | ||
| 215 | + 0x056A49, | ||
| 216 | + 0x7AADBD, | ||
| 217 | + 0x025D52, | ||
| 218 | + 0x092D47, | ||
| 219 | + 0x5C95BA, | ||
| 220 | + 0x0A954E, | ||
| 221 | + | ||
| 222 | +/*2001-2010*/ | ||
| 223 | + | ||
| 224 | + 0x0B4A43, | ||
| 225 | + 0x4B5537, | ||
| 226 | + 0x0AD54A, | ||
| 227 | + 0x955ABF, | ||
| 228 | + 0x04BA53, | ||
| 229 | + 0x0A5B48, | ||
| 230 | + 0x652BBC, | ||
| 231 | + 0x052B50, | ||
| 232 | + 0x0A9345, | ||
| 233 | + 0x474AB9, | ||
| 234 | + | ||
| 235 | +/*2011-2020*/ | ||
| 236 | + | ||
| 237 | + 0x06AA4C, | ||
| 238 | + 0x0AD541, | ||
| 239 | + 0x24DAB6, | ||
| 240 | + 0x04B64A, | ||
| 241 | + 0x6a573D, | ||
| 242 | + 0x0A4E51, | ||
| 243 | + 0x0D2646, | ||
| 244 | + 0x5E933A, | ||
| 245 | + 0x0D534D, | ||
| 246 | + 0x05AA43, | ||
| 247 | + | ||
| 248 | +/*2021-2030*/ | ||
| 249 | + | ||
| 250 | + 0x36B537, | ||
| 251 | + 0x096D4B, | ||
| 252 | + 0xB4AEBF, | ||
| 253 | + 0x04AD53, | ||
| 254 | + 0x0A4D48, | ||
| 255 | + 0x6D25BC, | ||
| 256 | + 0x0D254F, | ||
| 257 | + 0x0D5244, | ||
| 258 | + 0x5DAA38, | ||
| 259 | + 0x0B5A4C, | ||
| 260 | + | ||
| 261 | +/*2031-2040*/ | ||
| 262 | + | ||
| 263 | + 0x056D41, | ||
| 264 | + 0x24ADB6, | ||
| 265 | + 0x049B4A, | ||
| 266 | + 0x7A4BBE, | ||
| 267 | + 0x0A4B51, | ||
| 268 | + 0x0AA546, | ||
| 269 | + 0x5B52BA, | ||
| 270 | + 0x06D24E, | ||
| 271 | + 0x0ADA42, | ||
| 272 | + 0x355B37, | ||
| 273 | + | ||
| 274 | +/*2041-2050*/ | ||
| 275 | + | ||
| 276 | + 0x09374B, | ||
| 277 | + 0x8497C1, | ||
| 278 | + 0x049753, | ||
| 279 | + 0x064B48, | ||
| 280 | + 0x66A53C, | ||
| 281 | + 0x0EA54F, | ||
| 282 | + 0x06AA44, | ||
| 283 | + 0x4AB638, | ||
| 284 | + 0x0AAE4C, | ||
| 285 | + 0x092E42, | ||
| 286 | + | ||
| 287 | +/*2051-2060*/ | ||
| 288 | + | ||
| 289 | + 0x3C9735, | ||
| 290 | + 0x0C9649, | ||
| 291 | + 0x7D4ABD, | ||
| 292 | + 0x0D4A51, | ||
| 293 | + 0x0DA545, | ||
| 294 | + 0x55AABA, | ||
| 295 | + 0x056A4E, | ||
| 296 | + 0x0A6D43, | ||
| 297 | + 0x452EB7, | ||
| 298 | + 0x052D4B, | ||
| 299 | + | ||
| 300 | +/*2061-2070*/ | ||
| 301 | + | ||
| 302 | + 0x8A95BF, | ||
| 303 | + 0x0A9553, | ||
| 304 | + 0x0B4A47, | ||
| 305 | + 0x6B553B, | ||
| 306 | + 0x0AD54F, | ||
| 307 | + 0x055A45, | ||
| 308 | + 0x4A5D38, | ||
| 309 | + 0x0A5B4C, | ||
| 310 | + 0x052B42, | ||
| 311 | + 0x3A93B6, | ||
| 312 | + | ||
| 313 | +/*2071-2080*/ | ||
| 314 | + | ||
| 315 | + 0x069349, | ||
| 316 | + 0x7729BD, | ||
| 317 | + 0x06AA51, | ||
| 318 | + 0x0AD546, | ||
| 319 | + 0x54DABA, | ||
| 320 | + 0x04B64E, | ||
| 321 | + 0x0A5743, | ||
| 322 | + 0x452738, | ||
| 323 | + 0x0D264A, | ||
| 324 | + 0x8E933E, | ||
| 325 | + | ||
| 326 | +/*2081-2090*/ | ||
| 327 | + | ||
| 328 | + 0x0D5252, | ||
| 329 | + 0x0DAA47, | ||
| 330 | + 0x66B53B, | ||
| 331 | + 0x056D4F, | ||
| 332 | + 0x04AE45, | ||
| 333 | + 0x4A4EB9, | ||
| 334 | + 0x0A4D4C, | ||
| 335 | + 0x0D1541, | ||
| 336 | + 0x2D92B5 /*2091-2099*/ | ||
| 337 | +]; |
| 1 | +import 'package:flutter/cupertino.dart'; | ||
| 2 | + | ||
| 3 | +import 'package:flutter/material.dart'; | ||
| 4 | +import 'package:flutter_screenutil/flutter_screenutil.dart'; | ||
| 5 | +import 'package:one_key/res/colors.dart'; | ||
| 6 | + | ||
| 7 | +import 'change_nongli_yangli.dart'; | ||
| 8 | + | ||
| 9 | +typedef CustomCallBack = void Function(Object object); | ||
| 10 | + | ||
| 11 | +void incrementCounterDay( | ||
| 12 | + context, | ||
| 13 | + bool gongli, | ||
| 14 | + String year, | ||
| 15 | + String month, | ||
| 16 | + String day, | ||
| 17 | + CustomCallBack callBack, | ||
| 18 | +) { | ||
| 19 | + showDialog( | ||
| 20 | + barrierDismissible: true, | ||
| 21 | + context: context, | ||
| 22 | + builder: (context) { | ||
| 23 | +// 用Scaffold返回显示的内容,能跟随主题 | ||
| 24 | + | ||
| 25 | + return GestureDetector( | ||
| 26 | + onTap: () { | ||
| 27 | + Navigator.pop(context); | ||
| 28 | + }, | ||
| 29 | + child: Scaffold( | ||
| 30 | + backgroundColor: Colors.transparent, // 设置透明背影 | ||
| 31 | + | ||
| 32 | + body: Stack(children: <Widget>[ | ||
| 33 | + PickBodyDay( | ||
| 34 | + gongli: gongli, | ||
| 35 | + callBack: callBack, | ||
| 36 | + year: year, | ||
| 37 | + month: month, | ||
| 38 | + day: day) | ||
| 39 | + ]))); | ||
| 40 | + }, | ||
| 41 | + ); | ||
| 42 | +} | ||
| 43 | + | ||
| 44 | +class PickBodyDay extends StatefulWidget { | ||
| 45 | + final bool gongli; | ||
| 46 | + final CustomCallBack callBack; | ||
| 47 | + final String year; | ||
| 48 | + final String month; | ||
| 49 | + final String day; | ||
| 50 | + PickBodyDay( | ||
| 51 | + {Key key, this.gongli, this.callBack, this.year, this.month, this.day}) | ||
| 52 | + : super(key: key); | ||
| 53 | + | ||
| 54 | + @override | ||
| 55 | + _PickBodyDayState createState() => _PickBodyDayState(); | ||
| 56 | +} | ||
| 57 | + | ||
| 58 | +class _PickBodyDayState extends State<PickBodyDay> { | ||
| 59 | + // String sYear = "2000"; | ||
| 60 | + | ||
| 61 | + // String sMonth = '6'; | ||
| 62 | + | ||
| 63 | + String sDay = '15'; | ||
| 64 | + | ||
| 65 | + List day = [], yday = []; | ||
| 66 | + | ||
| 67 | + List nday = [ | ||
| 68 | + '初一', | ||
| 69 | + '初二', | ||
| 70 | + '初三', | ||
| 71 | + '初四', | ||
| 72 | + '初五', | ||
| 73 | + '初六', | ||
| 74 | + '初七', | ||
| 75 | + '初八', | ||
| 76 | + '初九', | ||
| 77 | + '初十', | ||
| 78 | + '十一', | ||
| 79 | + '十二', | ||
| 80 | + '十三', | ||
| 81 | + '十四', | ||
| 82 | + '十五', | ||
| 83 | + '十六', | ||
| 84 | + '十七', | ||
| 85 | + '十八', | ||
| 86 | + '十九', | ||
| 87 | + '二十', | ||
| 88 | + '廿一', | ||
| 89 | + '廿二', | ||
| 90 | + '廿三', | ||
| 91 | + '廿四', | ||
| 92 | + '廿五', | ||
| 93 | + '廿六', | ||
| 94 | + '廿七', | ||
| 95 | + '廿八', | ||
| 96 | + '廿九', | ||
| 97 | + '三十', | ||
| 98 | + '三十一' | ||
| 99 | + ]; | ||
| 100 | + | ||
| 101 | + FixedExtentScrollController dayController = | ||
| 102 | + new FixedExtentScrollController(initialItem: 14); | ||
| 103 | + | ||
| 104 | + @override | ||
| 105 | + void initState() { | ||
| 106 | +// TODO: implement initState | ||
| 107 | + | ||
| 108 | + super.initState(); | ||
| 109 | + | ||
| 110 | +// 获取当天的日期,年份默认选择的是2000年,月份默认是6月,日期默认是15日,时间默认是不详 | ||
| 111 | + dayController = | ||
| 112 | + new FixedExtentScrollController(initialItem: int.parse(widget.day) - 1); | ||
| 113 | + sDay = widget.day; | ||
| 114 | + DateTime today = DateTime.now(); | ||
| 115 | + | ||
| 116 | +// 请空之前的数据 | ||
| 117 | + | ||
| 118 | +// 获取默认年份和月份之下的天数 | ||
| 119 | + | ||
| 120 | + int count = getYangliDay(int.parse(widget.year), int.parse(widget.month)); | ||
| 121 | + | ||
| 122 | + print('count---$count'); | ||
| 123 | + | ||
| 124 | + yday = []; | ||
| 125 | + | ||
| 126 | + for (int m = 1; m < count + 1; m++) { | ||
| 127 | + yday.add('$m'); | ||
| 128 | + } | ||
| 129 | + // updateDay(); | ||
| 130 | + } | ||
| 131 | + | ||
| 132 | + @override | ||
| 133 | + Widget build(BuildContext context) { | ||
| 134 | +// 切换农历和阳历的时候更换月份和天的称呼 | ||
| 135 | + | ||
| 136 | + if (widget.gongli) { | ||
| 137 | + day = yday; | ||
| 138 | + } else { | ||
| 139 | + int count = getNongliDay(int.parse(widget.year), int.parse(widget.month)); | ||
| 140 | + | ||
| 141 | + print('农历的天数==${count}'); | ||
| 142 | + | ||
| 143 | + List old = nday; | ||
| 144 | + | ||
| 145 | + List newDay = old.sublist(0, count); | ||
| 146 | + | ||
| 147 | +// 初始化当前的选中的月份的天数 | ||
| 148 | + | ||
| 149 | + day = newDay; | ||
| 150 | + } | ||
| 151 | + | ||
| 152 | + return Positioned( | ||
| 153 | + left: 0, | ||
| 154 | + right: 0, | ||
| 155 | + bottom: 0, | ||
| 156 | + child: Container( | ||
| 157 | + // height: 300, | ||
| 158 | + decoration: BoxDecoration(color: Colors.white), | ||
| 159 | + | ||
| 160 | +// padding: EdgeInsets.all(10), | ||
| 161 | + | ||
| 162 | + child: Column(children: <Widget>[ | ||
| 163 | + Container( | ||
| 164 | + // padding: EdgeInsets.symmetric(hori ScreenUtil().setWidth(30)), | ||
| 165 | + decoration: BoxDecoration( | ||
| 166 | + border: Border( | ||
| 167 | + bottom: BorderSide( | ||
| 168 | + width: ScreenUtil().setWidth(1), | ||
| 169 | + color: MyColours.color_E0E0E0))), | ||
| 170 | + child: Row( | ||
| 171 | + mainAxisAlignment: MainAxisAlignment.spaceBetween, | ||
| 172 | + children: <Widget>[ | ||
| 173 | + Expanded( | ||
| 174 | + flex: 1, | ||
| 175 | + child: GestureDetector( | ||
| 176 | + child: Container( | ||
| 177 | + color: Colors.white, | ||
| 178 | + padding: EdgeInsets.symmetric( | ||
| 179 | + horizontal: ScreenUtil().setWidth(40)), | ||
| 180 | + alignment: Alignment.centerLeft, | ||
| 181 | + height: ScreenUtil().setWidth(90), | ||
| 182 | + child: Text('取消', | ||
| 183 | + style: TextStyle( | ||
| 184 | + color: MyColours.color_333333))), | ||
| 185 | + onTap: () { | ||
| 186 | + print('关闭弹框'); | ||
| 187 | + | ||
| 188 | + Navigator.pop(context); | ||
| 189 | + }, | ||
| 190 | + )), | ||
| 191 | + Expanded( | ||
| 192 | + flex: 1, | ||
| 193 | + child: GestureDetector( | ||
| 194 | + child: Container( | ||
| 195 | + color: Colors.white, | ||
| 196 | + padding: EdgeInsets.symmetric( | ||
| 197 | + horizontal: ScreenUtil().setWidth(40)), | ||
| 198 | + alignment: Alignment.centerRight, | ||
| 199 | + height: ScreenUtil().setWidth(90), | ||
| 200 | + child: Text('确定', | ||
| 201 | + style: | ||
| 202 | + TextStyle(color: MyColours.color_199095)), | ||
| 203 | + ), | ||
| 204 | + onTap: () { | ||
| 205 | + print('确定 关闭弹框'); | ||
| 206 | + | ||
| 207 | + // print(sMonth); | ||
| 208 | + | ||
| 209 | + // print(sMonth); | ||
| 210 | + | ||
| 211 | + print(sDay); | ||
| 212 | + | ||
| 213 | + // print(sTime); | ||
| 214 | + widget.callBack(sDay); | ||
| 215 | + Navigator.pop(context); | ||
| 216 | + }, | ||
| 217 | + )), | ||
| 218 | + ], | ||
| 219 | + )), | ||
| 220 | + Row( | ||
| 221 | + mainAxisAlignment: MainAxisAlignment.spaceBetween, | ||
| 222 | + children: <Widget>[ | ||
| 223 | +// Expanded( | ||
| 224 | +// flex: 1, | ||
| 225 | +// child: Container( | ||
| 226 | +// height: 200, | ||
| 227 | +// child: CupertinoPicker( | ||
| 228 | +// useMagnifier: true, | ||
| 229 | + | ||
| 230 | +// magnification: 1.2, | ||
| 231 | + | ||
| 232 | +// squeeze: 1, | ||
| 233 | + | ||
| 234 | +// diameterRatio: 1.5, | ||
| 235 | + | ||
| 236 | +// looping: false, | ||
| 237 | + | ||
| 238 | +// backgroundColor: Colors.transparent, //选择器背景色 | ||
| 239 | + | ||
| 240 | +// itemExtent: 35, //item的高度 | ||
| 241 | + | ||
| 242 | +// onSelectedItemChanged: (index) { | ||
| 243 | +// print('index === $index'); | ||
| 244 | + | ||
| 245 | +// int selectYear = 1980 + index; | ||
| 246 | + | ||
| 247 | +// // 更改年的时候,查询选中的年和月的天数 | ||
| 248 | + | ||
| 249 | +// print("选中年 = ${selectYear}"); | ||
| 250 | + | ||
| 251 | +// setState(() { | ||
| 252 | +// sYear = '$selectYear'; | ||
| 253 | + | ||
| 254 | +// // 更换年的时候检测是阳历还是农历 | ||
| 255 | + | ||
| 256 | +// updateDay(); | ||
| 257 | + | ||
| 258 | +// // monthController.jumpToItem(3); | ||
| 259 | +// }); | ||
| 260 | +// }, | ||
| 261 | + | ||
| 262 | +// scrollController: yearController, | ||
| 263 | + | ||
| 264 | +// children: XZItem(year, '年'), | ||
| 265 | +// ))), | ||
| 266 | +// Expanded( | ||
| 267 | +// flex: 1, | ||
| 268 | +// child: Container( | ||
| 269 | +// height: 200, | ||
| 270 | +// child: CupertinoPicker( | ||
| 271 | +// useMagnifier: true, | ||
| 272 | + | ||
| 273 | +// magnification: 1.2, | ||
| 274 | + | ||
| 275 | +// squeeze: 1, | ||
| 276 | + | ||
| 277 | +// diameterRatio: 1.5, | ||
| 278 | + | ||
| 279 | +// looping: false, | ||
| 280 | + | ||
| 281 | +// backgroundColor: Colors.transparent, //选择器背景色 | ||
| 282 | + | ||
| 283 | +// itemExtent: 35, //item的高度 | ||
| 284 | + | ||
| 285 | +// onSelectedItemChanged: (index) { | ||
| 286 | +// //选中item的位置索引 | ||
| 287 | + | ||
| 288 | +// print("月index = $index}"); | ||
| 289 | + | ||
| 290 | +// setState(() { | ||
| 291 | +// sMonth = '${index + 1}'; | ||
| 292 | +// }); | ||
| 293 | + | ||
| 294 | +// sMonth = '${index + 1}'; | ||
| 295 | + | ||
| 296 | +// updateDay(); | ||
| 297 | +// }, | ||
| 298 | + | ||
| 299 | +// scrollController: monthController, | ||
| 300 | + | ||
| 301 | +// children: XZItem(month, '月'), | ||
| 302 | +// ))), | ||
| 303 | + Expanded( | ||
| 304 | + flex: 1, | ||
| 305 | + child: Container( | ||
| 306 | + height: 200, | ||
| 307 | + child: CupertinoPicker( | ||
| 308 | + useMagnifier: true, | ||
| 309 | + | ||
| 310 | + magnification: 1.3, | ||
| 311 | + | ||
| 312 | + squeeze: 1, | ||
| 313 | + | ||
| 314 | + diameterRatio: 1.5, | ||
| 315 | + | ||
| 316 | + looping: false, | ||
| 317 | + | ||
| 318 | + backgroundColor: Colors.transparent, //选择器背景色 | ||
| 319 | + | ||
| 320 | + itemExtent: ScreenUtil().setWidth(70), //item的高度 | ||
| 321 | + selectionOverlay: SizedBox(), | ||
| 322 | + | ||
| 323 | + onSelectedItemChanged: (index) { | ||
| 324 | +//选中item的位置索引 | ||
| 325 | + | ||
| 326 | + print("日index = $index}"); | ||
| 327 | + | ||
| 328 | + setState(() { | ||
| 329 | + sDay = '${index + 1}'; | ||
| 330 | + }); | ||
| 331 | + | ||
| 332 | + sDay = '${index + 1}'; | ||
| 333 | + }, | ||
| 334 | + | ||
| 335 | + scrollController: dayController, | ||
| 336 | + | ||
| 337 | + children: XZItem(day, '日'), | ||
| 338 | + ))), | ||
| 339 | +// Expanded( | ||
| 340 | +// flex: 1, | ||
| 341 | +// child: Container( | ||
| 342 | +// height: 200, | ||
| 343 | +// child: CupertinoPicker( | ||
| 344 | +// useMagnifier: true, | ||
| 345 | + | ||
| 346 | +// magnification: 1.2, | ||
| 347 | + | ||
| 348 | +// squeeze: 1, | ||
| 349 | + | ||
| 350 | +// diameterRatio: 1.5, | ||
| 351 | + | ||
| 352 | +// looping: false, | ||
| 353 | + | ||
| 354 | +// backgroundColor: Colors.transparent, //选择器背景色 | ||
| 355 | + | ||
| 356 | +// itemExtent: 35, //item的高度 | ||
| 357 | + | ||
| 358 | +// onSelectedItemChanged: (index) { | ||
| 359 | +// //选中item的位置索引 | ||
| 360 | + | ||
| 361 | +// print("index = $index}"); | ||
| 362 | + | ||
| 363 | +// setState(() { | ||
| 364 | +// if (index == 0) { | ||
| 365 | +// sTime = '24'; | ||
| 366 | +// } else { | ||
| 367 | +// sTime = '${index - 1}'; | ||
| 368 | +// } | ||
| 369 | +// }); | ||
| 370 | +// }, | ||
| 371 | + | ||
| 372 | +// scrollController: timeController, | ||
| 373 | + | ||
| 374 | +// children: XZItem(time, ''), | ||
| 375 | +// ))), | ||
| 376 | + ]) | ||
| 377 | + ]))); | ||
| 378 | + } | ||
| 379 | + | ||
| 380 | + | ||
| 381 | + List<Widget> XZItem(_data, type) { | ||
| 382 | + List<Widget> list = new List(); | ||
| 383 | + | ||
| 384 | + for (var i = 0; i < _data.length; i++) { | ||
| 385 | + list.add(Text('${_data[i]}$type', | ||
| 386 | + style: TextStyle(color: Colors.black, fontSize: 14))); | ||
| 387 | + } | ||
| 388 | + | ||
| 389 | + return list; | ||
| 390 | + } | ||
| 391 | +} |
| 1 | +import 'package:flutter/cupertino.dart'; | ||
| 2 | + | ||
| 3 | +import 'package:flutter/material.dart'; | ||
| 4 | +import 'package:flutter_screenutil/flutter_screenutil.dart'; | ||
| 5 | +import 'package:one_key/res/colors.dart'; | ||
| 6 | + | ||
| 7 | +import 'change_nongli_yangli.dart'; | ||
| 8 | + | ||
| 9 | +typedef CustomCallBack = void Function(Object object); | ||
| 10 | +List updateDay(bool gongli, String year, String month) { | ||
| 11 | + if (gongli) { | ||
| 12 | +// 公历// 截取天数 | ||
| 13 | + | ||
| 14 | + // print('widget.sYear ==== ${sYear}'); | ||
| 15 | + | ||
| 16 | + // print('widget.sMonth ==== ${sMonth}'); | ||
| 17 | + | ||
| 18 | + // print('widget.sDay ==== ${sDay}'); | ||
| 19 | + | ||
| 20 | + int count = getYangliDay(int.parse(year), int.parse(month)); | ||
| 21 | + | ||
| 22 | + print('count---$count'); | ||
| 23 | + | ||
| 24 | + List yday = []; | ||
| 25 | + | ||
| 26 | + for (int m = 1; m < count + 1; m++) { | ||
| 27 | + yday.add('$m'); | ||
| 28 | + } | ||
| 29 | + return yday; | ||
| 30 | + } else { | ||
| 31 | + int count1 = getYangliDay(int.parse(year), int.parse(month)); | ||
| 32 | + | ||
| 33 | + print('count---$count1'); | ||
| 34 | + | ||
| 35 | + List yday = []; | ||
| 36 | + | ||
| 37 | + for (int m = 1; m < count1 + 1; m++) { | ||
| 38 | + yday.add('$m'); | ||
| 39 | + } | ||
| 40 | + int count = getNongliDay(int.parse(year), int.parse(month)); | ||
| 41 | + | ||
| 42 | + print('农历的天数==${count}'); | ||
| 43 | + | ||
| 44 | + List old = yday; | ||
| 45 | + | ||
| 46 | + List newDay = old.sublist(0, count); | ||
| 47 | + | ||
| 48 | + print(old); | ||
| 49 | + | ||
| 50 | + print(newDay); | ||
| 51 | + | ||
| 52 | + yday = newDay; | ||
| 53 | + return yday; | ||
| 54 | + } | ||
| 55 | +} | ||
| 56 | + | ||
| 57 | +void incrementCounterMonth( | ||
| 58 | + context, | ||
| 59 | + bool gongli, | ||
| 60 | + String year, | ||
| 61 | + String month, | ||
| 62 | + CustomCallBack callBack, | ||
| 63 | +) { | ||
| 64 | + showDialog( | ||
| 65 | + barrierDismissible: true, | ||
| 66 | + context: context, | ||
| 67 | + builder: (context) { | ||
| 68 | +// 用Scaffold返回显示的内容,能跟随主题 | ||
| 69 | + | ||
| 70 | + return GestureDetector( | ||
| 71 | + onTap: () { | ||
| 72 | + Navigator.pop(context); | ||
| 73 | + }, | ||
| 74 | + child: Scaffold( | ||
| 75 | + backgroundColor: Colors.transparent, // 设置透明背影 | ||
| 76 | + | ||
| 77 | + body: Stack(children: <Widget>[ | ||
| 78 | + PickBodyMonth( | ||
| 79 | + gongli: gongli, | ||
| 80 | + callBack: callBack, | ||
| 81 | + year: year, | ||
| 82 | + month: month) | ||
| 83 | + ]))); | ||
| 84 | + }, | ||
| 85 | + ); | ||
| 86 | +} | ||
| 87 | + | ||
| 88 | +class PickBodyMonth extends StatefulWidget { | ||
| 89 | + final bool gongli; | ||
| 90 | + final CustomCallBack callBack; | ||
| 91 | + final String year; | ||
| 92 | + final String month; | ||
| 93 | + PickBodyMonth({Key key, this.gongli, this.callBack, this.month, this.year}) | ||
| 94 | + : super(key: key); | ||
| 95 | + @override | ||
| 96 | + _PickBodyMonthState createState() => _PickBodyMonthState(); | ||
| 97 | +} | ||
| 98 | + | ||
| 99 | +class _PickBodyMonthState extends State<PickBodyMonth> { | ||
| 100 | + String sYear = "2000"; | ||
| 101 | + | ||
| 102 | + String sMonth = '6'; | ||
| 103 | + | ||
| 104 | + List month = [], yMonth = []; | ||
| 105 | + | ||
| 106 | + List nMonth = ['正', '二', '三', '四', '五', '六', '七', '八', '九', '十', '冬', '腊']; | ||
| 107 | + | ||
| 108 | + FixedExtentScrollController monthController = | ||
| 109 | + new FixedExtentScrollController(initialItem: 5); | ||
| 110 | + | ||
| 111 | + @override | ||
| 112 | + void initState() { | ||
| 113 | +// TODO: implement initState | ||
| 114 | + | ||
| 115 | + super.initState(); | ||
| 116 | + | ||
| 117 | +// 获取当天的日期,年份默认选择的是2000年,月份默认是6月,日期默认是15日,时间默认是不详 | ||
| 118 | + monthController = new FixedExtentScrollController( | ||
| 119 | + initialItem: int.parse(widget.month) - 1); | ||
| 120 | + DateTime today = DateTime.now(); | ||
| 121 | + | ||
| 122 | +// 请空之前的数据 | ||
| 123 | + | ||
| 124 | + yMonth = []; | ||
| 125 | + | ||
| 126 | + for (int m = 1; m < 13; m++) { | ||
| 127 | + yMonth.add('$m'); | ||
| 128 | + } | ||
| 129 | + | ||
| 130 | +// 获取默认年份和月份之下的天数 | ||
| 131 | + | ||
| 132 | + // updateDay(); | ||
| 133 | + } | ||
| 134 | + | ||
| 135 | + @override | ||
| 136 | + Widget build(BuildContext context) { | ||
| 137 | +// 切换农历和阳历的时候更换月份和天的称呼 | ||
| 138 | + | ||
| 139 | + if (widget.gongli) { | ||
| 140 | + month = yMonth; | ||
| 141 | + } else { | ||
| 142 | + month = nMonth; | ||
| 143 | + } | ||
| 144 | + | ||
| 145 | + return Positioned( | ||
| 146 | + left: 0, | ||
| 147 | + right: 0, | ||
| 148 | + bottom: 0, | ||
| 149 | + child: Container( | ||
| 150 | + // height: 300, | ||
| 151 | + decoration: BoxDecoration(color: Colors.white), | ||
| 152 | + | ||
| 153 | +// padding: EdgeInsets.all(10), | ||
| 154 | + | ||
| 155 | + child: Column(children: <Widget>[ | ||
| 156 | + Container( | ||
| 157 | + // padding: EdgeInsets.symmetric(hori ScreenUtil().setWidth(30)), | ||
| 158 | + decoration: BoxDecoration( | ||
| 159 | + border: Border( | ||
| 160 | + bottom: BorderSide( | ||
| 161 | + width: ScreenUtil().setWidth(1), | ||
| 162 | + color: MyColours.color_E0E0E0))), | ||
| 163 | + child: Row( | ||
| 164 | + mainAxisAlignment: MainAxisAlignment.spaceBetween, | ||
| 165 | + children: <Widget>[ | ||
| 166 | + Expanded( | ||
| 167 | + flex: 1, | ||
| 168 | + child: GestureDetector( | ||
| 169 | + child: Container( | ||
| 170 | + color: Colors.white, | ||
| 171 | + padding: EdgeInsets.symmetric( | ||
| 172 | + horizontal: ScreenUtil().setWidth(40)), | ||
| 173 | + alignment: Alignment.centerLeft, | ||
| 174 | + height: ScreenUtil().setWidth(90), | ||
| 175 | + child: Text('取消', | ||
| 176 | + style: TextStyle( | ||
| 177 | + color: MyColours.color_333333))), | ||
| 178 | + onTap: () { | ||
| 179 | + print('关闭弹框'); | ||
| 180 | + | ||
| 181 | + Navigator.pop(context); | ||
| 182 | + }, | ||
| 183 | + )), | ||
| 184 | + Expanded( | ||
| 185 | + flex: 1, | ||
| 186 | + child: GestureDetector( | ||
| 187 | + child: Container( | ||
| 188 | + color: Colors.white, | ||
| 189 | + padding: EdgeInsets.symmetric( | ||
| 190 | + horizontal: ScreenUtil().setWidth(40)), | ||
| 191 | + alignment: Alignment.centerRight, | ||
| 192 | + height: ScreenUtil().setWidth(90), | ||
| 193 | + child: Text('确定', | ||
| 194 | + style: | ||
| 195 | + TextStyle(color: MyColours.color_199095)), | ||
| 196 | + ), | ||
| 197 | + onTap: () { | ||
| 198 | + print('确定 关闭弹框'); | ||
| 199 | + | ||
| 200 | + print(sMonth); | ||
| 201 | + | ||
| 202 | + // print(sMonth); | ||
| 203 | + | ||
| 204 | + // print(sDay); | ||
| 205 | + | ||
| 206 | + // print(sTime); | ||
| 207 | + widget.callBack(sMonth); | ||
| 208 | + Navigator.pop(context); | ||
| 209 | + }, | ||
| 210 | + )), | ||
| 211 | + ], | ||
| 212 | + )), | ||
| 213 | + Row( | ||
| 214 | + mainAxisAlignment: MainAxisAlignment.spaceBetween, | ||
| 215 | + children: <Widget>[ | ||
| 216 | +// Expanded( | ||
| 217 | +// flex: 1, | ||
| 218 | +// child: Container( | ||
| 219 | +// height: 200, | ||
| 220 | +// child: CupertinoPicker( | ||
| 221 | +// useMagnifier: true, | ||
| 222 | + | ||
| 223 | +// magnification: 1.2, | ||
| 224 | + | ||
| 225 | +// squeeze: 1, | ||
| 226 | + | ||
| 227 | +// diameterRatio: 1.5, | ||
| 228 | + | ||
| 229 | +// looping: false, | ||
| 230 | + | ||
| 231 | +// backgroundColor: Colors.transparent, //选择器背景色 | ||
| 232 | + | ||
| 233 | +// itemExtent: 35, //item的高度 | ||
| 234 | + | ||
| 235 | +// onSelectedItemChanged: (index) { | ||
| 236 | +// print('index === $index'); | ||
| 237 | + | ||
| 238 | +// int selectYear = 1980 + index; | ||
| 239 | + | ||
| 240 | +// // 更改年的时候,查询选中的年和月的天数 | ||
| 241 | + | ||
| 242 | +// print("选中年 = ${selectYear}"); | ||
| 243 | + | ||
| 244 | +// setState(() { | ||
| 245 | +// sYear = '$selectYear'; | ||
| 246 | + | ||
| 247 | +// // 更换年的时候检测是阳历还是农历 | ||
| 248 | + | ||
| 249 | +// updateDay(); | ||
| 250 | + | ||
| 251 | +// // monthController.jumpToItem(3); | ||
| 252 | +// }); | ||
| 253 | +// }, | ||
| 254 | + | ||
| 255 | +// scrollController: yearController, | ||
| 256 | + | ||
| 257 | +// children: XZItem(year, '年'), | ||
| 258 | +// ))), | ||
| 259 | + Expanded( | ||
| 260 | + flex: 1, | ||
| 261 | + child: Container( | ||
| 262 | + height: ScreenUtil().setWidth(360), | ||
| 263 | + child: CupertinoPicker( | ||
| 264 | + useMagnifier: true, | ||
| 265 | + | ||
| 266 | + magnification: 1.3, | ||
| 267 | + | ||
| 268 | + squeeze: 1, | ||
| 269 | + | ||
| 270 | + diameterRatio: 1.5, | ||
| 271 | + | ||
| 272 | + looping: false, | ||
| 273 | + | ||
| 274 | + backgroundColor: Colors.transparent, //选择器背景色 | ||
| 275 | + | ||
| 276 | + itemExtent: ScreenUtil().setWidth(70), //item的高度 | ||
| 277 | + selectionOverlay: SizedBox(), | ||
| 278 | + | ||
| 279 | + onSelectedItemChanged: (index) { | ||
| 280 | +//选中item的位置索引 | ||
| 281 | + | ||
| 282 | + print("月index = $index}"); | ||
| 283 | + | ||
| 284 | + setState(() { | ||
| 285 | + sMonth = '${index + 1}'; | ||
| 286 | + }); | ||
| 287 | + | ||
| 288 | + sMonth = '${index + 1}'; | ||
| 289 | + | ||
| 290 | + // updateDay(); | ||
| 291 | + }, | ||
| 292 | + | ||
| 293 | + scrollController: monthController, | ||
| 294 | + | ||
| 295 | + children: XZItem(month, '月'), | ||
| 296 | + ))), | ||
| 297 | +// Expanded( | ||
| 298 | +// flex: 1, | ||
| 299 | +// child: Container( | ||
| 300 | +// height: 200, | ||
| 301 | +// child: CupertinoPicker( | ||
| 302 | +// useMagnifier: true, | ||
| 303 | + | ||
| 304 | +// magnification: 1.2, | ||
| 305 | + | ||
| 306 | +// squeeze: 1, | ||
| 307 | + | ||
| 308 | +// diameterRatio: 1.5, | ||
| 309 | + | ||
| 310 | +// looping: false, | ||
| 311 | + | ||
| 312 | +// backgroundColor: Colors.transparent, //选择器背景色 | ||
| 313 | + | ||
| 314 | +// itemExtent: 35, //item的高度 | ||
| 315 | + | ||
| 316 | +// onSelectedItemChanged: (index) { | ||
| 317 | +// //选中item的位置索引 | ||
| 318 | + | ||
| 319 | +// print("日index = $index}"); | ||
| 320 | + | ||
| 321 | +// setState(() { | ||
| 322 | +// sDay = '${index + 1}'; | ||
| 323 | +// }); | ||
| 324 | + | ||
| 325 | +// sDay = '${index + 1}'; | ||
| 326 | +// }, | ||
| 327 | + | ||
| 328 | +// scrollController: dayController, | ||
| 329 | + | ||
| 330 | +// children: XZItem(day, '日'), | ||
| 331 | +// ))), | ||
| 332 | +// Expanded( | ||
| 333 | +// flex: 1, | ||
| 334 | +// child: Container( | ||
| 335 | +// height: 200, | ||
| 336 | +// child: CupertinoPicker( | ||
| 337 | +// useMagnifier: true, | ||
| 338 | + | ||
| 339 | +// magnification: 1.2, | ||
| 340 | + | ||
| 341 | +// squeeze: 1, | ||
| 342 | + | ||
| 343 | +// diameterRatio: 1.5, | ||
| 344 | + | ||
| 345 | +// looping: false, | ||
| 346 | + | ||
| 347 | +// backgroundColor: Colors.transparent, //选择器背景色 | ||
| 348 | + | ||
| 349 | +// itemExtent: 35, //item的高度 | ||
| 350 | + | ||
| 351 | +// onSelectedItemChanged: (index) { | ||
| 352 | +// //选中item的位置索引 | ||
| 353 | + | ||
| 354 | +// print("index = $index}"); | ||
| 355 | + | ||
| 356 | +// setState(() { | ||
| 357 | +// if (index == 0) { | ||
| 358 | +// sTime = '24'; | ||
| 359 | +// } else { | ||
| 360 | +// sTime = '${index - 1}'; | ||
| 361 | +// } | ||
| 362 | +// }); | ||
| 363 | +// }, | ||
| 364 | + | ||
| 365 | +// scrollController: timeController, | ||
| 366 | + | ||
| 367 | +// children: XZItem(time, ''), | ||
| 368 | +// ))), | ||
| 369 | + ]) | ||
| 370 | + ]))); | ||
| 371 | + } | ||
| 372 | + | ||
| 373 | +// updateDay() { | ||
| 374 | +// if (widget.gongli) { | ||
| 375 | +// // 公历// 截取天数 | ||
| 376 | + | ||
| 377 | +// print('widget.sYear ==== ${sYear}'); | ||
| 378 | + | ||
| 379 | +// print('widget.sMonth ==== ${sMonth}'); | ||
| 380 | + | ||
| 381 | +// print('widget.sDay ==== ${sDay}'); | ||
| 382 | + | ||
| 383 | +// int count = getYangliDay(int.parse(sYear), int.parse(sMonth)); | ||
| 384 | + | ||
| 385 | +// print('count---$count'); | ||
| 386 | + | ||
| 387 | +// yday = []; | ||
| 388 | + | ||
| 389 | +// for (int m = 1; m < count + 1; m++) { | ||
| 390 | +// yday.add('$m'); | ||
| 391 | +// } | ||
| 392 | +// } else { | ||
| 393 | +// int count = getNongliDay(int.parse(sYear), int.parse(sMonth)); | ||
| 394 | + | ||
| 395 | +// print('农历的天数==${count}'); | ||
| 396 | + | ||
| 397 | +// List old = day; | ||
| 398 | + | ||
| 399 | +// List newDay = old.sublist(0, count); | ||
| 400 | + | ||
| 401 | +// print(old); | ||
| 402 | + | ||
| 403 | +// print(newDay); | ||
| 404 | + | ||
| 405 | +// day = newDay; | ||
| 406 | +// } | ||
| 407 | +// } | ||
| 408 | + | ||
| 409 | + List<Widget> XZItem(_data, type) { | ||
| 410 | + List<Widget> list = new List(); | ||
| 411 | + | ||
| 412 | + for (var i = 0; i < _data.length; i++) { | ||
| 413 | + list.add(Text('${_data[i]}$type', | ||
| 414 | + style: TextStyle(color: Colors.black, fontSize: 14))); | ||
| 415 | + } | ||
| 416 | + | ||
| 417 | + return list; | ||
| 418 | + } | ||
| 419 | +} |
| 1 | +import 'package:flutter/cupertino.dart'; | ||
| 2 | + | ||
| 3 | +import 'package:flutter/material.dart'; | ||
| 4 | +import 'package:flutter_screenutil/screenutil.dart'; | ||
| 5 | +import 'package:one_key/res/colors.dart'; | ||
| 6 | +import 'package:one_key/widgets/v_empty_view.dart'; | ||
| 7 | + | ||
| 8 | +import 'change_nongli_yangli.dart'; | ||
| 9 | + | ||
| 10 | +typedef CustomCallBack = void Function(Object object); | ||
| 11 | +void incrementCounterYear( | ||
| 12 | + context, | ||
| 13 | + bool gongli, | ||
| 14 | + String year, | ||
| 15 | + CustomCallBack callBack, | ||
| 16 | +) { | ||
| 17 | + showDialog( | ||
| 18 | + barrierDismissible: true, | ||
| 19 | + context: context, | ||
| 20 | + builder: (context) { | ||
| 21 | +// 用Scaffold返回显示的内容,能跟随主题 | ||
| 22 | + | ||
| 23 | + return Scaffold( | ||
| 24 | + backgroundColor: Colors.transparent, // 设置透明背影 | ||
| 25 | + | ||
| 26 | + body: Stack(children: <Widget>[ | ||
| 27 | + PickBodyYear(gongli: gongli, callBack: callBack, year: year) | ||
| 28 | + ])); | ||
| 29 | + }, | ||
| 30 | + ); | ||
| 31 | +} | ||
| 32 | + | ||
| 33 | +class PickBodyYear extends StatefulWidget { | ||
| 34 | + final bool gongli; | ||
| 35 | + final CustomCallBack callBack; | ||
| 36 | + final String year; | ||
| 37 | + PickBodyYear({Key key, this.gongli, this.callBack, this.year}) | ||
| 38 | + : super(key: key); | ||
| 39 | + | ||
| 40 | + @override | ||
| 41 | + _PickBodyYearState createState() => _PickBodyYearState(); | ||
| 42 | +} | ||
| 43 | + | ||
| 44 | +class _PickBodyYearState extends State<PickBodyYear> { | ||
| 45 | + String sYear = "2000"; | ||
| 46 | + | ||
| 47 | + // String sMonth = '6'; | ||
| 48 | + | ||
| 49 | + // String sDay = '15'; | ||
| 50 | + | ||
| 51 | + // String sTime = '24'; | ||
| 52 | + | ||
| 53 | + List yearList = []; | ||
| 54 | + | ||
| 55 | + // List nMonth = ['正', '二', '三', '四', '五', '六', '七', '八', '九', '十', '冬', '腊']; | ||
| 56 | + | ||
| 57 | + // List time = [ | ||
| 58 | + // '时辰未知', | ||
| 59 | + // '0时子', | ||
| 60 | + // '1时丑', | ||
| 61 | + // '2时丑', | ||
| 62 | + // '3时寅', | ||
| 63 | + // '4时寅', | ||
| 64 | + // '5时', | ||
| 65 | + // '6时', | ||
| 66 | + // '7时', | ||
| 67 | + // '8时', | ||
| 68 | + // '9时', | ||
| 69 | + // '10时', | ||
| 70 | + // '11时', | ||
| 71 | + // '12时', | ||
| 72 | + // '13时丑', | ||
| 73 | + // '14时丑', | ||
| 74 | + // '15时寅', | ||
| 75 | + // '16时寅', | ||
| 76 | + // '17时', | ||
| 77 | + // '18时', | ||
| 78 | + // '19时', | ||
| 79 | + // '20时', | ||
| 80 | + // '21时', | ||
| 81 | + // '22时', | ||
| 82 | + // '23时' | ||
| 83 | + // ]; | ||
| 84 | + | ||
| 85 | + // List nday = [ | ||
| 86 | + // '初一', | ||
| 87 | + // '初二', | ||
| 88 | + // '初三', | ||
| 89 | + // '初四', | ||
| 90 | + // '初五', | ||
| 91 | + // '初六', | ||
| 92 | + // '初七', | ||
| 93 | + // '初八', | ||
| 94 | + // '初九', | ||
| 95 | + // '初十', | ||
| 96 | + // '十一', | ||
| 97 | + // '十二', | ||
| 98 | + // '十三', | ||
| 99 | + // '十四', | ||
| 100 | + // '十五', | ||
| 101 | + // '十六', | ||
| 102 | + // '十七', | ||
| 103 | + // '十八', | ||
| 104 | + // '十九', | ||
| 105 | + // '二十', | ||
| 106 | + // '廿一', | ||
| 107 | + // '廿二', | ||
| 108 | + // '廿三', | ||
| 109 | + // '廿四', | ||
| 110 | + // '廿五', | ||
| 111 | + // '廿六', | ||
| 112 | + // '廿七', | ||
| 113 | + // '廿八', | ||
| 114 | + // '廿九', | ||
| 115 | + // '三十', | ||
| 116 | + // '三十一' | ||
| 117 | + // ]; | ||
| 118 | + | ||
| 119 | + FixedExtentScrollController yearController = | ||
| 120 | + new FixedExtentScrollController(initialItem: 20); | ||
| 121 | + | ||
| 122 | + // FixedExtentScrollController monthController = | ||
| 123 | + // new FixedExtentScrollController(initialItem: 5); | ||
| 124 | + | ||
| 125 | + // FixedExtentScrollController dayController = | ||
| 126 | + // new FixedExtentScrollController(initialItem: 14); | ||
| 127 | + | ||
| 128 | + // FixedExtentScrollController timeController = | ||
| 129 | + // new FixedExtentScrollController(); | ||
| 130 | + | ||
| 131 | + @override | ||
| 132 | + void initState() { | ||
| 133 | +// TODO: implement initState | ||
| 134 | + | ||
| 135 | + super.initState(); | ||
| 136 | + | ||
| 137 | +// 获取当天的日期,年份默认选择的是2000年,月份默认是6月,日期默认是15日,时间默认是不详 | ||
| 138 | + yearController = new FixedExtentScrollController( | ||
| 139 | + initialItem: int.parse(widget.year) - 1900); | ||
| 140 | + DateTime today = DateTime.now(); | ||
| 141 | + | ||
| 142 | +// 请空之前的数据 | ||
| 143 | + sYear = widget.year; | ||
| 144 | + for (var y = 1900; y < today.year + 50; y++) { | ||
| 145 | + yearList.add('$y'); | ||
| 146 | + } | ||
| 147 | + | ||
| 148 | + // yMonth = []; | ||
| 149 | + | ||
| 150 | + // for (int m = 1; m < 13; m++) { | ||
| 151 | + // yMonth.add('$m'); | ||
| 152 | + // } | ||
| 153 | + | ||
| 154 | +// 获取默认年份和月份之下的天数 | ||
| 155 | + | ||
| 156 | + // int count = getYangliDay(int.parse(sYear), int.parse(sMonth)); | ||
| 157 | + | ||
| 158 | + // print('count---$count'); | ||
| 159 | + | ||
| 160 | + // yday = []; | ||
| 161 | + | ||
| 162 | + // for (int m = 1; m < count + 1; m++) { | ||
| 163 | + // yday.add('$m'); | ||
| 164 | + // } | ||
| 165 | + // updateDay(); | ||
| 166 | + } | ||
| 167 | + | ||
| 168 | + @override | ||
| 169 | + Widget build(BuildContext context) { | ||
| 170 | +// 切换农历和阳历的时候更换月份和天的称呼 | ||
| 171 | + | ||
| 172 | +// if (widget.gongli) { | ||
| 173 | +// month = yMonth; | ||
| 174 | + | ||
| 175 | +// day = yday; | ||
| 176 | +// } else { | ||
| 177 | +// month = nMonth; | ||
| 178 | + | ||
| 179 | +// int count = getNongliDay(int.parse(sYear), int.parse(sMonth)); | ||
| 180 | + | ||
| 181 | +// print('农历的天数==${count}'); | ||
| 182 | + | ||
| 183 | +// List old = nday; | ||
| 184 | + | ||
| 185 | +// List newDay = old.sublist(0, count); | ||
| 186 | + | ||
| 187 | +// // 初始化当前的选中的月份的天数 | ||
| 188 | + | ||
| 189 | +// day = newDay; | ||
| 190 | +// } | ||
| 191 | + | ||
| 192 | + return Positioned( | ||
| 193 | + left: 0, | ||
| 194 | + right: 0, | ||
| 195 | + bottom: 0, | ||
| 196 | + child: Container( | ||
| 197 | + // height: ScreenUtil().setWidth(380+100), | ||
| 198 | + decoration: BoxDecoration(color: Colors.white), | ||
| 199 | + | ||
| 200 | +// padding: EdgeInsets.all(10), | ||
| 201 | + | ||
| 202 | + child: Column(children: <Widget>[ | ||
| 203 | + // VEmptyView(10), | ||
| 204 | + Container( | ||
| 205 | + // padding: EdgeInsets.symmetric(hori ScreenUtil().setWidth(30)), | ||
| 206 | + decoration: BoxDecoration( | ||
| 207 | + border: Border( | ||
| 208 | + bottom: BorderSide( | ||
| 209 | + width: ScreenUtil().setWidth(1), | ||
| 210 | + color: MyColours.color_E0E0E0))), | ||
| 211 | + child: Row( | ||
| 212 | + mainAxisAlignment: MainAxisAlignment.spaceBetween, | ||
| 213 | + children: <Widget>[ | ||
| 214 | + Expanded( | ||
| 215 | + flex: 1, | ||
| 216 | + child: GestureDetector( | ||
| 217 | + child: Container( | ||
| 218 | + color: Colors.white, | ||
| 219 | + padding: EdgeInsets.symmetric( | ||
| 220 | + horizontal: ScreenUtil().setWidth(40)), | ||
| 221 | + alignment: Alignment.centerLeft, | ||
| 222 | + height: ScreenUtil().setWidth(90), | ||
| 223 | + child: Text('取消', | ||
| 224 | + style: TextStyle( | ||
| 225 | + color: MyColours.color_333333))), | ||
| 226 | + onTap: () { | ||
| 227 | + print('关闭弹框'); | ||
| 228 | + | ||
| 229 | + Navigator.pop(context); | ||
| 230 | + }, | ||
| 231 | + )), | ||
| 232 | + Expanded( | ||
| 233 | + flex: 1, | ||
| 234 | + child: GestureDetector( | ||
| 235 | + child: Container( | ||
| 236 | + color: Colors.white, | ||
| 237 | + padding: EdgeInsets.symmetric( | ||
| 238 | + horizontal: ScreenUtil().setWidth(40)), | ||
| 239 | + alignment: Alignment.centerRight, | ||
| 240 | + height: ScreenUtil().setWidth(90), | ||
| 241 | + child: Text('确定', | ||
| 242 | + style: | ||
| 243 | + TextStyle(color: MyColours.color_199095)), | ||
| 244 | + ), | ||
| 245 | + onTap: () { | ||
| 246 | + print('确定 关闭弹框'); | ||
| 247 | + | ||
| 248 | + print(sYear); | ||
| 249 | + | ||
| 250 | + // print(sMonth); | ||
| 251 | + | ||
| 252 | + // print(sDay); | ||
| 253 | + | ||
| 254 | + // print(sTime); | ||
| 255 | + widget.callBack(sYear); | ||
| 256 | + Navigator.pop(context); | ||
| 257 | + }, | ||
| 258 | + )), | ||
| 259 | + ], | ||
| 260 | + )), | ||
| 261 | + VEmptyView(30), | ||
| 262 | + Row( | ||
| 263 | + mainAxisAlignment: MainAxisAlignment.spaceBetween, | ||
| 264 | + children: <Widget>[ | ||
| 265 | + Expanded( | ||
| 266 | + flex: 1, | ||
| 267 | + child: Container( | ||
| 268 | + height: ScreenUtil().setWidth(360), | ||
| 269 | + child: CupertinoPicker( | ||
| 270 | + useMagnifier: true, | ||
| 271 | + | ||
| 272 | + magnification: 1.3, | ||
| 273 | + | ||
| 274 | + squeeze: 1, | ||
| 275 | + | ||
| 276 | + diameterRatio: 1.5, | ||
| 277 | + | ||
| 278 | + looping: false, | ||
| 279 | + | ||
| 280 | + backgroundColor: Colors.transparent, //选择器背景色 | ||
| 281 | + | ||
| 282 | + itemExtent: ScreenUtil().setWidth(70), //item的高度 | ||
| 283 | + selectionOverlay: SizedBox(), | ||
| 284 | + onSelectedItemChanged: (index) { | ||
| 285 | + print('index === $index'); | ||
| 286 | + | ||
| 287 | + int selectYear = 1900 + index; | ||
| 288 | + | ||
| 289 | +// 更改年的时候,查询选中的年和月的天数 | ||
| 290 | + | ||
| 291 | + print("选中年 = ${selectYear}"); | ||
| 292 | + | ||
| 293 | + setState(() { | ||
| 294 | + sYear = '$selectYear'; | ||
| 295 | + | ||
| 296 | +// 更换年的时候检测是阳历还是农历 | ||
| 297 | + | ||
| 298 | + // updateDay(); | ||
| 299 | + | ||
| 300 | +// monthController.jumpToItem(3); | ||
| 301 | + }); | ||
| 302 | + }, | ||
| 303 | + | ||
| 304 | + scrollController: yearController, | ||
| 305 | + | ||
| 306 | + children: XZItem(yearList, '年'), | ||
| 307 | + ))), | ||
| 308 | + ]), | ||
| 309 | + VEmptyView(30), | ||
| 310 | + ]))); | ||
| 311 | + } | ||
| 312 | + | ||
| 313 | +// updateDay() { | ||
| 314 | +// if (widget.gongli) { | ||
| 315 | +// // 公历// 截取天数 | ||
| 316 | + | ||
| 317 | +// print('widget.sYear ==== ${sYear}'); | ||
| 318 | + | ||
| 319 | +// print('widget.sMonth ==== ${sMonth}'); | ||
| 320 | + | ||
| 321 | +// print('widget.sDay ==== ${sDay}'); | ||
| 322 | + | ||
| 323 | +// int count = getYangliDay(int.parse(sYear), int.parse(sMonth)); | ||
| 324 | + | ||
| 325 | +// print('count---$count'); | ||
| 326 | + | ||
| 327 | +// yday = []; | ||
| 328 | + | ||
| 329 | +// for (int m = 1; m < count + 1; m++) { | ||
| 330 | +// yday.add('$m'); | ||
| 331 | +// } | ||
| 332 | +// } else { | ||
| 333 | +// int count = getNongliDay(int.parse(sYear), int.parse(sMonth)); | ||
| 334 | + | ||
| 335 | +// print('农历的天数==${count}'); | ||
| 336 | + | ||
| 337 | +// List old = day; | ||
| 338 | + | ||
| 339 | +// List newDay = old.sublist(0, count); | ||
| 340 | + | ||
| 341 | +// print(old); | ||
| 342 | + | ||
| 343 | +// print(newDay); | ||
| 344 | + | ||
| 345 | +// day = newDay; | ||
| 346 | +// } | ||
| 347 | +// } | ||
| 348 | + | ||
| 349 | + List<Widget> XZItem(_data, type) { | ||
| 350 | + List<Widget> list = new List(); | ||
| 351 | + | ||
| 352 | + for (var i = 0; i < _data.length; i++) { | ||
| 353 | + list.add(Container( | ||
| 354 | + alignment: Alignment.center, | ||
| 355 | + child: Text('${_data[i]}$type', | ||
| 356 | + style: TextStyle( | ||
| 357 | + color: MyColours.color_333333, | ||
| 358 | + fontSize: ScreenUtil().setSp(28))), | ||
| 359 | + )); | ||
| 360 | + } | ||
| 361 | + | ||
| 362 | + return list; | ||
| 363 | + } | ||
| 364 | +} |
| @@ -121,7 +121,7 @@ class FTableItemState extends State<FTableItem> { | @@ -121,7 +121,7 @@ class FTableItemState extends State<FTableItem> { | ||
| 121 | // margin: EdgeInsets.all(ScreenUtil().setWidth(9)), | 121 | // margin: EdgeInsets.all(ScreenUtil().setWidth(9)), |
| 122 | decoration: BoxDecoration( | 122 | decoration: BoxDecoration( |
| 123 | color: widget.need && signStr == '已预订' && !isSelf | 123 | color: widget.need && signStr == '已预订' && !isSelf |
| 124 | - ? Color.fromRGBO(154, 23, 45, 1) | 124 | + ? MyColours.color_afbcc4 |
| 125 | : widget.canSelected && table.selected | 125 | : widget.canSelected && table.selected |
| 126 | ? MyColours.color_199095 | 126 | ? MyColours.color_199095 |
| 127 | : MyColours.color_ffffff, | 127 | : MyColours.color_ffffff, |
| @@ -152,13 +152,13 @@ class FTableItemState extends State<FTableItem> { | @@ -152,13 +152,13 @@ class FTableItemState extends State<FTableItem> { | ||
| 152 | table.name, | 152 | table.name, |
| 153 | maxLines: 1, | 153 | maxLines: 1, |
| 154 | style: TextStyle( | 154 | style: TextStyle( |
| 155 | - color: (widget.need && | ||
| 156 | - signStr == '已预订' && | ||
| 157 | - !isSelf) || | ||
| 158 | - (widget.canSelected && table.selected) | ||
| 159 | - ? MyColours.color_ffffff | ||
| 160 | - : MyColours.color_333333, | ||
| 161 | - fontSize: ScreenUtil().setSp(36), | 155 | + color: |
| 156 | + (widget.need && signStr == '已预订' && !isSelf) | ||
| 157 | + ? MyColours.color_333333 | ||
| 158 | + : (widget.canSelected && table.selected) | ||
| 159 | + ? MyColours.color_ffffff | ||
| 160 | + : MyColours.color_333333, | ||
| 161 | + fontSize: ScreenUtil().setSp(34), | ||
| 162 | decoration: TextDecoration.none, | 162 | decoration: TextDecoration.none, |
| 163 | fontWeight: FontWeight.bold), | 163 | fontWeight: FontWeight.bold), |
| 164 | overflow: TextOverflow.ellipsis, | 164 | overflow: TextOverflow.ellipsis, |
| @@ -199,10 +199,11 @@ class FTableItemState extends State<FTableItem> { | @@ -199,10 +199,11 @@ class FTableItemState extends State<FTableItem> { | ||
| 199 | : '') | 199 | : '') |
| 200 | : table.tableNum, | 200 | : table.tableNum, |
| 201 | style: TextStyle( | 201 | style: TextStyle( |
| 202 | - color: signStr == '已预订' && !isSelf || | ||
| 203 | - (widget.canSelected && table.selected) | ||
| 204 | - ? MyColours.color_ffffff | ||
| 205 | - : MyColours.color_353535, | 202 | + color: signStr == '已预订' && !isSelf |
| 203 | + ? MyColours.color_353535 | ||
| 204 | + : (widget.canSelected && table.selected) | ||
| 205 | + ? MyColours.color_ffffff | ||
| 206 | + : MyColours.color_353535, | ||
| 206 | fontSize: ScreenUtil().setSp(22), | 207 | fontSize: ScreenUtil().setSp(22), |
| 207 | decoration: TextDecoration.none, | 208 | decoration: TextDecoration.none, |
| 208 | fontWeight: FontWeight.normal), | 209 | fontWeight: FontWeight.normal), |
| @@ -220,7 +221,7 @@ class FTableItemState extends State<FTableItem> { | @@ -220,7 +221,7 @@ class FTableItemState extends State<FTableItem> { | ||
| 220 | ? '${table.nickName}订' | 221 | ? '${table.nickName}订' |
| 221 | : '', | 222 | : '', |
| 222 | style: TextStyle( | 223 | style: TextStyle( |
| 223 | - color: MyColours.color_ffffff, | 224 | + color: MyColours.color_353535, |
| 224 | fontSize: ScreenUtil().setSp(22), | 225 | fontSize: ScreenUtil().setSp(22), |
| 225 | decoration: TextDecoration.none, | 226 | decoration: TextDecoration.none, |
| 226 | fontWeight: FontWeight.normal), | 227 | fontWeight: FontWeight.normal), |
| @@ -237,12 +238,12 @@ class FTableItemState extends State<FTableItem> { | @@ -237,12 +238,12 @@ class FTableItemState extends State<FTableItem> { | ||
| 237 | padding: EdgeInsets.symmetric( | 238 | padding: EdgeInsets.symmetric( |
| 238 | horizontal: ScreenUtil().setWidth(10)), | 239 | horizontal: ScreenUtil().setWidth(10)), |
| 239 | decoration: BoxDecoration( | 240 | decoration: BoxDecoration( |
| 240 | - color: Color.fromRGBO(232, 141, 164, 1), | 241 | + color: MyColours.color_d7d7d7, |
| 241 | ), | 242 | ), |
| 242 | child: Text( | 243 | child: Text( |
| 243 | '新客', | 244 | '新客', |
| 244 | style: TextStyle( | 245 | style: TextStyle( |
| 245 | - color: MyColours.color_ffffff, | 246 | + color: MyColours.color_353535, |
| 246 | fontSize: ScreenUtil().setSp(24), | 247 | fontSize: ScreenUtil().setSp(24), |
| 247 | decoration: TextDecoration.none, | 248 | decoration: TextDecoration.none, |
| 248 | fontWeight: FontWeight.normal), | 249 | fontWeight: FontWeight.normal), |
-
Please register or login to post a comment