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), icon: const Icon(Icons.undo),
onPressed: undoAllowed ? onUndoSelected : null, onPressed: undoAllowed ? onUndoSelected : null,
), ),
FlatButton.icon( TextButton.icon(
icon: const Icon(Icons.folder), icon: const Icon(Icons.folder),
label: Text(parentFolder.publicName), label: Text(parentFolder.publicName),
onPressed: () { onPressed: () {

View File

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

View File

@ -43,11 +43,16 @@ class PurchaseButton extends StatelessWidget {
text = tr("widgets.PurchaseButton.fail"); text = tr("widgets.PurchaseButton.fail");
} }
return RaisedButton( return Padding(
child: Text(text, textAlign: TextAlign.center),
color: Theme.of(context).primaryColor,
padding: const EdgeInsets.fromLTRB(32.0, 16.0, 32.0, 16.0), padding: const EdgeInsets.fromLTRB(32.0, 16.0, 32.0, 16.0),
onPressed: product != null ? () => _reportExceptions(context) : null, 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( bottomBar = SizedBox(
width: double.infinity, width: double.infinity,
height: _bottomBarHeight, height: _bottomBarHeight,
child: RaisedButton( child: ElevatedButton(
key: const ValueKey("GetStarted"), key: const ValueKey("GetStarted"),
child: Text( child: Text(
tr("OnBoarding.getStarted"), tr("OnBoarding.getStarted"),
textAlign: TextAlign.center, textAlign: TextAlign.center,
style: Theme.of(context).textTheme.button, style: Theme.of(context).textTheme.button,
), ),
color: Theme.of(context).primaryColor, style: ButtonStyle(
backgroundColor: MaterialStateProperty.all<Color>(
Theme.of(context).primaryColor),
),
onPressed: _finish, onPressed: _finish,
), ),
); );

View File

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

View File

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

View File

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