Stop using deprecated methods

This commit is contained in:
Vishesh Handa
2021-06-06 10:39:40 +02:00
parent 13ca274db1
commit 25c386b2ba
7 changed files with 50 additions and 26 deletions

View File

@ -95,7 +95,7 @@ class EditorBottomBar extends StatelessWidget {
icon: const Icon(Icons.undo),
onPressed: undoAllowed ? onUndoSelected : null,
),
FlatButton.icon(
TextButton.icon(
icon: const Icon(Icons.folder),
label: Text(parentFolder.publicName),
onPressed: () {

View File

@ -15,14 +15,19 @@ class PurchaseThankYouScreen extends StatelessWidget {
style: textTheme.headline4,
textAlign: TextAlign.center,
),
RaisedButton(
Padding(
padding: const EdgeInsets.fromLTRB(64.0, 16.0, 64.0, 16.0),
child: ElevatedButton(
child: const Text("Back"),
color: theme.primaryColor,
onPressed: () {
Navigator.of(context).pop();
},
padding: const EdgeInsets.fromLTRB(64.0, 16.0, 64.0, 16.0),
)
style: ButtonStyle(
backgroundColor: MaterialStateProperty.all<Color>(
Theme.of(context).primaryColor),
),
),
),
],
mainAxisAlignment: MainAxisAlignment.spaceAround,
);

View File

@ -43,11 +43,16 @@ class PurchaseButton extends StatelessWidget {
text = tr("widgets.PurchaseButton.fail");
}
return RaisedButton(
child: Text(text, textAlign: TextAlign.center),
color: Theme.of(context).primaryColor,
return Padding(
padding: const EdgeInsets.fromLTRB(32.0, 16.0, 32.0, 16.0),
child: ElevatedButton(
child: Text(text, textAlign: TextAlign.center),
onPressed: product != null ? () => _reportExceptions(context) : null,
style: ButtonStyle(
backgroundColor:
MaterialStateProperty.all<Color>(Theme.of(context).primaryColor),
),
),
);
}

View File

@ -102,14 +102,17 @@ class OnBoardingScreenState extends State<OnBoardingScreen> {
bottomBar = SizedBox(
width: double.infinity,
height: _bottomBarHeight,
child: RaisedButton(
child: ElevatedButton(
key: const ValueKey("GetStarted"),
child: Text(
tr("OnBoarding.getStarted"),
textAlign: TextAlign.center,
style: Theme.of(context).textTheme.button,
),
color: Theme.of(context).primaryColor,
style: ButtonStyle(
backgroundColor: MaterialStateProperty.all<Color>(
Theme.of(context).primaryColor),
),
onPressed: _finish,
),
);

View File

@ -254,13 +254,16 @@ class Button extends StatelessWidget {
Widget build(BuildContext context) {
return SizedBox(
width: double.infinity,
child: RaisedButton(
child: ElevatedButton(
child: Text(
text,
textAlign: TextAlign.center,
style: Theme.of(context).textTheme.button,
),
color: Theme.of(context).primaryColor,
style: ButtonStyle(
backgroundColor:
MaterialStateProperty.all<Color>(Theme.of(context).primaryColor),
),
onPressed: onPressed,
),
);
@ -277,13 +280,15 @@ class RedButton extends StatelessWidget {
Widget build(BuildContext context) {
return SizedBox(
width: double.infinity,
child: RaisedButton(
child: ElevatedButton(
child: Text(
text,
textAlign: TextAlign.center,
style: Theme.of(context).textTheme.button,
),
color: Colors.red,
style: ButtonStyle(
backgroundColor: MaterialStateProperty.all<Color>(Colors.red),
),
onPressed: onPressed,
),
);

View File

@ -21,27 +21,33 @@ class GitHostSetupButton extends StatelessWidget {
if (iconUrl == null) {
return SizedBox(
width: double.infinity,
child: RaisedButton(
child: ElevatedButton(
child: Text(
text,
textAlign: TextAlign.center,
style: Theme.of(context).textTheme.button,
),
color: Theme.of(context).primaryColor,
style: ButtonStyle(
backgroundColor: MaterialStateProperty.all<Color>(
Theme.of(context).primaryColor),
),
onPressed: _onPressedWithAnalytics,
),
);
} else {
return SizedBox(
width: double.infinity,
child: RaisedButton.icon(
child: ElevatedButton.icon(
label: Text(
text,
textAlign: TextAlign.center,
style: Theme.of(context).textTheme.button,
),
icon: Image.asset(iconUrl!, width: 32, height: 32),
color: Theme.of(context).primaryColor,
style: ButtonStyle(
backgroundColor: MaterialStateProperty.all<Color>(
Theme.of(context).primaryColor),
),
onPressed: _onPressedWithAnalytics,
),
);

View File

@ -73,7 +73,7 @@ class GitHostSetupScreenState extends State<GitHostSetupScreen> {
UserInfo? _userInfo;
Widget? _buildPage(BuildContext context, int pos) {
Widget _buildPage(BuildContext context, int pos) {
assert(_pageCount >= 1);
if (pos == 0) {
@ -350,16 +350,16 @@ class GitHostSetupScreenState extends State<GitHostSetupScreen> {
}
assert(_pageChoice[0] != PageChoice0.CustomProvider);
assert(false, "Pos is $pos");
return null;
return Container();
}
@override
Widget build(BuildContext context) {
var pageView = PageView.builder(
controller: pageController,
itemBuilder: _buildPage as Widget Function(BuildContext, int),
itemBuilder: _buildPage,
itemCount: _pageCount,
onPageChanged: (int pageNum) {
setState(() {