diff --git a/lib/model/note.dart b/lib/model/note.dart index b6b1e6b..7ad3974 100644 --- a/lib/model/note.dart +++ b/lib/model/note.dart @@ -15,11 +15,9 @@ enum NoteState { Normal, Archived, Trashed } enum NoteSort { Title, LastModified } @immutable -/** - * Represents a note file. - * - * The file name is always in the form `.<tags>.<state>.<extension>`. - */ +/// Represents a note file. +/// +/// The file name is always in the form `<title>.<tags>.<state>.<extension>`. class Note { final File file; final List<String> _basenameParts; diff --git a/lib/route/main.dart b/lib/route/main.dart index 7b01481..7598c56 100644 --- a/lib/route/main.dart +++ b/lib/route/main.dart @@ -96,7 +96,7 @@ class _MainScreenState extends State<MainScreen> { onPressed: () { final snackBar = SnackBar(content: Text('Create new file.')); - Scaffold.of(context).showSnackBar(snackBar); + ScaffoldMessenger.of(context).showSnackBar(snackBar); }, label: Text('New draft'.toUpperCase()), icon: Icon(TxtIcons.add), diff --git a/lib/route/themes.dart b/lib/route/themes.dart index 5ae56b4..454bb91 100644 --- a/lib/route/themes.dart +++ b/lib/route/themes.dart @@ -75,7 +75,7 @@ class _ColorSchemeCard extends StatelessWidget { this.subtitle, this.description, this.icon, - }); + }) : super(key: key); _isThemeSelected(BuildContext context) { return AppTheme.of(context).colorScheme == colorScheme; @@ -108,7 +108,7 @@ class _ColorSchemeCard extends StatelessWidget { padding: EdgeInsets.only(bottom: 16, left: 16, right: 16), child: Text( subtitle, - style: Theme.of(context).textTheme.subtitle, + style: Theme.of(context).textTheme.subtitle2, ), ), ); @@ -119,7 +119,7 @@ class _ColorSchemeCard extends StatelessWidget { padding: EdgeInsets.only(bottom: 16, left: 16, right: 16), child: Text( description, - style: Theme.of(context).textTheme.body1, + style: Theme.of(context).textTheme.bodyText2, ), ), ); diff --git a/lib/widget/stadium_border_notched_rectangle.dart b/lib/widget/stadium_border_notched_rectangle.dart index c397b9d..1df7807 100644 --- a/lib/widget/stadium_border_notched_rectangle.dart +++ b/lib/widget/stadium_border_notched_rectangle.dart @@ -50,27 +50,30 @@ class StadiumBorderNotchedRectangle implements NotchedShape { final double p2yA = sqrt(r * r - p2xA * p2xA); final double p2yB = sqrt(r * r - p2xB * p2xB); - final List<Offset> p = List<Offset>(6); - // p0, p1, and p2 are the control points for segment A. - p[0] = Offset(a - s1, b); - p[1] = Offset(a, b); - final double cmp = b < 0 ? -1.0 : 1.0; - p[2] = cmp * p2yA > cmp * p2yB ? Offset(p2xA, p2yA) : Offset(p2xB, p2yB); + Offset p0 = Offset(a - s1, b); + Offset p1 = Offset(a, b); + double cmp = b < 0 ? -1.0 : 1.0; + Offset p2 = cmp * p2yA > cmp * p2yB ? Offset(p2xA, p2yA) : Offset(p2xB, p2yB); // p3, p4, and p5 are the control points for segment B, which is a mirror // of segment A around the y axis. - p[3] = Offset(-1.0 * p[2].dx, p[2].dy); - p[4] = Offset(-1.0 * p[1].dx, p[1].dy); - p[5] = Offset(-1.0 * p[0].dx, p[0].dy); + Offset p3 = Offset(-1.0 * p2.dx, p2.dy); + Offset p4 = Offset(-1.0 * p1.dx, p1.dy); + Offset p5 = Offset(-1.0 * p0.dx, p0.dy); // translate all points back to the absolute coordinate system. - for (int i = 0; i < p.length; i += 1) p[i] += guest.center; + p0 += guest.center; + p1 += guest.center; + p2 += guest.center; + p3 += guest.center; + p4 += guest.center; + p5 += guest.center; return Path() ..moveTo(host.left, host.top) - ..lineTo(p[0].dx, p[0].dy) - ..quadraticBezierTo(p[1].dx, p[1].dy, p[2].dx, p[2].dy) + ..lineTo(p0.dx, p0.dy) + ..quadraticBezierTo(p1.dx, p1.dy, p2.dx, p2.dy) ..arcToPoint( guest.bottomLeft + Offset(guest.height / 2, 0), radius: Radius.circular(guest.height / 2), @@ -78,11 +81,11 @@ class StadiumBorderNotchedRectangle implements NotchedShape { ) ..lineTo(guest.right - guest.height / 2, guest.bottom) ..arcToPoint( - p[3], + p3, radius: Radius.circular(guest.height / 2), clockwise: false, ) - ..quadraticBezierTo(p[4].dx, p[4].dy, p[5].dx, p[5].dy) + ..quadraticBezierTo(p4.dx, p4.dy, p5.dx, p5.dy) ..lineTo(host.right, host.top) ..lineTo(host.right, host.bottom) ..lineTo(host.left, host.bottom)