1
0
mirror of https://gitlab.com/comunic/comunicmobile synced 2024-11-22 12:59:21 +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
Center(
child: RaisedButton(
color: Colors.blue,
textColor: Colors.white,
child: ElevatedButton(
onPressed: _submitForm,
child: Text("Submit"),
),

View File

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

View File

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

View File

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

View File

@ -77,7 +77,7 @@ class __PasswordResetBodyState extends SafeState<_PasswordResetBody> {
mainAxisSize: MainAxisSize.min,
children: <Widget>[
Text(tr("You can choose a new password.")),
OutlineButton(
OutlinedButton(
onPressed: _changePassword,
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!"),
textAlign: TextAlign.center,
),
OutlineButton(
OutlinedButton(
onPressed: _quitScreen,
child: Text(tr("Login")),
)

View File

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

View File

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

View File

@ -87,7 +87,7 @@ class _ConversationScreenState extends SafeState<ConversationsListScreen> {
return buildErrorCard(
tr("Could not retrieve the list of conversations!"),
actions: <Widget>[
FlatButton(
TextButton(
onPressed: () => _refreshIndicatorKey.currentState.show(),
child: Text(
tr("Retry").toUpperCase(),
@ -138,7 +138,7 @@ class _ConversationScreenState extends SafeState<ConversationsListScreen> {
await _conversationsHelper.deleteConversation(conversation.id);
} catch (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!"))));
}

View File

@ -91,7 +91,7 @@ class _FriendsListScreenState extends SafeState<FriendsListScreen> {
Widget _buildError() => buildErrorCard(
tr("Could not load your list of friends!"),
actions: [
FlatButton(
TextButton(
onPressed: _refreshList,
child: Text(
tr("Retry").toUpperCase(),
@ -171,11 +171,11 @@ class _FriendsListScreenState extends SafeState<FriendsListScreen> {
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!")),
actions: <Widget>[
FlatButton(
TextButton(
onPressed: () => Navigator.pop(context, false),
child: Text(tr("Cancel").toUpperCase()),
),
FlatButton(
TextButton(
onPressed: () => Navigator.pop(context, true),
child: Text(
tr("Confirm").toUpperCase(),

View File

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

View File

@ -337,17 +337,19 @@ class _UpdateConversationScreen extends State<UpdateConversationScreen> {
? Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
OutlineButton(
OutlinedButton(
onPressed: _uploadNewLogo,
child: Text(tr("Change logo")),
),
SizedBox(width: 5),
_image == null
? Container()
: OutlineButton(
: ElevatedButton(
onPressed: _deleteLogo,
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(
child:
buildErrorCard(tr("Could not get user information!"), actions: [
FlatButton(
TextButton(
onPressed: _getUserInfo,
child: Text(
tr("Retry").toUpperCase(),

View File

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