Guest User

Untitled

a guest
Aug 22nd, 2019
78
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import 'package:flutter/material.dart';
  2.  
  3. class LoginScreen extends StatelessWidget {
  4. @override
  5. Widget build(BuildContext context) {
  6. MediaQueryData mdq = MediaQuery.of(context);
  7. print(mdq.size.height);
  8. print(mdq.size.width);
  9. if(mdq.orientation == Orientation.portrait){
  10. return Scaffold(
  11. body: SafeArea(
  12. child: Stack(
  13. children: <Widget>[
  14. Column(
  15. children: <Widget>[
  16. Expanded(child:Container(color:Colors.red)),
  17. Expanded(child:Container(color:Colors.green)),
  18. ],
  19. ),
  20. ListView(
  21. shrinkWrap: true,
  22. children: <Widget>[
  23. Container(
  24. height: (mdq.size.height - mdq.viewInsets.bottom)*0.5,
  25. child: Center(
  26. child: Container(
  27. width: mdq.size.width * 0.2,
  28. height:(mdq.size.height - mdq.viewInsets.bottom) * 0.2,
  29. decoration: BoxDecoration(
  30. shape: BoxShape.circle,
  31. color: Colors.black,
  32. ),
  33. ),
  34. ),
  35. ),
  36. Container(
  37. height: (mdq.size.height - mdq.viewInsets.bottom)*0.5,
  38. child: Column(
  39. mainAxisAlignment: MainAxisAlignment.spaceEvenly,
  40. children: <Widget>[
  41. Column(
  42. children: <Widget>[
  43. Text("Email"),
  44. TextField(),
  45. ],
  46. ),
  47. Column(
  48. children: <Widget>[
  49. Text("Password"),
  50. TextField(),
  51. ],
  52. ),
  53. ButtonTheme(
  54. minWidth: mdq.size.width*0.5,
  55. child: RaisedButton(
  56. onPressed: (){},
  57. )),
  58. ],
  59. ),
  60. ),
  61. ],
  62. ),
  63. ],
  64. ),
  65. ),
  66. );}
  67. else{
  68. return Scaffold(
  69. body: SafeArea(
  70. child: Stack(
  71. children: <Widget>[
  72. Column(
  73. children: <Widget>[
  74. Expanded(child:Container(color:Colors.red)),
  75. Expanded(child:Container(color:Colors.green)),
  76. ],
  77. ),
  78. Row(
  79. children: <Widget>[
  80. Container(
  81. width: mdq.size.width*0.3,
  82. child: Center(
  83. child: Container(
  84. width: mdq.size.width * 0.2,
  85. height: mdq.size.height * 0.2,
  86. decoration: BoxDecoration(
  87. shape: BoxShape.circle,
  88. color: Colors.black,
  89. ),
  90. ),
  91. ),
  92. ),
  93. Container(
  94. width: mdq.size.width*0.7,
  95. child: Column(
  96. mainAxisAlignment: MainAxisAlignment.center,
  97. crossAxisAlignment: CrossAxisAlignment.center,
  98. children: <Widget>[
  99. Column(
  100. children: <Widget>[
  101. Text("Email"),
  102. TextField(),
  103. ],
  104. ),
  105. Column(
  106. children: <Widget>[
  107. Text("Password"),
  108. TextField(),
  109. ],
  110. ),
  111. ButtonTheme(
  112. minWidth: mdq.size.width*0.5,
  113. child: RaisedButton(
  114. onPressed: (){},
  115. )),
  116. ],
  117. ),
  118. ),
  119. ],
  120. ),
  121. ],
  122. ),
  123. ),
  124. );
  125. }
  126. /*return Scaffold(
  127. body: SafeArea(
  128. child: Column(
  129. children: <Widget>[
  130. SizedBox(height:50),
  131. Container(
  132. width:150,
  133. height:150,
  134. decoration: BoxDecoration(
  135. shape: BoxShape.circle,
  136. color: Colors.black,
  137. ),
  138. ),
  139. SizedBox(height:90),
  140. Text("Email",textAlign: TextAlign.left,),
  141. SizedBox(height:10),
  142.  
  143. TextField(),
  144. SizedBox(height:90),
  145.  
  146. Text("Password"),
  147. SizedBox(height:10),
  148.  
  149. TextField(),
  150. SizedBox(height:50),
  151.  
  152. RaisedButton(),
  153. ],
  154.  
  155. ),
  156. )
  157. );*/
  158. }
  159. }
RAW Paste Data