import 'dart:core';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
// void main(){
// runApp(MyAPP());
// }
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
debugShowCheckedModeBanner: false,
title: 'Dice game',
home: LogIn(),
);
}
}
class LogIn extends StatefulWidget {
@override
_LogInState createState() => _LogInState();
}
class _LogInState extends State<LogIn> {
TextEditingController _ProcessingValueEditingController =
TextEditingController();
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text('Log ins'),
backgroundColor: Colors.redAccent,
centerTitle: true,
leading: IconButton(
icon: Icon(Icons.menu),
onPressed: () {},
),
actions: [
IconButton(
onPressed: () {},
icon: Icon(Icons.search_outlined),
),
],
),
body: GestureDetector(
onTap: () {
HapticFeedback.mediumImpact();
_CupertinoMapQuestion(context);
},
child: Container(
width: MediaQuery.of(context).size.width,
padding: const EdgeInsets.only(right: 10, left: 10, top: 10),
child: TextFormField(
style: TextStyle(fontSize: 16),
decoration: InputDecoration(
enabled: false,
contentPadding:
new EdgeInsets.symmetric(vertical: 10.0, horizontal: 10.0),
isDense: true,
hintText: "선택하고 싶은 항목 선택",
enabledBorder: UnderlineInputBorder(
borderSide: BorderSide(color: Colors.grey),
),
),
controller: _ProcessingValueEditingController,
),
),
),
);
}
_CupertinoMapQuestion(BuildContext context) {
// showCupertinoModalPopup 사용
return showCupertinoModalPopup(
context: context,
builder: (BuildContext context) => Theme(
data: ThemeData.light(),
child: CupertinoActionSheet(
actions: [
CupertinoActionSheetAction(
child: Text('1111111'),
onPressed: () {
HapticFeedback.mediumImpact();
_ProcessingValueEditingController.text = '1111111';
Navigator.of(context).pop();
},
),
CupertinoActionSheetAction(
child: Text('2222222'),
onPressed: () {
HapticFeedback.mediumImpact();
_ProcessingValueEditingController.text = '2222222';
Navigator.of(context).pop();
},
),
CupertinoActionSheetAction(
child: Text('3333333'),
onPressed: () {
HapticFeedback.mediumImpact();
_ProcessingValueEditingController.text = '3333333';
Navigator.of(context).pop();
},
),
],
cancelButton: CupertinoActionSheetAction(
child: Text('취소'),
onPressed: () {
HapticFeedback.mediumImpact();
Navigator.of(context).pop();
}),
),
));
}
}
'study > flutter' 카테고리의 다른 글
플러터(flutter) textfield 터치시 키보드 화면이 올라와서 화면이 깨질때 (0) | 2021.10.28 |
---|---|
플러터(flutter) ProgressDialog 사용 (0) | 2021.10.13 |
플러터(flutter) BottomSheet에서 DropDown List 만들기 (0) | 2021.10.10 |
플러터(flutter) 달력 날자 선택 datepicker (0) | 2021.10.07 |
플러터(flutter) 로그아웃, 회원탈퇴(모든페이지 위젯 저거 후 첫 페이지 위젯으로 이동하기 -pushNamedAndRemoveUntil (0) | 2021.10.03 |