Skip to content

Instantly share code, notes, and snippets.

View prof3ssorSt3v3's full-sized avatar
🎯
Focusing

Steve Griffith prof3ssorSt3v3

🎯
Focusing
View GitHub Profile
@prof3ssorSt3v3
prof3ssorSt3v3 / main.dart
Created April 10, 2025 21:39
orientation and key for video
import 'package:flutter/material.dart';
import 'package:video_player/video_player.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({super.key});
@prof3ssorSt3v3
prof3ssorSt3v3 / main.dart
Created April 8, 2025 22:46
Simple Starter code for a Flutter Project
import 'package:flutter/material.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({super.key});
// This widget is the root of your application.
@prof3ssorSt3v3
prof3ssorSt3v3 / main.dart
Created March 27, 2025 20:28
Flutter example of a change notifier
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
//add provider: to the dependencies in pubspec.yaml
//update your formatter in analysis_options.yaml
// The provider file to be imported in files that need it
class NameProvider extends ChangeNotifier {
List<String> _names = ['Bob', 'Louise'];
//similar in concept to a State variable but it will be
@prof3ssorSt3v3
prof3ssorSt3v3 / main.dart
Created March 27, 2025 18:43
Flutter example of a form with two TextFormField widgets that get validated when clicking the submit button
import 'package:flutter/material.dart';
void main() {
runApp(MaterialApp(
home: LoginPage(),
));
}
class LoginPage extends StatefulWidget {
@override
@prof3ssorSt3v3
prof3ssorSt3v3 / main.dart
Created March 26, 2025 18:12
Flutter theme code from class 12.1
import 'package:flutter/material.dart';
import 'package:theming/components/mybutton.dart';
import 'package:theming/theme/theme.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({super.key});
@prof3ssorSt3v3
prof3ssorSt3v3 / main.dart
Last active March 23, 2025 19:21
Flutter FocusNodes and TextFields
import 'package:flutter/material.dart';
class FocusTextFieldScreen extends StatefulWidget {
@override
_FocusTextFieldScreenState createState() => _FocusTextFieldScreenState();
}
class _FocusTextFieldScreenState extends State<FocusTextFieldScreen> {
FocusNode textField1FocusNode = FocusNode();
FocusNode textField2FocusNode = FocusNode();
@prof3ssorSt3v3
prof3ssorSt3v3 / main.dart
Created March 22, 2025 00:19
Flutter example of setting colors with WidgetStatePropertyAll<Color> and WidgetStateColor.resolveWith
import 'package:flutter/material.dart';
void main() {
runApp(MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({super.key});
@override
@prof3ssorSt3v3
prof3ssorSt3v3 / main.dart
Created March 21, 2025 19:58
Flutter example setting styles for all three button types in the top level ThemeData
import 'package:flutter/material.dart';
void main() {
runApp(MyApp());
}
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
@prof3ssorSt3v3
prof3ssorSt3v3 / main.dart
Last active March 22, 2025 03:55
Flutter Example that builds a MaterialDesign 3 colorScheme from an image
import 'package:flutter/material.dart';
void main() {
runApp(MyApp());
}
class MyApp extends StatefulWidget {
@override
_MyAppState createState() => _MyAppState();
}
@prof3ssorSt3v3
prof3ssorSt3v3 / main.dart
Last active March 21, 2025 19:09
Flutter example of a collapsing AppBar
import 'package:flutter/material.dart';
class CollapsingImageAppBar extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Scaffold(
body: CustomScrollView(
slivers: <Widget>[
SliverAppBar(
expandedHeight: 250.0, // Adjust this height as needed