Jelajahi Sumber

NullSafety: Migrate more UI widgets

Neeraj Gupta 2 tahun lalu
induk
melakukan
454e700c81

+ 3 - 5
lib/ui/collections/device_folder_icon_widget.dart

@@ -1,5 +1,3 @@
-// @dart=2.9
-
 import 'package:flutter/material.dart';
 import 'package:photos/ente_theme_data.dart';
 import 'package:photos/models/device_collection.dart';
@@ -12,7 +10,7 @@ class DeviceFolderIcon extends StatelessWidget {
   final DeviceCollection deviceCollection;
   const DeviceFolderIcon(
     this.deviceCollection, {
-    Key key,
+    Key? key,
   }) : super(key: key);
 
   @override
@@ -35,7 +33,7 @@ class DeviceFolderIcon extends StatelessWidget {
                   child: Hero(
                     tag: "device_folder:" +
                         deviceCollection.name +
-                        deviceCollection.thumbnail.tag,
+                        deviceCollection.thumbnail!.tag,
                     child: Stack(
                       children: [
                         ThumbnailWidget(
@@ -44,7 +42,7 @@ class DeviceFolderIcon extends StatelessWidget {
                           key: Key(
                             "device_folder:" +
                                 deviceCollection.name +
-                                deviceCollection.thumbnail.tag,
+                                deviceCollection.thumbnail!.tag,
                           ),
                         ),
                         isBackedUp ? Container() : const UnSyncedIcon(),

+ 5 - 7
lib/ui/collections/trash_button_widget.dart

@@ -1,5 +1,3 @@
-// @dart=2.9
-
 import 'dart:async';
 
 import 'package:flutter/material.dart';
@@ -12,7 +10,7 @@ import 'package:photos/utils/navigation_util.dart';
 class TrashButtonWidget extends StatefulWidget {
   const TrashButtonWidget(
     this.textStyle, {
-    Key key,
+    Key? key,
   }) : super(key: key);
 
   final TextStyle textStyle;
@@ -22,7 +20,7 @@ class TrashButtonWidget extends StatefulWidget {
 }
 
 class _TrashButtonWidgetState extends State<TrashButtonWidget> {
-  StreamSubscription<TrashUpdatedEvent> _trashUpdatedEventSubscription;
+  late StreamSubscription<TrashUpdatedEvent> _trashUpdatedEventSubscription;
 
   @override
   void initState() {
@@ -37,7 +35,7 @@ class _TrashButtonWidgetState extends State<TrashButtonWidget> {
 
   @override
   void dispose() {
-    _trashUpdatedEventSubscription?.cancel();
+    _trashUpdatedEventSubscription.cancel();
     super.dispose();
   }
 
@@ -52,7 +50,7 @@ class _TrashButtonWidgetState extends State<TrashButtonWidget> {
         padding: const EdgeInsets.all(0),
         side: BorderSide(
           width: 0.5,
-          color: Theme.of(context).iconTheme.color.withOpacity(0.24),
+          color: Theme.of(context).iconTheme.color!.withOpacity(0.24),
         ),
       ),
       child: SizedBox(
@@ -73,7 +71,7 @@ class _TrashButtonWidgetState extends State<TrashButtonWidget> {
                   FutureBuilder<int>(
                     future: TrashDB.instance.count(),
                     builder: (context, snapshot) {
-                      if (snapshot.hasData && snapshot.data > 0) {
+                      if (snapshot.hasData && snapshot.data! > 0) {
                         return RichText(
                           text: TextSpan(
                             style: widget.textStyle,