diff --git a/lib/main.dart b/lib/main.dart index 11655b6..008fa38 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -1,10 +1,12 @@ import 'package:flutter/material.dart'; void main() { - runApp(MyApp()); + runApp(const MyApp()); } class MyApp extends StatelessWidget { + const MyApp({super.key}); + // This widget is the root of your application. @override Widget build(BuildContext context) { @@ -21,18 +23,14 @@ class MyApp extends StatelessWidget { // Notice that the counter didn't reset back to zero; the application // is not restarted. primarySwatch: Colors.blue, - // This makes the visual density adapt to the platform that you run - // the app on. For desktop platforms, the controls will be smaller and - // closer together (more dense) than on mobile platforms. - visualDensity: VisualDensity.adaptivePlatformDensity, ), - home: MyHomePage(title: 'Flutter Demo Home Page'), + home: const MyHomePage(title: 'Flutter Demo Home Page'), ); } } class MyHomePage extends StatefulWidget { - MyHomePage({Key key, this.title}) : super(key: key); + const MyHomePage({super.key, required this.title}); // This widget is the home page of your application. It is stateful, meaning // that it has a State object (defined below) that contains fields that affect @@ -46,7 +44,7 @@ class MyHomePage extends StatefulWidget { final String title; @override - _MyHomePageState createState() => _MyHomePageState(); + State createState() => _MyHomePageState(); } class _MyHomePageState extends State { @@ -97,12 +95,12 @@ class _MyHomePageState extends State { // horizontal). mainAxisAlignment: MainAxisAlignment.center, children: [ - Text( + const Text( 'You have pushed the button this many times:', ), Text( '$_counter', - style: Theme.of(context).textTheme.headline4, + style: Theme.of(context).textTheme.headlineMedium, ), ], ), @@ -110,7 +108,7 @@ class _MyHomePageState extends State { floatingActionButton: FloatingActionButton( onPressed: _incrementCounter, tooltip: 'Increment', - child: Icon(Icons.add), + child: const Icon(Icons.add), ), // This trailing comma makes auto-formatting nicer for build methods. ); } diff --git a/lib/models/post_model.dart b/lib/models/post_model.dart index 2520274..be04c1c 100644 --- a/lib/models/post_model.dart +++ b/lib/models/post_model.dart @@ -1,22 +1,21 @@ -import 'package:meta/meta.dart'; import 'package:flutter_facebook_responsive_ui/models/models.dart'; class Post { final User user; final String caption; final String timeAgo; - final String imageUrl; + final String? imageUrl; final int likes; final int comments; final int shares; const Post({ - @required this.user, - @required this.caption, - @required this.timeAgo, - @required this.imageUrl, - @required this.likes, - @required this.comments, - @required this.shares, + required this.user, + required this.caption, + required this.timeAgo, + this.imageUrl, + required this.likes, + required this.comments, + required this.shares, }); } diff --git a/lib/models/story_model.dart b/lib/models/story_model.dart index c54b0ef..2237514 100644 --- a/lib/models/story_model.dart +++ b/lib/models/story_model.dart @@ -1,4 +1,3 @@ -import 'package:meta/meta.dart'; import 'package:flutter_facebook_responsive_ui/models/models.dart'; class Story { @@ -7,8 +6,8 @@ class Story { final bool isViewed; const Story({ - @required this.user, - @required this.imageUrl, + required this.user, + required this.imageUrl, this.isViewed = false, }); } diff --git a/lib/models/user_model.dart b/lib/models/user_model.dart index edaed23..b9dd8c1 100644 --- a/lib/models/user_model.dart +++ b/lib/models/user_model.dart @@ -1,11 +1,9 @@ -import 'package:meta/meta.dart'; - class User { final String name; final String imageUrl; const User({ - @required this.name, - @required this.imageUrl, + required this.name, + required this.imageUrl, }); } diff --git a/pubspec.lock b/pubspec.lock index be2a772..e49c7d0 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -7,14 +7,14 @@ packages: name: async url: "https://pub.dartlang.org" source: hosted - version: "2.4.2" + version: "2.9.0" boolean_selector: dependency: transitive description: name: boolean_selector url: "https://pub.dartlang.org" source: hosted - version: "2.0.0" + version: "2.1.0" cached_network_image: dependency: "direct main" description: @@ -28,7 +28,7 @@ packages: name: characters url: "https://pub.dartlang.org" source: hosted - version: "1.0.0" + version: "1.2.1" charcode: dependency: transitive description: @@ -42,14 +42,14 @@ packages: name: clock url: "https://pub.dartlang.org" source: hosted - version: "1.0.1" + version: "1.1.1" collection: dependency: transitive description: name: collection url: "https://pub.dartlang.org" source: hosted - version: "1.14.13" + version: "1.16.0" convert: dependency: transitive description: @@ -77,7 +77,7 @@ packages: name: fake_async url: "https://pub.dartlang.org" source: hosted - version: "1.1.0" + version: "1.3.1" file: dependency: transitive description: @@ -129,7 +129,14 @@ packages: name: matcher url: "https://pub.dartlang.org" source: hosted - version: "0.12.8" + version: "0.12.12" + material_color_utilities: + dependency: transitive + description: + name: material_color_utilities + url: "https://pub.dartlang.org" + source: hosted + version: "0.2.0" material_design_icons_flutter: dependency: "direct main" description: @@ -143,14 +150,14 @@ packages: name: meta url: "https://pub.dartlang.org" source: hosted - version: "1.1.8" + version: "1.8.0" path: dependency: transitive description: name: path url: "https://pub.dartlang.org" source: hosted - version: "1.7.0" + version: "1.8.2" path_provider: dependency: transitive description: @@ -225,7 +232,7 @@ packages: name: source_span url: "https://pub.dartlang.org" source: hosted - version: "1.7.0" + version: "1.9.1" sqflite: dependency: transitive description: @@ -246,21 +253,21 @@ packages: name: stack_trace url: "https://pub.dartlang.org" source: hosted - version: "1.9.5" + version: "1.10.0" stream_channel: dependency: transitive description: name: stream_channel url: "https://pub.dartlang.org" source: hosted - version: "2.0.0" + version: "2.1.1" string_scanner: dependency: transitive description: name: string_scanner url: "https://pub.dartlang.org" source: hosted - version: "1.0.5" + version: "1.1.1" synchronized: dependency: transitive description: @@ -274,14 +281,14 @@ packages: name: term_glyph url: "https://pub.dartlang.org" source: hosted - version: "1.1.0" + version: "1.2.1" test_api: dependency: transitive description: name: test_api url: "https://pub.dartlang.org" source: hosted - version: "0.2.17" + version: "0.4.14" typed_data: dependency: transitive description: @@ -302,7 +309,7 @@ packages: name: vector_math url: "https://pub.dartlang.org" source: hosted - version: "2.0.8" + version: "2.1.4" xdg_directories: dependency: transitive description: @@ -311,5 +318,5 @@ packages: source: hosted version: "0.1.0" sdks: - dart: ">=2.9.0-14.0.dev <3.0.0" - flutter: ">=1.12.13+hotfix.5 <2.0.0" + dart: ">=2.19.0-240.0.dev <3.0.0" + flutter: ">=1.12.13+hotfix.5" diff --git a/pubspec.yaml b/pubspec.yaml index 2c5e97a..b01624b 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -18,7 +18,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev version: 1.0.0+1 environment: - sdk: '>=2.7.0 <3.0.0' + sdk: '>=2.19.0-240.0.dev <3.0.0' dependencies: flutter: