mobile improvements to catch-up with deprecated widgets

This commit is contained in:
Will Webberley 2025-03-23 21:41:52 +00:00
parent 5228648682
commit 23042c2b5d
9 changed files with 20 additions and 34 deletions

View File

@ -56,7 +56,7 @@ class _ExploreTabState extends State<ExploreTab> {
borderRadius: BorderRadius.all(Radius.circular(10)),
),
child:Center(
child: CupertinoButton(
child: TextButton(
child: Text('Load more'),
onPressed: () => getExploreData(),
)

View File

@ -337,17 +337,16 @@ class CustomText extends StatelessWidget {
final String type;
final double margin;
TextStyle? style;
CustomText(this.text, this.type, {this.margin = 0}) {
CustomText(this.text, this.type, {this.margin = 0}) { }
@override
Widget build(BuildContext context) {
if (this.type == 'h1') {
style = TextStyle(fontSize: 25, fontWeight: FontWeight.bold);
style = Theme.of(context).textTheme.titleLarge;
}
else {
style = TextStyle();
}
}
@override
Widget build(BuildContext context) {
return Container(
margin: EdgeInsets.all(this.margin),
child: Text(text, style: style)
@ -367,7 +366,7 @@ class LoginNeeded extends StatelessWidget {
Text('You need to login to see this', style: TextStyle(fontSize: 20), textAlign: TextAlign.center),
Image(image: AssetImage('assets/login.png'), width: 300),
text != null ? Text(text!, textAlign: TextAlign.center) : SizedBox(height: 10),
CupertinoButton(
ElevatedButton(
onPressed: () {
context.push('/welcome');
},

View File

@ -50,7 +50,7 @@ class _LoginScreenState extends State<LoginScreen> {
margin: const EdgeInsets.only(top: 40, left: 10, right: 10),
child: ListView(
children: <Widget>[
Text('Login with your Treadl account', style: TextStyle(fontSize: 20)),
Text('Login with your Treadl account', style: Theme.of(context).textTheme.titleLarge),
SizedBox(height: 30),
TextField(
autofocus: true,
@ -83,7 +83,6 @@ class _LoginScreenState extends State<LoginScreen> {
onPressed: () => _submit(context),
child: _loggingIn ? SizedBox(height: 20, width: 20, child:CircularProgressIndicator(backgroundColor: Colors.white)) : Text("Login",
textAlign: TextAlign.center,
style: TextStyle(color: Colors.white, fontSize: 15)
)
),
]

View File

@ -78,7 +78,6 @@ class _AppState extends State<MyApp> {
title: 'Treadl',
theme: ThemeData(
primarySwatch: Colors.pink,
scaffoldBackgroundColor: Color.fromRGBO(255, 251, 248, 1),
),
);
},

View File

@ -63,8 +63,7 @@ class _OnboardingScreenState extends State<OnboardingScreen> {
SizedBox(height: 10),
Text('You can create as many projects as you like. Upload weaving draft patterns, images, and other files to your projects to store or showcase your work.', style: TextStyle(color: Colors.white, fontSize: 13), textAlign: TextAlign.center),
SizedBox(height: 20),
CupertinoButton(
color: Colors.white,
ElevatedButton(
child: Text('OK, I know what projects are!', style: TextStyle(color: Colors.pink)),
onPressed: () => _controller.animateToPage(1, duration: Duration(milliseconds: 500), curve: Curves.easeInOut),
)
@ -85,8 +84,7 @@ class _OnboardingScreenState extends State<OnboardingScreen> {
SizedBox(height: 10),
Text('We recommend enabling push notifications so you can keep up-to-date with your groups and projects.', style: TextStyle(color: Colors.white, fontSize: 14, fontWeight: FontWeight.bold), textAlign: TextAlign.center),
SizedBox(height: 20),
CupertinoButton(
color: Colors.white,
ElevatedButton(
child: Row(mainAxisAlignment: MainAxisAlignment.center, children: [
_loading ? CircularProgressIndicator() : SizedBox(width: 0),
_loading ? SizedBox(width: 10) : SizedBox(width: 0),
@ -109,8 +107,7 @@ class _OnboardingScreenState extends State<OnboardingScreen> {
SizedBox(height: 10),
Text('You\'re ready to get started. We hope you enjoy using Treadl.', style: TextStyle(color: Colors.white, fontSize: 13), textAlign: TextAlign.center),
SizedBox(height: 20),
CupertinoButton(
color: Colors.white,
ElevatedButton(
child: Text('Get started', style: TextStyle(color: Colors.pink)),
onPressed: () => context.go('/home'),
),

View File

@ -155,7 +155,6 @@ class _ProjectsTabState extends State<ProjectsTab> {
floatingActionButton: user != null ? FloatingActionButton(
onPressed: showNewProjectDialog,
child: _creatingProject ? CircularProgressIndicator(backgroundColor: Colors.white) : Icon(Icons.add),
backgroundColor: Colors.pink[500],
) : null,
);
}
@ -217,13 +216,12 @@ class _NewProjectDialogState extends State<_NewProjectDialog> {
title: Text('Make this project private')
),
SizedBox(height: 20),
CupertinoButton(
color: Colors.pink,
ElevatedButton(
onPressed: _createProject,
child: Text('Create'),
),
SizedBox(height: 10),
CupertinoButton(
TextButton(
onPressed: () {
context.pop();
},

View File

@ -14,13 +14,13 @@ class _RegisterScreenState extends State<RegisterScreen> {
final Api api = Api();
bool _registering = false;
void _submit(context) async {
void _submit(BuildContext context) async {
setState(() => _registering = true);
var data = await api.request('POST', '/accounts/register', {'username': _usernameController.text, 'email': _emailController.text, 'password': _passwordController.text});
setState(() => _registering = false);
if (data['success'] == true) {
AppModel model = Provider.of<AppModel>(context, listen: false);
model.setToken(data['payload']['token']);
await model.setToken(data['payload']['token']);
context.go('/onboarding');
}
else {
@ -94,10 +94,8 @@ class _RegisterScreenState extends State<RegisterScreen> {
SizedBox(height: 20),
ElevatedButton(
onPressed: () => _submit(context),
//color: Colors.pink,
child: _registering ? SizedBox(height: 20, width: 20, child:CircularProgressIndicator(backgroundColor: Colors.white)) : Text("Register",
textAlign: TextAlign.center,
style: TextStyle(color: Colors.white, fontSize: 15)
)
),
]

View File

@ -112,9 +112,8 @@ class SettingsScreen extends StatelessWidget {
onTap: () => _deleteAccount(context),
),
]
) : CupertinoButton(
color: Colors.pink,
child: Text('Join Treadl', style: TextStyle(color: Colors.white)),
) : ElevatedButton(
child: Text('Join Treadl'),
onPressed: () => context.push('/welcome'),
),

View File

@ -25,25 +25,22 @@ class WelcomeScreen extends StatelessWidget {
SizedBox(height: 10),
Text('Treadl is a place for weavers to connect and manage their portfolios.', style: TextStyle(color: Colors.white), textAlign: TextAlign.center),
SizedBox(height: 30),
CupertinoButton(
ElevatedButton(
onPressed: () => _login(context),
color: Colors.white,
child: new Text("Login",
style: TextStyle(color: Colors.pink),
textAlign: TextAlign.center,
)
),
SizedBox(height: 15),
CupertinoButton(
ElevatedButton(
onPressed: () => _register(context),
color: Colors.pink[400],
child: new Text("Register",
style: TextStyle(color: Colors.white),
textAlign: TextAlign.center,
)
),
SizedBox(height: 35),
CupertinoButton(
TextButton(
onPressed: () => context.pop(),
child: new Text("Cancel",
style: TextStyle(color: Colors.white),