adding packages

This commit is contained in:
2026-01-15 14:38:46 -08:00
parent ef86e3ab6a
commit 6869cf47e5
5253 changed files with 726695 additions and 34 deletions
@@ -0,0 +1,3 @@
export 'layout.dart';
export 'list.dart';
export 'multi.dart';
@@ -0,0 +1,82 @@
import 'package:flutter/material.dart';
import 'package:responsive_scaffold/responsive_scaffold.dart';
class LayoutExample extends StatelessWidget {
@override
Widget build(BuildContext context) {
return ResponsiveScaffold(
title: Text('Responsive Layout Example'),
drawer: ListView(
children: <Widget>[
ListTile(
leading: Icon(Icons.settings),
title: Text('Settings Page'),
),
ListTile(
leading: Icon(Icons.info),
title: Text('Info Page'),
),
ListTile(
leading: Icon(Icons.library_books),
title: Text('Library Page'),
),
ListTile(
leading: Icon(Icons.help),
title: Text('Help Page'),
),
],
),
endIcon: Icons.filter_list,
endDrawer: ListView(
children: <Widget>[
ListTile(
leading: Icon(Icons.filter_list),
title: Text('Filter List'),
subtitle: Text('Hide and show items'),
trailing: Switch(
value: true,
onChanged: (val) {},
),
),
ListTile(
leading: Icon(Icons.image_aspect_ratio),
title: Text('Size Settings'),
subtitle: Text('Change size of images'),
),
ListTile(
title: Slider(
value: 0.5,
onChanged: (val) {},
),
),
ListTile(
leading: Icon(Icons.sort_by_alpha),
title: Text('Sort List'),
subtitle: Text('Change layout behavior'),
trailing: Switch(
value: false,
onChanged: (val) {},
),
),
],
),
trailing: IconButton(
icon: Icon(Icons.search),
onPressed: () {},
),
body: Center(
child: RaisedButton(
child: Text('Close'),
onPressed: () {
Navigator.pop(context);
},
),
),
floatingActionButton: FloatingActionButton(
child: Icon(Icons.add),
backgroundColor: Theme.of(context).accentColor,
onPressed: () {},
),
);
}
}
@@ -0,0 +1,137 @@
import 'package:flutter/material.dart';
import 'package:responsive_scaffold/responsive_scaffold.dart';
class ListExample extends StatefulWidget {
const ListExample({
Key key,
});
@override
_ListExampleState createState() => _ListExampleState();
}
class _ListExampleState extends State<ListExample> {
var _scaffoldKey = new GlobalKey<ScaffoldState>();
List<String> _items;
@override
void initState() {
_items = List.generate(20, (int index) => "test_$index");
super.initState();
}
@override
Widget build(BuildContext context) {
return ResponsiveListScaffold.builder(
scaffoldKey: _scaffoldKey,
detailBuilder: (BuildContext context, int index, bool tablet) {
final i = _items[index];
return DetailsScreen(
body: new ExampleDetailsScreen(
items: _items,
row: i,
tablet: tablet,
onDelete: () {
setState(() {
_items.removeAt(index);
});
if (!tablet) Navigator.of(context).pop();
},
onChanged: (String value) {
setState(() {
_items[index] = value;
});
},
),
);
},
nullItems: Center(child: CircularProgressIndicator()),
emptyItems: Center(child: Text("No Items Found")),
slivers: <Widget>[
SliverAppBar(
title: Text("App Bar"),
),
],
itemCount: _items?.length ?? 0,
itemBuilder: (BuildContext context, int index) {
final i = _items[index];
return ListTile(
leading: Text(i),
);
},
bottomNavigationBar: BottomAppBar(
elevation: 0.0,
child: Container(
child: IconButton(
icon: Icon(Icons.share),
onPressed: () {},
),
),
),
floatingActionButton: FloatingActionButton(
child: Icon(Icons.add),
onPressed: () {
_scaffoldKey.currentState.showSnackBar(SnackBar(
content: Text("Snackbar!"),
));
},
),
);
}
}
class ExampleDetailsScreen extends StatelessWidget {
const ExampleDetailsScreen({
Key key,
@required List<String> items,
@required this.row,
@required this.tablet,
@required this.onDelete,
@required this.onChanged,
}) : _items = items,
super(key: key);
final List<String> _items;
final String row;
final bool tablet;
final VoidCallback onDelete;
final ValueChanged<String> onChanged;
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
elevation: 0.0,
automaticallyImplyLeading: !tablet,
title: Text("Details"),
actions: [
IconButton(
icon: Icon(Icons.share),
onPressed: () {
onChanged(row + " " + DateTime.now().toString());
},
),
IconButton(
icon: Icon(Icons.delete),
onPressed: onDelete,
),
],
),
bottomNavigationBar: BottomAppBar(
elevation: 0.0,
child: Container(
child: IconButton(
icon: Icon(Icons.share),
onPressed: () {},
),
),
),
body: Container(
child: Center(
child: Text("Item: $row"),
),
),
);
}
}
@@ -0,0 +1,96 @@
import 'package:flutter/material.dart';
import 'package:responsive_scaffold/responsive_scaffold.dart';
class MultiColumnNavigationExample extends StatelessWidget {
@override
Widget build(BuildContext context) {
return ThreeColumnNavigation(
title: Text('Mailboxes'),
showDetailsArrows: true,
backgroundColor: Colors.grey[100],
bottomAppBar: BottomAppBar(
elevation: 1,
child: Row(
children: <Widget>[
IconButton(
icon: Icon(
Icons.filter_list,
color: Colors.transparent,
),
onPressed: () {},
),
],
),
),
sections: [
MainSection(
label: Text('All Inboxes'),
icon: Icon(Icons.mail),
itemCount: 100,
itemBuilder: (context, index, selected) {
return ListTile(
leading: CircleAvatar(
child: Text(index.toString()),
),
selected: selected,
title: Text('Primary Information'),
subtitle: Text('Here are some details about the item'),
);
},
bottomAppBar: BottomAppBar(
elevation: 1,
child: Row(
children: <Widget>[
IconButton(
icon: Icon(Icons.filter_list),
onPressed: () {},
),
],
),
),
getDetails: (context, index) {
return DetailsWidget(
title: Text('Details'),
child: Center(
child: Text(
index.toString(),
),
),
);
},
),
MainSection(
label: Text('Sent Mail'),
icon: Icon(Icons.send),
itemCount: 100,
itemBuilder: (context, index, selected) {
return ListTile(
leading: CircleAvatar(
child: Text(index.toString()),
),
selected: selected,
title: Text('Secondary Information'),
subtitle: Text('Here are some details about the item'),
);
},
getDetails: (context, index) {
return DetailsWidget(
title: Text('Details'),
actions: [
IconButton(
icon: Icon(Icons.share),
onPressed: () {},
),
],
child: Center(
child: Text(
index.toString(),
),
),
);
},
),
],
);
}
}
@@ -0,0 +1,75 @@
import 'dart:io';
import 'package:flutter/material.dart';
import 'package:flutter/foundation.dart';
import 'examples/index.dart';
/// main is entry point of Flutter application
void main() {
// Desktop platforms aren't a valid platform.
if (!kIsWeb) _setTargetPlatformForDesktop();
return runApp(MyApp());
}
/// If the current platform is desktop, override the default platform to
/// a supported platform (iOS for macOS, Android for Linux and Windows).
/// Otherwise, do nothing.
void _setTargetPlatformForDesktop() {
TargetPlatform targetPlatform;
if (Platform.isMacOS) {
targetPlatform = TargetPlatform.iOS;
} else if (Platform.isLinux || Platform.isWindows) {
targetPlatform = TargetPlatform.android;
}
if (targetPlatform != null) {
debugDefaultTargetPlatformOverride = targetPlatform;
}
}
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
theme: ThemeData.light().copyWith(accentColor: Colors.red),
debugShowCheckedModeBanner: false,
home: HomePage(),
);
}
}
class HomePage extends StatelessWidget {
const HomePage({
Key key,
}) : super(key: key);
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text('Responsive Examples'),
),
body: ListView(
children: <Widget>[
ListTile(
title: Text('Responsive List'),
onTap: () => _goToScreen(context, ListExample()),
),
ListTile(
title: Text('Responsive Layout'),
onTap: () => _goToScreen(context, LayoutExample()),
),
ListTile(
title: Text('Multi Column Layout'),
onTap: () => _goToScreen(context, MultiColumnNavigationExample()),
),
],
),
);
}
void _goToScreen(BuildContext context, Widget child) =>
Navigator.of(context).pushReplacement(
MaterialPageRoute(builder: (_) => child),
);
}