Browse Source

NullSafety: Migrate more UI widgets

Neeraj Gupta 2 years ago
parent
commit
015dae3193

+ 5 - 7
lib/ui/settings/about_section_widget.dart

@@ -1,5 +1,3 @@
-// @dart=2.9
-
 import 'package:flutter/material.dart';
 import 'package:photos/services/update_service.dart';
 import 'package:photos/theme/ente_theme.dart';
@@ -14,7 +12,7 @@ import 'package:photos/utils/toast_util.dart';
 import 'package:url_launcher/url_launcher.dart';
 
 class AboutSectionWidget extends StatelessWidget {
-  const AboutSectionWidget({Key key}) : super(key: key);
+  const AboutSectionWidget({Key? key}) : super(key: key);
 
   @override
   Widget build(BuildContext context) {
@@ -96,12 +94,12 @@ class AboutSectionWidget extends StatelessWidget {
 class AboutMenuItemWidget extends StatelessWidget {
   final String title;
   final String url;
-  final String webPageTitle;
+  final String? webPageTitle;
   const AboutMenuItemWidget({
-    @required this.title,
-    @required this.url,
+    required this.title,
+    required this.url,
     this.webPageTitle,
-    Key key,
+    Key? key,
   }) : super(key: key);
 
   @override

+ 1 - 3
lib/ui/settings/account_section_widget.dart

@@ -1,5 +1,3 @@
-// @dart=2.9
-
 import 'dart:async';
 
 import 'package:flutter/material.dart';
@@ -20,7 +18,7 @@ import 'package:photos/ui/settings/common_settings.dart';
 import 'package:photos/utils/navigation_util.dart';
 
 class AccountSectionWidget extends StatelessWidget {
-  const AccountSectionWidget({Key key}) : super(key: key);
+  const AccountSectionWidget({Key? key}) : super(key: key);
 
   @override
   Widget build(BuildContext context) {

+ 4 - 6
lib/ui/settings/app_version_widget.dart

@@ -1,11 +1,9 @@
-// @dart=2.9
-
 import 'package:flutter/material.dart';
 import 'package:package_info_plus/package_info_plus.dart';
 
 class AppVersionWidget extends StatefulWidget {
   const AppVersionWidget({
-    Key key,
+    Key? key,
   }) : super(key: key);
 
   @override
@@ -16,7 +14,7 @@ class _AppVersionWidgetState extends State<AppVersionWidget> {
   static const kTapThresholdForInspector = 5;
   static const kConsecutiveTapTimeWindowInMilliseconds = 2000;
 
-  int _lastTap;
+  int? _lastTap;
   int _consecutiveTaps = 0;
 
   @override
@@ -35,14 +33,14 @@ class _AppVersionWidgetState extends State<AppVersionWidget> {
         }
         _lastTap = now;
       },
-      child: FutureBuilder(
+      child: FutureBuilder<String>(
         future: _getAppVersion(),
         builder: (context, snapshot) {
           if (snapshot.hasData) {
             return Padding(
               padding: const EdgeInsets.all(20),
               child: Text(
-                "Version: " + snapshot.data,
+                "Version: " + snapshot.data!,
                 style: Theme.of(context).textTheme.caption,
               ),
             );