From 175ef0a7d1495c7ad9d4fa7be75be7f115c5145c Mon Sep 17 00:00:00 2001 From: Sasikumar Arumugam Date: Wed, 7 Apr 2021 15:54:55 +0530 Subject: [PATCH] FLUT-4313-Sample updated with null safety. --- lib/main.dart | 57 ++++++++++++++++++++++----------------------------- pubspec.lock | 53 +++++++++++++++++++++-------------------------- pubspec.yaml | 6 +++--- 3 files changed, 50 insertions(+), 66 deletions(-) diff --git a/lib/main.dart b/lib/main.dart index a5abd86..3231de2 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -23,40 +23,31 @@ class ViewHeaderCustomization extends StatefulWidget { _ViewHeaderCustomizationState(); } -List _days = ['S', 'M', 'T', 'W', 'T', 'F', 'S']; -List _icons = [ - Icon( - Icons.ac_unit, - color: Colors.black, - ), - Icon(Icons.wb_sunny, color: Colors.amber), - Icon( - Icons.wb_incandescent, - color: Color(0xFF0ba0000), - ), - Icon(Icons.wb_auto, color: Colors.orange), - Icon(Icons.wb_cloudy, color: Colors.grey), - Icon(Icons.wb_sunny, color: Colors.amber), - Icon( - Icons.wb_incandescent, - color: Color(0xFF0ba0000), - ) -]; - class _ViewHeaderCustomizationState extends State { - double _width, _cellWidth; - - @override - void initState() { - _width = 0.0; - _cellWidth = 0.0; - super.initState(); - } + final List _days = ['S', 'M', 'T', 'W', 'T', 'F', 'S']; + final List _icons = [ + Icon( + Icons.ac_unit, + color: Colors.black, + ), + Icon(Icons.wb_sunny, color: Colors.amber), + Icon( + Icons.wb_incandescent, + color: Color(0xFF0ba0000), + ), + Icon(Icons.wb_auto, color: Colors.orange), + Icon(Icons.wb_cloudy, color: Colors.grey), + Icon(Icons.wb_sunny, color: Colors.amber), + Icon( + Icons.wb_incandescent, + color: Color(0xFF0ba0000), + ) + ]; @override Widget build(BuildContext context) { - _width = MediaQuery.of(context).size.width; - _cellWidth = _width / 9; + final double width = MediaQuery.of(context).size.width; + final double cellWidth = width / 9; return Scaffold( body: SafeArea( @@ -68,8 +59,8 @@ class _ViewHeaderCustomizationState extends State { scrollDirection: Axis.horizontal, itemBuilder: (BuildContext ctxt, int index) { return Container( - padding: const EdgeInsets.only(left: 15,top: 5), - width: _cellWidth, + padding: const EdgeInsets.only(left: 15, top: 5), + width: cellWidth, height: 5, color: Colors.lightGreen, child: Text(_days[index]), @@ -82,7 +73,7 @@ class _ViewHeaderCustomizationState extends State { itemBuilder: (BuildContext ctxt, int index) { return Container( padding: const EdgeInsets.only(left: 5), - width: _cellWidth, + width: cellWidth, child: _icons[index], ); }), diff --git a/pubspec.lock b/pubspec.lock index b2b7c73..8687735 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -7,56 +7,56 @@ packages: name: async url: "https://pub.dartlang.org" source: hosted - version: "2.5.0-nullsafety.1" + version: "2.5.0" boolean_selector: dependency: transitive description: name: boolean_selector url: "https://pub.dartlang.org" source: hosted - version: "2.1.0-nullsafety.1" + version: "2.1.0" characters: dependency: transitive description: name: characters url: "https://pub.dartlang.org" source: hosted - version: "1.1.0-nullsafety.3" + version: "1.1.0" charcode: dependency: transitive description: name: charcode url: "https://pub.dartlang.org" source: hosted - version: "1.2.0-nullsafety.1" + version: "1.2.0" clock: dependency: transitive description: name: clock url: "https://pub.dartlang.org" source: hosted - version: "1.1.0-nullsafety.1" + version: "1.1.0" collection: dependency: transitive description: name: collection url: "https://pub.dartlang.org" source: hosted - version: "1.15.0-nullsafety.3" + version: "1.15.0" cupertino_icons: dependency: "direct main" description: name: cupertino_icons url: "https://pub.dartlang.org" source: hosted - version: "1.0.0" + version: "1.0.2" fake_async: dependency: transitive description: name: fake_async url: "https://pub.dartlang.org" source: hosted - version: "1.2.0-nullsafety.1" + version: "1.2.0" flutter: dependency: "direct main" description: flutter @@ -73,35 +73,28 @@ packages: name: intl url: "https://pub.dartlang.org" source: hosted - version: "0.16.1" + version: "0.17.0" matcher: dependency: transitive description: name: matcher url: "https://pub.dartlang.org" source: hosted - version: "0.12.10-nullsafety.1" + version: "0.12.10" meta: dependency: transitive description: name: meta url: "https://pub.dartlang.org" source: hosted - version: "1.3.0-nullsafety.4" + version: "1.3.0" path: dependency: transitive description: name: path url: "https://pub.dartlang.org" source: hosted - version: "1.8.0-nullsafety.1" - pedantic: - dependency: transitive - description: - name: pedantic - url: "https://pub.dartlang.org" - source: hosted - version: "1.9.2" + version: "1.8.0" sky_engine: dependency: transitive description: flutter @@ -113,69 +106,69 @@ packages: name: source_span url: "https://pub.dartlang.org" source: hosted - version: "1.8.0-nullsafety.2" + version: "1.8.1" stack_trace: dependency: transitive description: name: stack_trace url: "https://pub.dartlang.org" source: hosted - version: "1.10.0-nullsafety.2" + version: "1.10.0" stream_channel: dependency: transitive description: name: stream_channel url: "https://pub.dartlang.org" source: hosted - version: "2.1.0-nullsafety.1" + version: "2.1.0" string_scanner: dependency: transitive description: name: string_scanner url: "https://pub.dartlang.org" source: hosted - version: "1.1.0-nullsafety.1" + version: "1.1.0" syncfusion_flutter_core: dependency: transitive description: name: syncfusion_flutter_core url: "https://pub.dartlang.org" source: hosted - version: "18.3.47" + version: "19.1.55" syncfusion_flutter_datepicker: dependency: "direct main" description: name: syncfusion_flutter_datepicker url: "https://pub.dartlang.org" source: hosted - version: "18.3.47-beta" + version: "19.1.55-beta" term_glyph: dependency: transitive description: name: term_glyph url: "https://pub.dartlang.org" source: hosted - version: "1.2.0-nullsafety.1" + version: "1.2.0" test_api: dependency: transitive description: name: test_api url: "https://pub.dartlang.org" source: hosted - version: "0.2.19-nullsafety.2" + version: "0.2.19" typed_data: dependency: transitive description: name: typed_data url: "https://pub.dartlang.org" source: hosted - version: "1.3.0-nullsafety.3" + version: "1.3.0" vector_math: dependency: transitive description: name: vector_math url: "https://pub.dartlang.org" source: hosted - version: "2.1.0-nullsafety.3" + version: "2.1.0" sdks: - dart: ">=2.10.0-110 <=2.11.0-213.1.beta" + dart: ">=2.12.0 <3.0.0" diff --git a/pubspec.yaml b/pubspec.yaml index ce857ee..6d5469c 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -18,17 +18,17 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev version: 1.0.0+1 environment: - sdk: ">=2.7.0 <3.0.0" + sdk: '>=2.12.0 <3.0.0' dependencies: flutter: sdk: flutter - syncfusion_flutter_datepicker: 18.3.47-beta + syncfusion_flutter_datepicker: ^19.1.55-beta # The following adds the Cupertino Icons font to your application. # Use with the CupertinoIcons class for iOS style icons. - cupertino_icons: ^1.0.0 + cupertino_icons: ^1.0.2 dev_dependencies: flutter_test: