Open name27 opened 1 year ago
import 'package:flutter/material.dart';
import 'package:get/get_navigation/get_navigation.dart';
import 'package:use_get_x_app/page/main_page.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({super.key});
@override
Widget build(BuildContext context) {
return GetMaterialApp(
theme: ThemeData.dark(),
home: MainPage(),
);
}
}
import 'package:flutter/material.dart';
import 'package:get/get.dart';
class MainPage extends StatelessWidget {
const MainPage({super.key});
@override
Widget build(BuildContext context) {
return Scaffold(
body: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
ElevatedButton(
onPressed: () {
Get.bottomSheet(
SizedBox(
height: Get.height * 0.3,
child: Column(
children: [Text('1'), Text('2')],
)),
shape: const RoundedRectangleBorder(
borderRadius: BorderRadius.only(
topRight: Radius.circular(20),
topLeft: Radius.circular(20),
),
),
backgroundColor: Colors.black,
clipBehavior: Clip.hardEdge,
);
},
child: Text('바텀시트')),
ElevatedButton(
onPressed: () {
Get.snackbar('title', 'content',
backgroundColor: Colors.black,
snackPosition: SnackPosition.BOTTOM);
},
child: Text('스낵바'))
],
),
),
floatingActionButton: FloatingActionButton(onPressed: () {
Get.dialog(
AlertDialog(
title: Text('title'),
content: Text('content'),
actions: [
TextButton(
onPressed: Get.back,
child: Text('cancel'),
),
TextButton(
onPressed: Get.back,
child: Text('confirm'),
),
],
),
);
}),
);
}
}
페이지 라우팅 -
Get.to(()=>NewPage())
스낵바
Get.snakbar('내용표시', '내용 상세내용');
디바이스 화면 사이즈
Get.width