Whats Wrong with my code

56 views
Skip to first unread message

Deepjyoti Baishya

unread,
May 21, 2019, 11:58:31 AM5/21/19
to Flutter Dev
Hi , Flutter Developer . I am Deepjyoti Baishya .
I want make my own design but when i try decoration flutter app not works , so please check my code and help me thank 



..
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';

void main() {
runApp(
MaterialApp(
home: Scaffold(
backgroundColor: Colors.teal,
body: SafeArea(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
// crossAxisAlignment: CrossAxisAlignment.stretch,
// mainAxisAlignment: MainAxisAlignment.spaceBetween,
// verticalDirection: VerticalDirection.,
children: <Widget>[
CircleAvatar(
radius: 50,
backgroundImage: AssetImage("assets/images/me.jpg"),
),
Text(
'Deepjyoti Sam',
style: TextStyle(
fontFamily: 'Pacifico',
fontWeight: FontWeight.bold,
fontSize: 30.0,
color: Colors.white,
),
),
Text(
'FLUTTER DEVELOPER',
style: TextStyle(
fontFamily: 'assets/fonts/Ubuntu-Regular.ttf',
fontWeight: FontWeight.bold,
fontSize: 20.0,
color: Colors.teal.shade100,
letterSpacing: 2.0),
),
SizedBox(
height: 10.0,
width: 160.0,
child: Divider(
color: Colors.teal.shade100,
),
),
Card(
color: Colors.white,
margin: EdgeInsets.symmetric(horizontal: 30.0, vertical: 10.0),
elevation: 30.0,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(12)),
child: ListTile(
leading: Icon(
Icons.call,
color: Colors.teal.shade900,
),
title: Text(
'+91 7002 043 769',
style: TextStyle(
// fontWeight: FontWeight.bold,
fontSize: 20.0,
color: Colors.teal.shade900,
fontFamily: 'assets/fonts/Ubuntu-Regular.ttf',
),
),
),
),
Card(
elevation: 30.0,
color: Colors.white,
margin: EdgeInsets.symmetric(vertical: 10.0, horizontal: 30.0),
child: ListTile(
leading: Icon(
Icons.email,
color: Colors.teal.shade900,
),
title: Text(
style: TextStyle(
// fontWeight: FontWeight.bold,
fontSize: 18.0,
color: Colors.teal.shade900,
fontFamily: 'assets/fonts/Ubuntu-Regular.ttf',
),
),
),
),
Stack(
children: <Widget>[
Container(
color: Colors.pink,
height: 150.0,
// width: 150.0,
decoration: BoxDecoration(
borderRadius: BorderRadius.only(
bottomLeft: Radius.circular(10.0),
bottomRight: Radius.circular(10.0)
)
),
)
],
)
],
),
),
),
),
);
}

Mattias Månsson

unread,
May 21, 2019, 10:53:12 PM5/21/19
to Flutter Dev
Think you need to explain what is not working...

David McCreary

unread,
May 22, 2019, 8:46:30 AM5/22/19
to Mattias Månsson, Flutter Dev
I think it's a bit odd that you don't have any Widget (and you could use a StatelessWidget) that does build(BuildContext context).

I would try refactoring to something like this:

void main() => runApp( DeepjyotiApp() );

class DeepjyotiApp extends StatelessWidget {

    @override build(BuildContext context) {
           return MaterialApp(
                    title:  'Deepjyoti App',
                    home:  Scaffold(
backgroundColor: Colors.teal,
body: SafeArea(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
// crossAxisAlignment: CrossAxisAlignment.stretch,
// mainAxisAlignment: MainAxisAlignment.spaceBetween,
// verticalDirection: VerticalDirection.,
......
                    ),
            );
     }
}


--
You received this message because you are subscribed to the Google Groups "Flutter Dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to flutter-dev...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/flutter-dev/1a2178b9-4524-4cea-b2f5-d36f7b384d57%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages