반응형
반응형
코드 작성 import 'package:flutter/material.dart'; void main() { runApp(MyApp()); } class MyApp extends StatelessWidget { @override Widget build(BuildContext context) { return MaterialApp( theme: ThemeData( brightness: Brightness.dark, primaryColor: Colors.blueGrey[800], accentColor: Colors.blueAccent, fontFamily: 'Montserrat', ), home: MyHomePage(), ); } }
패키지 설치 google_mobile_ads | Flutter PackageFlutter plugin for Google Mobile Ads, supporting banner, interstitial (full-screen), rewarded and native adspub.dev터미널 설치 $ flutter pub add google_mobile_ads 안드로이드 설정android / app / src / main / AndroidManifest.xml 아이폰 설정ios / Runner / Info.plistGADApplicationIdentifierca-app-pub-################~########## main.dart 설정 (초기화)void ..
코드 작성 import 'package:flutter/material.dart'; import 'dart:async'; class HomePage extends StatefulWidget { const HomePage({Key? key}) : super(key: key); @override State createState() => _HomePageState(); } class _HomePageState extends State { late DateTime _lastPressedAt; @override Widget build(BuildContext context) { return WillPopScope( onWillPop: () async { final now = DateTime.now(); if (now..
Flutter 플러터 Progress bar 진행바 간단 구현import 'package:flutter/material.dart';class MyWidget extends StatefulWidget { const MyWidget({Key? key}) : super(key: key); @override _MyWidgetState createState() => _MyWidgetState();}class _MyWidgetState extends State { double _progressValue = 0.0; void _updateProgress() { setState(() { _progressValue += 0.1; if (_progressValue >= 1.0) { ..
For문 for (int i = 0; i < 10; i++) { print("현재 값은 $i"); } Switch문 int grade = 80; switch (grade) { case 90: print("Grade is A"); break; case 80: print("Grade is B"); break; case 70: print("Grade is C"); break; default: print("Grade is not A, B, or C"); break; }
코드 예시 int num = 0; if (num > 0) { print("0보다 큽니다."); } else if (num < 0) { print("0보다 작습니다."); } else { print("0입니다."); } 참고할만한 글
코드 작성 import 'package:flutter/material.dart'; import 'package:path_provider/path_provider.dart'; import 'dart:io'; class Notepad extends StatefulWidget { @override _NotepadState createState() => _NotepadState(); } class _NotepadState extends State { TextEditingController _textController = TextEditingController(); String _filePath = ''; @override void initState() { super.initState(); _loadFile();..
코드 작성 import 'dart:async'; import 'package:flutter/material.dart'; class ToDoListPage extends StatefulWidget { const ToDoListPage({Key? key}) : super(key: key); @override State createState() => _ToDoListPageState(); } class _ToDoListPageState extends State { final _todoController = TextEditingController(); List _todoList = []; void _addTodo() { setState(() { _todoList.add(_todoController.text); ..
Flutter 플러터 타이머 간단 구현코드 작성import 'dart:async';import 'package:flutter/material.dart';class TimerPage extends StatefulWidget { const TimerPage({Key? key}) : super(key: key); @override State createState() => _TimerPageState();}class _TimerPageState extends State { int _seconds = 0; bool _isRunning = false; late Timer _timer; void _startTimer() { _isRunning = true; _timer = Timer.perio..
패키지 설치 url_launcher | Flutter Package Flutter plugin for launching a URL. Supports web, phone, SMS, and email schemes. pub.dev 터미널 설치 flutter pub add url_launcher android / app / src / main / AndroidManifest.xml Flutter 플러터 백 버튼 무시하기 WillPopScope 코드 예시 Widget build(BuildContext context) { return WillPopScope( onWillPop: () async => false, child: Scaffold(), ); } parksh3641.tistory.com Flutter 플러..
코드 작성 Widget build(BuildContext context) { return Scaffold( body: Center( child: ElevatedButton( child: Text( "메인 화면 이동", ), onPressed: () { Navigator.push( context, PageRouteBuilder( pageBuilder: (BuildContext context, Animation animation1, Animation animation2) { return MyApp(); //변경 필요 }, transitionDuration: Duration.zero, reverseTransitionDuration: Duration.zero, ), ); }, ), )); } } 참고할만한 글 ..
코드 예시 Widget build(BuildContext context) { return WillPopScope( onWillPop: () async => false, child: Scaffold(), ); }