Port a few widgets to null safety

This commit is contained in:
Vishesh Handa
2021-05-17 16:37:26 +02:00
parent 74fd96fa50
commit 8d4de537e7
3 changed files with 21 additions and 27 deletions

View File

@ -1,5 +1,3 @@
// @dart=2.9
import 'package:flutter/material.dart';
class HighlightedText extends StatelessWidget {
@ -8,15 +6,15 @@ class HighlightedText extends StatelessWidget {
final String highlightTextLowerCase;
final TextStyle style;
final TextStyle highlightStyle;
final TextOverflow overflow;
final int maxLines;
final TextStyle? highlightStyle;
final TextOverflow? overflow;
final int? maxLines;
HighlightedText({
@required this.text,
@required this.highlightText,
@required this.highlightTextLowerCase,
@required this.style,
required this.text,
required this.highlightText,
required this.highlightTextLowerCase,
required this.style,
this.highlightStyle,
this.overflow,
this.maxLines,
@ -61,14 +59,14 @@ class HighlightTextSpan {
final String highlightTextLowerCase;
final TextStyle style;
final TextStyle highlightStyle;
TextStyle? highlightStyle;
HighlightTextSpan({
@required this.text,
@required this.highlightText,
@required this.highlightTextLowerCase,
@required this.style,
this.highlightStyle,
required this.text,
required this.highlightText,
required this.highlightTextLowerCase,
required this.style,
required this.highlightStyle,
});
List<InlineSpan> build(BuildContext context) {

View File

@ -1,5 +1,3 @@
// @dart=2.9
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
@ -8,11 +6,11 @@ class IconDismissable extends Dismissible {
final IconData iconData;
IconDismissable({
@required Key key,
@required this.backgroundColor,
@required this.iconData,
@required Function onDismissed,
@required Widget child,
required Key key,
required this.backgroundColor,
required this.iconData,
required Function(DismissDirection) onDismissed,
required Widget child,
}) : super(
key: key,
child: child,

View File

@ -1,5 +1,3 @@
// @dart=2.9
import 'package:flutter/material.dart';
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
@ -15,13 +13,13 @@ class MarkdownToolBar extends StatelessWidget {
final TextEditingController textController;
MarkdownToolBar({
@required this.textController,
required this.textController,
});
@override
Widget build(BuildContext context) {
var textTheme = Theme.of(context).textTheme;
var style = textTheme.bodyText2.copyWith(fontWeight: FontWeight.bold);
var style = textTheme.bodyText2!.copyWith(fontWeight: FontWeight.bold);
return Container(
child: Row(
@ -151,7 +149,7 @@ TextEditingValue modifyCurrentLine(
for (var blockTagRegExp in _allowedBlockRegExps) {
var match = blockTagRegExp.matchAsPrefix(text, lineStartPos);
if (match != null) {
var blockTag = match.group(0);
var blockTag = match.group(0)!;
var newVal = _removeFromLine(text, cursorPos, lineStartPos, blockTag);
if (blockTag == char) {
return newVal;