1
0
mirror of https://gitlab.com/comunic/comunicmobile synced 2024-10-23 06:53:23 +00:00

Continue to fix deprecation warnings

This commit is contained in:
Pierre HUBERT 2021-03-13 15:28:34 +01:00
parent 819e2a7590
commit 230cb2c018
13 changed files with 32 additions and 28 deletions

View File

@ -174,9 +174,7 @@ class __CreateAccountRouteBodyState extends State<_CreateAccountRouteBody> {
// Submit button // Submit button
Center( Center(
child: RaisedButton( child: ElevatedButton(
color: Colors.blue,
textColor: Colors.white,
onPressed: _submitForm, onPressed: _submitForm,
child: Text("Submit"), child: Text("Submit"),
), ),

View File

@ -61,7 +61,7 @@ class _ResetPasswordBodyState extends SafeState<_ResetPasswordBody> {
/// Step 3b - Answer security questions /// Step 3b - Answer security questions
List<String> _questions; List<String> _questions;
var _questionsControllers = List<TextEditingController>(); var _questionsControllers = <TextEditingController>[];
List<String> get _answers => List<String> get _answers =>
_questionsControllers.map((f) => f.text).toList(); _questionsControllers.map((f) => f.text).toList();

View File

@ -127,7 +127,7 @@ class _LoginRouteState extends State<LoginRoute> {
padding: EdgeInsets.all(8.0), padding: EdgeInsets.all(8.0),
child: _loading child: _loading
? CircularProgressIndicator() ? CircularProgressIndicator()
: RaisedButton( : ElevatedButton(
child: Text(tr("Sign in")), child: Text(tr("Sign in")),
onPressed: valid ? () => _submitForm(context) : null, onPressed: valid ? () => _submitForm(context) : null,
), ),

View File

@ -37,7 +37,7 @@ mixin MainRoute implements StatefulWidget {}
/// Public interface of home controller /// Public interface of home controller
abstract class MainController extends State<MainRoute> { abstract class MainController extends State<MainRoute> {
final _pagesStack = List<PageInfo>(); final _pagesStack = <PageInfo>[];
/// Default page of the application /// Default page of the application
PageInfo get defaultPage; PageInfo get defaultPage;

View File

@ -77,7 +77,7 @@ class __PasswordResetBodyState extends SafeState<_PasswordResetBody> {
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
children: <Widget>[ children: <Widget>[
Text(tr("You can choose a new password.")), Text(tr("You can choose a new password.")),
OutlineButton( OutlinedButton(
onPressed: _changePassword, onPressed: _changePassword,
child: Text(tr("Choose a new password")), child: Text(tr("Choose a new password")),
) )
@ -97,7 +97,7 @@ class __PasswordResetBodyState extends SafeState<_PasswordResetBody> {
tr("Congratulations! Your password has now been successfully changed!"), tr("Congratulations! Your password has now been successfully changed!"),
textAlign: TextAlign.center, textAlign: TextAlign.center,
), ),
OutlineButton( OutlinedButton(
onPressed: _quitScreen, onPressed: _quitScreen,
child: Text(tr("Login")), child: Text(tr("Login")),
) )

View File

@ -544,7 +544,7 @@ class _CallScreenState extends SafeState<CallScreen> {
.where((f) => f.hasVideoStream && _renderers.containsKey(f.userID)) .where((f) => f.hasVideoStream && _renderers.containsKey(f.userID))
.toList(); .toList();
final rows = List<Row>(); final rows = <Row>[];
var numberRows = sqrt(availableVideos.length).ceil(); var numberRows = sqrt(availableVideos.length).ceil();
var numberCols = numberRows; var numberCols = numberRows;

View File

@ -355,7 +355,7 @@ class _ConversationScreenState extends SafeState<ConversationScreen> {
//Check the result of the operation //Check the result of the operation
if (result != SendMessageResult.SUCCESS) if (result != SendMessageResult.SUCCESS)
Scaffold.of(context).showSnackBar( ScaffoldMessenger.of(context).showSnackBar(
SnackBar( SnackBar(
content: Text( content: Text(
result == SendMessageResult.MESSAGE_REJECTED result == SendMessageResult.MESSAGE_REJECTED
@ -637,7 +637,7 @@ class _ConversationScreenState extends SafeState<ConversationScreen> {
Spacer(flex: 1), Spacer(flex: 1),
Text("${(_sendProgress * 100).toInt()}%"), Text("${(_sendProgress * 100).toInt()}%"),
Spacer(flex: 1), Spacer(flex: 1),
OutlineButton( OutlinedButton(
onPressed: () => _sendCancel.cancel(), onPressed: () => _sendCancel.cancel(),
child: Text(tr("Cancel").toUpperCase()), child: Text(tr("Cancel").toUpperCase()),
), ),
@ -724,13 +724,13 @@ class _ConversationScreenState extends SafeState<ConversationScreen> {
textAlign: TextAlign.justify, textAlign: TextAlign.justify,
), ),
actions: <Widget>[ actions: <Widget>[
FlatButton( TextButton(
child: Text( child: Text(
tr("Cancel").toUpperCase(), tr("Cancel").toUpperCase(),
), ),
onPressed: () => Navigator.pop(c, false), onPressed: () => Navigator.pop(c, false),
), ),
FlatButton( TextButton(
child: Text( child: Text(
tr("Confirm").toUpperCase(), tr("Confirm").toUpperCase(),
style: TextStyle(color: Colors.red), style: TextStyle(color: Colors.red),

View File

@ -87,7 +87,7 @@ class _ConversationScreenState extends SafeState<ConversationsListScreen> {
return buildErrorCard( return buildErrorCard(
tr("Could not retrieve the list of conversations!"), tr("Could not retrieve the list of conversations!"),
actions: <Widget>[ actions: <Widget>[
FlatButton( TextButton(
onPressed: () => _refreshIndicatorKey.currentState.show(), onPressed: () => _refreshIndicatorKey.currentState.show(),
child: Text( child: Text(
tr("Retry").toUpperCase(), tr("Retry").toUpperCase(),
@ -138,7 +138,7 @@ class _ConversationScreenState extends SafeState<ConversationsListScreen> {
await _conversationsHelper.deleteConversation(conversation.id); await _conversationsHelper.deleteConversation(conversation.id);
} catch (e, s) { } catch (e, s) {
print("Failed to leave conversation! $e => $s"); print("Failed to leave conversation! $e => $s");
Scaffold.of(context).showSnackBar( ScaffoldMessenger.of(context).showSnackBar(
SnackBar(content: Text(tr("Could not leave the conversation!")))); SnackBar(content: Text(tr("Could not leave the conversation!"))));
} }

View File

@ -91,7 +91,7 @@ class _FriendsListScreenState extends SafeState<FriendsListScreen> {
Widget _buildError() => buildErrorCard( Widget _buildError() => buildErrorCard(
tr("Could not load your list of friends!"), tr("Could not load your list of friends!"),
actions: [ actions: [
FlatButton( TextButton(
onPressed: _refreshList, onPressed: _refreshList,
child: Text( child: Text(
tr("Retry").toUpperCase(), tr("Retry").toUpperCase(),
@ -171,11 +171,11 @@ class _FriendsListScreenState extends SafeState<FriendsListScreen> {
content: Text(tr( content: Text(tr(
"Are you sure do you want to remove this friend from your list of friends ? A friendship request will have to be sent to get this user back to your list!")), "Are you sure do you want to remove this friend from your list of friends ? A friendship request will have to be sent to get this user back to your list!")),
actions: <Widget>[ actions: <Widget>[
FlatButton( TextButton(
onPressed: () => Navigator.pop(context, false), onPressed: () => Navigator.pop(context, false),
child: Text(tr("Cancel").toUpperCase()), child: Text(tr("Cancel").toUpperCase()),
), ),
FlatButton( TextButton(
onPressed: () => Navigator.pop(context, true), onPressed: () => Navigator.pop(context, true),
child: Text( child: Text(
tr("Confirm").toUpperCase(), tr("Confirm").toUpperCase(),

View File

@ -97,7 +97,7 @@ class _OtherUserFriendsListScreenState
"Could not get the list of friends of this user !", "Could not get the list of friends of this user !",
), ),
actions: [ actions: [
FlatButton( TextButton(
child: Text( child: Text(
tr("Try again").toUpperCase(), tr("Try again").toUpperCase(),
style: TextStyle(color: Colors.white), style: TextStyle(color: Colors.white),

View File

@ -337,17 +337,19 @@ class _UpdateConversationScreen extends State<UpdateConversationScreen> {
? Row( ? Row(
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
children: [ children: [
OutlineButton( OutlinedButton(
onPressed: _uploadNewLogo, onPressed: _uploadNewLogo,
child: Text(tr("Change logo")), child: Text(tr("Change logo")),
), ),
SizedBox(width: 5), SizedBox(width: 5),
_image == null _image == null
? Container() ? Container()
: OutlineButton( : ElevatedButton(
onPressed: _deleteLogo, onPressed: _deleteLogo,
child: Text(tr("Delete logo")), child: Text(tr("Delete logo")),
highlightedBorderColor: Colors.red, style: ButtonStyle(
backgroundColor:
MaterialStateProperty.all(Colors.red)),
), ),
], ],
) )

View File

@ -99,7 +99,7 @@ class _UserPageScreenState extends SafeState<UserPageScreen> {
body: Center( body: Center(
child: child:
buildErrorCard(tr("Could not get user information!"), actions: [ buildErrorCard(tr("Could not get user information!"), actions: [
FlatButton( TextButton(
onPressed: _getUserInfo, onPressed: _getUserInfo,
child: Text( child: Text(
tr("Retry").toUpperCase(), tr("Retry").toUpperCase(),

View File

@ -39,21 +39,25 @@ class PendingFriendTile extends StatelessWidget {
child: Row( child: Row(
mainAxisAlignment: MainAxisAlignment.end, mainAxisAlignment: MainAxisAlignment.end,
children: <Widget>[ children: <Widget>[
FlatButton( ElevatedButton(
child: Text( child: Text(
tr("Accept").toUpperCase(), tr("Accept").toUpperCase(),
style: TextStyle(color: Colors.white), style: TextStyle(color: Colors.white),
), ),
color: Colors.green, style: ButtonStyle(
backgroundColor: MaterialStateProperty.all(Colors.green)),
onPressed: () => onRespond(friend, true), onPressed: () => onRespond(friend, true),
), ),
Container(width: 8.0,), Container(
FlatButton( width: 8.0,
),
ElevatedButton(
child: Text( child: Text(
tr("Reject").toUpperCase(), tr("Reject").toUpperCase(),
style: TextStyle(color: Colors.white), style: TextStyle(color: Colors.white),
), ),
color: Colors.red, style: ButtonStyle(
backgroundColor: MaterialStateProperty.all(Colors.red)),
onPressed: () => onRespond(friend, false), onPressed: () => onRespond(friend, false),
) )
], ],