mirror of
https://github.com/GitJournal/GitJournal.git
synced 2025-06-27 01:02:14 +08:00
Port a few widgets to null safety
This commit is contained in:
@ -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) {
|
||||
|
@ -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,
|
||||
|
@ -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;
|
||||
|
Reference in New Issue
Block a user