右上のDEBUGを消す
MaterialApp(
debugShowCheckedModeBanner: false,
...
AppBarの設定
AppBar(
backgroundColor: Color.fromARGB(246, 228, 228, 228), //背景色
elevation: 0, //影
leading: IconButton(onPressed: (){}, icon: const Icon(Icons.menu)),
),
全体の背景色
Scaffold(
backgroundColor: const Color.fromARGB(246, 228, 228, 228),
...
FloatingActionButtonの設定
floatingActionButton: FloatingActionButton(
onPressed: (){},
backgroundColor: Colors.white, //背景色
child: const Icon(Icons.add, color: Colors.black,),
),
ページ遷移
Navigator.push(context, MaterialPageRoute(builder: (context)=> NewPage()));
riverpod関係
main.dart
import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:google_fonts/google_fonts.dart';
import 'package:shelf/view/home_page.dart';
void main() {
runApp(
ProviderScope(child: MyApp())
);
}
class MyApp extends StatelessWidget {
const MyApp({super.key});
// This widget is the root of your application.
@override
Widget build(BuildContext context) {
return MaterialApp(
debugShowCheckedModeBanner: false,
title: 'Flutter Demo',
theme: ThemeData(
colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple),
useMaterial3: true,
),
home: HomePage(), //最初に表示されるページ
);
}
}
final hogesProvider = StateProvider<List<hoge>>((ref)=> []);
class Hoge extends StateNotifier{
Ref ref;
Hoge({required this.ref}) : super(null);
}
※自分はよくこの形で使ってるけど、実際どういう使い方が多いのだろうか?