initializing
This commit is contained in:
@@ -0,0 +1,82 @@
|
|||||||
|
import 'dart:convert';
|
||||||
|
import 'package:intl/intl.dart';
|
||||||
|
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:http/http.dart' as http;
|
||||||
|
import 'package:syncfusion_flutter_datagrid/datagrid.dart';
|
||||||
|
|
||||||
|
class Movie {
|
||||||
|
int movieID;
|
||||||
|
String movieTitle;
|
||||||
|
String overview;
|
||||||
|
DateTime releaseDate;
|
||||||
|
int state;
|
||||||
|
String resolution;
|
||||||
|
|
||||||
|
Movie({
|
||||||
|
required this.movieID,
|
||||||
|
required this.movieTitle,
|
||||||
|
required this.overview,
|
||||||
|
required this.releaseDate,
|
||||||
|
required this.state,
|
||||||
|
required this.resolution,
|
||||||
|
});
|
||||||
|
|
||||||
|
factory Movie.fromJson(Map<String, dynamic> json) {
|
||||||
|
return Movie(
|
||||||
|
movieID: int.parse(json['movieID']),
|
||||||
|
movieTitle: json['movieTitle'] as String,
|
||||||
|
overview: json['overview'] as String,
|
||||||
|
releaseDate: DateTime.parse(json['releaseDate']),
|
||||||
|
state: int.parse(json['state']),
|
||||||
|
resolution: json['resolution'] as String,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class MovieDataSource extends DataGridSource {
|
||||||
|
/// Creates the employee data source class with required details.
|
||||||
|
MovieDataSource(this.movies) {
|
||||||
|
buildDataGridRow();
|
||||||
|
}
|
||||||
|
|
||||||
|
void buildDataGridRow() {
|
||||||
|
_movieDataGridRows = movies
|
||||||
|
.map<DataGridRow>((e) => DataGridRow(cells: [
|
||||||
|
DataGridCell<int>(columnName: 'movieID', value: e.movieID),
|
||||||
|
DataGridCell<int>(columnName: 'state', value: e.state),
|
||||||
|
DataGridCell<String>(
|
||||||
|
columnName: 'movieTitle', value: e.movieTitle),
|
||||||
|
DataGridCell<String>(
|
||||||
|
columnName: 'releaseDate',
|
||||||
|
value: DateFormat('yyyy-MM-dd').format(e.releaseDate)),
|
||||||
|
DataGridCell<String>(
|
||||||
|
columnName: 'resolution', value: e.resolution),
|
||||||
|
DataGridCell<String>(columnName: 'overview', value: e.overview),
|
||||||
|
]))
|
||||||
|
.toList();
|
||||||
|
}
|
||||||
|
|
||||||
|
List<Movie> movies = [];
|
||||||
|
|
||||||
|
List<DataGridRow> _movieDataGridRows = [];
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<DataGridRow> get rows => _movieDataGridRows;
|
||||||
|
|
||||||
|
@override
|
||||||
|
DataGridRowAdapter buildRow(DataGridRow row) {
|
||||||
|
return DataGridRowAdapter(
|
||||||
|
cells: row.getCells().map<Widget>((e) {
|
||||||
|
return Container(
|
||||||
|
alignment: Alignment.center,
|
||||||
|
padding: const EdgeInsets.all(8.0),
|
||||||
|
child: Text(e.value.toString()),
|
||||||
|
);
|
||||||
|
}).toList());
|
||||||
|
}
|
||||||
|
|
||||||
|
void updateDataGrid() {
|
||||||
|
notifyListeners();
|
||||||
|
}
|
||||||
|
}
|
||||||
+24
-109
@@ -1,4 +1,16 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:google_fonts/google_fonts.dart';
|
||||||
|
|
||||||
|
import 'package:multimedia/widgets/tabsScreen.dart';
|
||||||
|
|
||||||
|
final theme = ThemeData(
|
||||||
|
useMaterial3: true,
|
||||||
|
colorScheme: ColorScheme.fromSeed(
|
||||||
|
brightness: Brightness.dark,
|
||||||
|
seedColor: const Color.fromARGB(255, 131, 57, 0),
|
||||||
|
),
|
||||||
|
textTheme: GoogleFonts.latoTextTheme(),
|
||||||
|
);
|
||||||
|
|
||||||
void main() {
|
void main() {
|
||||||
runApp(const MyApp());
|
runApp(const MyApp());
|
||||||
@@ -11,115 +23,18 @@ class MyApp extends StatelessWidget {
|
|||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return MaterialApp(
|
return MaterialApp(
|
||||||
title: 'Flutter Demo',
|
// theme: theme,
|
||||||
theme: ThemeData(
|
title: 'Multimedia',
|
||||||
// This is the theme of your application.
|
// theme: ThemeData.dark().copyWith(
|
||||||
//
|
// useMaterial3: true,
|
||||||
// TRY THIS: Try running your application with "flutter run". You'll see
|
// colorScheme: ColorScheme.fromSeed(
|
||||||
// the application has a purple toolbar. Then, without quitting the app,
|
// seedColor: const Color.fromARGB(255, 147, 229, 250),
|
||||||
// try changing the seedColor in the colorScheme below to Colors.green
|
// brightness: Brightness.dark,
|
||||||
// and then invoke "hot reload" (save your changes or press the "hot
|
// surface: const Color.fromARGB(255, 42, 51, 59),
|
||||||
// reload" button in a Flutter-supported IDE, or press "r" if you used
|
// ),
|
||||||
// the command line to start the app).
|
// scaffoldBackgroundColor: const Color.fromARGB(255, 50, 58, 60),
|
||||||
//
|
// ),
|
||||||
// Notice that the counter didn't reset back to zero; the application
|
home: const TabsScreen(),
|
||||||
// state is not lost during the reload. To reset the state, use hot
|
|
||||||
// restart instead.
|
|
||||||
//
|
|
||||||
// This works for code too, not just values: Most code changes can be
|
|
||||||
// tested with just a hot reload.
|
|
||||||
colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple),
|
|
||||||
useMaterial3: true,
|
|
||||||
),
|
|
||||||
home: const MyHomePage(title: 'Flutter Demo Home Page'),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
class MyHomePage extends StatefulWidget {
|
|
||||||
const MyHomePage({super.key, required this.title});
|
|
||||||
|
|
||||||
// This widget is the home page of your application. It is stateful, meaning
|
|
||||||
// that it has a State object (defined below) that contains fields that affect
|
|
||||||
// how it looks.
|
|
||||||
|
|
||||||
// This class is the configuration for the state. It holds the values (in this
|
|
||||||
// case the title) provided by the parent (in this case the App widget) and
|
|
||||||
// used by the build method of the State. Fields in a Widget subclass are
|
|
||||||
// always marked "final".
|
|
||||||
|
|
||||||
final String title;
|
|
||||||
|
|
||||||
@override
|
|
||||||
State<MyHomePage> createState() => _MyHomePageState();
|
|
||||||
}
|
|
||||||
|
|
||||||
class _MyHomePageState extends State<MyHomePage> {
|
|
||||||
int _counter = 0;
|
|
||||||
|
|
||||||
void _incrementCounter() {
|
|
||||||
setState(() {
|
|
||||||
// This call to setState tells the Flutter framework that something has
|
|
||||||
// changed in this State, which causes it to rerun the build method below
|
|
||||||
// so that the display can reflect the updated values. If we changed
|
|
||||||
// _counter without calling setState(), then the build method would not be
|
|
||||||
// called again, and so nothing would appear to happen.
|
|
||||||
_counter++;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
Widget build(BuildContext context) {
|
|
||||||
// This method is rerun every time setState is called, for instance as done
|
|
||||||
// by the _incrementCounter method above.
|
|
||||||
//
|
|
||||||
// The Flutter framework has been optimized to make rerunning build methods
|
|
||||||
// fast, so that you can just rebuild anything that needs updating rather
|
|
||||||
// than having to individually change instances of widgets.
|
|
||||||
return Scaffold(
|
|
||||||
appBar: AppBar(
|
|
||||||
// TRY THIS: Try changing the color here to a specific color (to
|
|
||||||
// Colors.amber, perhaps?) and trigger a hot reload to see the AppBar
|
|
||||||
// change color while the other colors stay the same.
|
|
||||||
backgroundColor: Theme.of(context).colorScheme.inversePrimary,
|
|
||||||
// Here we take the value from the MyHomePage object that was created by
|
|
||||||
// the App.build method, and use it to set our appbar title.
|
|
||||||
title: Text(widget.title),
|
|
||||||
),
|
|
||||||
body: Center(
|
|
||||||
// Center is a layout widget. It takes a single child and positions it
|
|
||||||
// in the middle of the parent.
|
|
||||||
child: Column(
|
|
||||||
// Column is also a layout widget. It takes a list of children and
|
|
||||||
// arranges them vertically. By default, it sizes itself to fit its
|
|
||||||
// children horizontally, and tries to be as tall as its parent.
|
|
||||||
//
|
|
||||||
// Column has various properties to control how it sizes itself and
|
|
||||||
// how it positions its children. Here we use mainAxisAlignment to
|
|
||||||
// center the children vertically; the main axis here is the vertical
|
|
||||||
// axis because Columns are vertical (the cross axis would be
|
|
||||||
// horizontal).
|
|
||||||
//
|
|
||||||
// TRY THIS: Invoke "debug painting" (choose the "Toggle Debug Paint"
|
|
||||||
// action in the IDE, or press "p" in the console), to see the
|
|
||||||
// wireframe for each widget.
|
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
|
||||||
children: <Widget>[
|
|
||||||
const Text(
|
|
||||||
'You have pushed the button this many times:',
|
|
||||||
),
|
|
||||||
Text(
|
|
||||||
'$_counter',
|
|
||||||
style: Theme.of(context).textTheme.headlineMedium,
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
floatingActionButton: FloatingActionButton(
|
|
||||||
onPressed: _incrementCounter,
|
|
||||||
tooltip: 'Increment',
|
|
||||||
child: const Icon(Icons.add),
|
|
||||||
), // This trailing comma makes auto-formatting nicer for build methods.
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,206 @@
|
|||||||
|
import 'dart:convert';
|
||||||
|
import 'package:intl/intl.dart';
|
||||||
|
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:http/http.dart' as http;
|
||||||
|
|
||||||
|
import 'package:syncfusion_flutter_datagrid/datagrid.dart';
|
||||||
|
import 'package:syncfusion_flutter_core/theme.dart';
|
||||||
|
|
||||||
|
import 'package:multimedia/data/movies.dart';
|
||||||
|
|
||||||
|
Color _kColorInit = const Color.fromARGB(255, 192, 192, 192);
|
||||||
|
Color _kColorProg = const Color.fromARGB(255, 0, 0, 192);
|
||||||
|
Color _kColorDone = const Color.fromARGB(255, 0, 192, 0);
|
||||||
|
// if(m_state == 1)
|
||||||
|
// color = "background-color: #C0C0C0;";
|
||||||
|
// else if(m_state == 2)
|
||||||
|
// color = "background-color: #0000C0; color: #FFFFFF";
|
||||||
|
// else
|
||||||
|
// color = "background-color: #00C000;";
|
||||||
|
|
||||||
|
class MoviesScreen extends StatefulWidget {
|
||||||
|
const MoviesScreen({
|
||||||
|
super.key,
|
||||||
|
});
|
||||||
|
|
||||||
|
@override
|
||||||
|
State<StatefulWidget> createState() => _MoviesScreenState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _MoviesScreenState extends State<MoviesScreen> {
|
||||||
|
final DataGridController _dataGridController = DataGridController();
|
||||||
|
late MovieDataSource movieDataSource;
|
||||||
|
List<GridColumn> _columns = [];
|
||||||
|
|
||||||
|
Future<List<Movie>> generateMovieList() async {
|
||||||
|
// Give your PHP URL. It may be online URL o local host URL.
|
||||||
|
// Follow the steps provided in the below KB to configure the mysql using
|
||||||
|
// XAMPP and get the local host php link,
|
||||||
|
///
|
||||||
|
Uri url = Uri.http('192.168.0.70', 'multimedia.php');
|
||||||
|
final response = await http.get(url);
|
||||||
|
var list = json.decode(response.body);
|
||||||
|
|
||||||
|
// Convert the JSON to List collection.
|
||||||
|
List<Movie> _movies =
|
||||||
|
await list.map<Movie>((json) => Movie.fromJson(json)).toList();
|
||||||
|
movieDataSource = MovieDataSource(_movies);
|
||||||
|
return _movies;
|
||||||
|
}
|
||||||
|
|
||||||
|
List<GridColumn> getColumns() {
|
||||||
|
return <GridColumn>[
|
||||||
|
GridColumn(
|
||||||
|
columnName: 'movieID',
|
||||||
|
visible: false,
|
||||||
|
width: 70,
|
||||||
|
label: Container(
|
||||||
|
padding: const EdgeInsets.all(16.0),
|
||||||
|
alignment: Alignment.centerLeft,
|
||||||
|
child: const Text('movieID'))),
|
||||||
|
GridColumn(
|
||||||
|
columnName: 'state',
|
||||||
|
visible: false,
|
||||||
|
width: 70,
|
||||||
|
label: Container(
|
||||||
|
padding: const EdgeInsets.all(16.0),
|
||||||
|
alignment: Alignment.centerLeft,
|
||||||
|
child: const Text('state'))),
|
||||||
|
GridColumn(
|
||||||
|
columnName: 'movieTitle',
|
||||||
|
columnWidthMode: ColumnWidthMode.auto,
|
||||||
|
label: Container(
|
||||||
|
padding: const EdgeInsets.all(8.0),
|
||||||
|
alignment: Alignment.centerLeft,
|
||||||
|
child: const Text('Title'))),
|
||||||
|
GridColumn(
|
||||||
|
columnName: 'releaseDate',
|
||||||
|
columnWidthMode: ColumnWidthMode.auto,
|
||||||
|
label: Container(
|
||||||
|
padding: const EdgeInsets.all(8.0),
|
||||||
|
alignment: Alignment.centerLeft,
|
||||||
|
child: const Text('First Aired'))),
|
||||||
|
GridColumn(
|
||||||
|
columnName: 'resolution',
|
||||||
|
columnWidthMode: ColumnWidthMode.auto,
|
||||||
|
label: Container(
|
||||||
|
padding: const EdgeInsets.all(8.0),
|
||||||
|
alignment: Alignment.centerLeft,
|
||||||
|
child: const Text('Resolution'))),
|
||||||
|
GridColumn(
|
||||||
|
columnName: 'overview',
|
||||||
|
columnWidthMode: ColumnWidthMode.auto,
|
||||||
|
label: Container(
|
||||||
|
padding: const EdgeInsets.all(8.0),
|
||||||
|
alignment: Alignment.centerLeft,
|
||||||
|
child: const Text('Overview'))),
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
void initState() {
|
||||||
|
super.initState();
|
||||||
|
_columns = getColumns();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return Scaffold(
|
||||||
|
body: FutureBuilder<Object>(
|
||||||
|
future: generateMovieList(),
|
||||||
|
builder: (context, data) {
|
||||||
|
return data.hasData
|
||||||
|
?
|
||||||
|
SfDataGridTheme(
|
||||||
|
data: const SfDataGridThemeData(
|
||||||
|
headerColor: Color(0xff009889),
|
||||||
|
),
|
||||||
|
child:
|
||||||
|
SfDataGrid(
|
||||||
|
source: movieDataSource,
|
||||||
|
selectionMode: SelectionMode.single,
|
||||||
|
navigationMode: GridNavigationMode.row,
|
||||||
|
columns: _columns,
|
||||||
|
controller: _dataGridController,
|
||||||
|
columnWidthMode: ColumnWidthMode.fill,
|
||||||
|
),
|
||||||
|
)
|
||||||
|
: const Center(
|
||||||
|
child: CircularProgressIndicator(
|
||||||
|
strokeWidth: 2,
|
||||||
|
value: 0.8,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class MovieDataSource extends DataGridSource {
|
||||||
|
/// Creates the employee data source class with required details.
|
||||||
|
MovieDataSource(this.movies) {
|
||||||
|
buildDataGridRow();
|
||||||
|
}
|
||||||
|
|
||||||
|
void buildDataGridRow() {
|
||||||
|
_movieDataGridRows = movies
|
||||||
|
.map<DataGridRow>((e) => DataGridRow(cells: [
|
||||||
|
DataGridCell<int>(columnName: 'movieID', value: e.movieID),
|
||||||
|
DataGridCell<int>(columnName: 'state', value: e.state),
|
||||||
|
DataGridCell<String>(
|
||||||
|
columnName: 'movieTitle', value: e.movieTitle),
|
||||||
|
DataGridCell<String>(
|
||||||
|
columnName: 'releaseDate',
|
||||||
|
value: DateFormat('yyyy-MM-dd').format(e.releaseDate)),
|
||||||
|
DataGridCell<String>(
|
||||||
|
columnName: 'resolution', value: e.resolution),
|
||||||
|
DataGridCell<String>(columnName: 'overview', value: e.overview),
|
||||||
|
]))
|
||||||
|
.toList();
|
||||||
|
}
|
||||||
|
|
||||||
|
List<Movie> movies = [];
|
||||||
|
|
||||||
|
List<DataGridRow> _movieDataGridRows = [];
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<DataGridRow> get rows => _movieDataGridRows;
|
||||||
|
|
||||||
|
@override
|
||||||
|
DataGridRowAdapter buildRow(DataGridRow row) {
|
||||||
|
return DataGridRowAdapter(
|
||||||
|
cells: row.getCells().map<Widget>((e) {
|
||||||
|
Color colorBG = Colors.white;
|
||||||
|
Color colorFG = Colors.black;
|
||||||
|
|
||||||
|
if (e.columnName == 'movieTitle') {
|
||||||
|
int state = row.getCells().toList()[1].value;
|
||||||
|
|
||||||
|
if (state == 1) {
|
||||||
|
colorBG = _kColorInit;
|
||||||
|
} else if (state == 2) {
|
||||||
|
colorBG = _kColorProg;
|
||||||
|
colorFG = Colors.white;
|
||||||
|
} else {
|
||||||
|
colorBG = _kColorDone;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return Container(
|
||||||
|
alignment: Alignment.centerLeft,
|
||||||
|
padding: const EdgeInsets.all(8.0),
|
||||||
|
color: colorBG,
|
||||||
|
child: Text(
|
||||||
|
e.value.toString(),
|
||||||
|
style: TextStyle(color: colorFG),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}).toList());
|
||||||
|
}
|
||||||
|
|
||||||
|
void updateDataGrid() {
|
||||||
|
notifyListeners();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,62 @@
|
|||||||
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
|
import 'package:multimedia/widgets/tvshowsScreen.dart';
|
||||||
|
import 'package:multimedia/widgets/moviesScreen.dart';
|
||||||
|
|
||||||
|
import 'package:multimedia/data/movies.dart';
|
||||||
|
|
||||||
|
class TabsScreen extends StatefulWidget {
|
||||||
|
const TabsScreen({super.key});
|
||||||
|
|
||||||
|
@override
|
||||||
|
State<TabsScreen> createState() {
|
||||||
|
return _TabsScreenState();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class _TabsScreenState extends State<TabsScreen> {
|
||||||
|
@override
|
||||||
|
void initState() {
|
||||||
|
super.initState();
|
||||||
|
}
|
||||||
|
|
||||||
|
int _selectedPageIndex = 0;
|
||||||
|
|
||||||
|
void _selectPage(int index) {
|
||||||
|
setState(() {
|
||||||
|
_selectedPageIndex = index;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
Widget activePage = const TVShowsScreen();
|
||||||
|
var activePageTitle = 'TV Shows';
|
||||||
|
|
||||||
|
if (_selectedPageIndex == 1) {
|
||||||
|
activePage = MoviesScreen();
|
||||||
|
activePageTitle = 'Movies';
|
||||||
|
}
|
||||||
|
|
||||||
|
return Scaffold(
|
||||||
|
appBar: AppBar(
|
||||||
|
title: Text(activePageTitle),
|
||||||
|
),
|
||||||
|
body: activePage,
|
||||||
|
bottomNavigationBar: BottomNavigationBar(
|
||||||
|
onTap: _selectPage,
|
||||||
|
currentIndex: _selectedPageIndex,
|
||||||
|
items: const [
|
||||||
|
BottomNavigationBarItem(
|
||||||
|
icon: Icon(Icons.tv_outlined),
|
||||||
|
label: 'TVShows',
|
||||||
|
),
|
||||||
|
BottomNavigationBarItem(
|
||||||
|
icon: Icon(Icons.movie),
|
||||||
|
label: 'Movies',
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,75 @@
|
|||||||
|
import 'dart:ui' as ui;
|
||||||
|
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
|
Color _kColGrey = const Color.fromARGB(255, 192, 192, 192);
|
||||||
|
Color _kColBlue = const Color.fromARGB(255, 0, 0, 192);
|
||||||
|
Color _kColGreen = const Color.fromARGB(255, 0, 192, 0);
|
||||||
|
Color _kColBlack = const Color.fromARGB(255, 0, 0, 0);
|
||||||
|
Color _kColWhite = const Color.fromARGB(255, 255, 255, 255);
|
||||||
|
|
||||||
|
double _kStateWidth = 6;
|
||||||
|
double _kStateHeight = 30;
|
||||||
|
|
||||||
|
class TVShowsScreen extends StatefulWidget {
|
||||||
|
const TVShowsScreen({
|
||||||
|
super.key,
|
||||||
|
});
|
||||||
|
|
||||||
|
@override
|
||||||
|
State<StatefulWidget> createState() => _TVShowsScreenState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _TVShowsScreenState extends State<TVShowsScreen>
|
||||||
|
with SingleTickerProviderStateMixin {
|
||||||
|
ui.Image? _image;
|
||||||
|
|
||||||
|
@override
|
||||||
|
void initState() {
|
||||||
|
super.initState();
|
||||||
|
_image = null;
|
||||||
|
_asyncInit();
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<void> _asyncInit() async {
|
||||||
|
final image = await _generateImage();
|
||||||
|
setState(() {
|
||||||
|
_image = image;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
void _drawEpisodeState(Canvas c, Paint p, double x, Color color) {
|
||||||
|
Offset p1 = Offset(x + _kStateWidth, 1);
|
||||||
|
Offset p2 = Offset(x + _kStateWidth, _kStateHeight - 1);
|
||||||
|
Rect rect = Rect.fromLTRB(x, 0, x + _kStateWidth, _kStateHeight);
|
||||||
|
p.style = PaintingStyle.fill;
|
||||||
|
p.color = color;
|
||||||
|
c.drawRect(rect, p);
|
||||||
|
p.color = Colors.black;
|
||||||
|
c.drawLine(p1, p2, p);
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<ui.Image> _generateImage() async {
|
||||||
|
final Paint paint = Paint();
|
||||||
|
ui.PictureRecorder recorder = ui.PictureRecorder();
|
||||||
|
Canvas c = Canvas(recorder);
|
||||||
|
|
||||||
|
_drawEpisodeState(c, paint, _kStateWidth * 0, _kColBlack);
|
||||||
|
_drawEpisodeState(c, paint, _kStateWidth * 1, _kColBlue);
|
||||||
|
_drawEpisodeState(c, paint, _kStateWidth * 2, _kColGreen);
|
||||||
|
_drawEpisodeState(c, paint, _kStateWidth * 3, _kColGrey);
|
||||||
|
|
||||||
|
ui.Picture picture = recorder.endRecording();
|
||||||
|
final ui.Image image =
|
||||||
|
await picture.toImage(_kStateWidth.toInt() * 4, _kStateHeight.toInt());
|
||||||
|
|
||||||
|
return image;
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return Scaffold(
|
||||||
|
body: _image != null ? RawImage(image: _image!) : const Text('loading'),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -5,6 +5,8 @@
|
|||||||
import FlutterMacOS
|
import FlutterMacOS
|
||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
|
import path_provider_foundation
|
||||||
|
|
||||||
func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
|
func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
|
||||||
|
PathProviderPlugin.register(with: registry.registrar(forPlugin: "PathProviderPlugin"))
|
||||||
}
|
}
|
||||||
|
|||||||
+198
-13
@@ -41,6 +41,14 @@ packages:
|
|||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.18.0"
|
version: "1.18.0"
|
||||||
|
crypto:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: crypto
|
||||||
|
sha256: ff625774173754681d66daaf4a448684fb04b78f902da9cb3d308c19cc5e8bab
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "3.0.3"
|
||||||
cupertino_icons:
|
cupertino_icons:
|
||||||
dependency: "direct main"
|
dependency: "direct main"
|
||||||
description:
|
description:
|
||||||
@@ -57,6 +65,14 @@ packages:
|
|||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.3.1"
|
version: "1.3.1"
|
||||||
|
ffi:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: ffi
|
||||||
|
sha256: "493f37e7df1804778ff3a53bd691d8692ddf69702cf4c1c1096a2e41b4779e21"
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "2.1.2"
|
||||||
flutter:
|
flutter:
|
||||||
dependency: "direct main"
|
dependency: "direct main"
|
||||||
description: flutter
|
description: flutter
|
||||||
@@ -66,23 +82,79 @@ packages:
|
|||||||
dependency: "direct dev"
|
dependency: "direct dev"
|
||||||
description:
|
description:
|
||||||
name: flutter_lints
|
name: flutter_lints
|
||||||
sha256: a25a15ebbdfc33ab1cd26c63a6ee519df92338a9c10f122adda92938253bef04
|
sha256: "9e8c3858111da373efc5aa341de011d9bd23e2c5c5e0c62bccf32438e192d7b1"
|
||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "2.0.3"
|
version: "3.0.2"
|
||||||
flutter_test:
|
flutter_test:
|
||||||
dependency: "direct dev"
|
dependency: "direct dev"
|
||||||
description: flutter
|
description: flutter
|
||||||
source: sdk
|
source: sdk
|
||||||
version: "0.0.0"
|
version: "0.0.0"
|
||||||
|
google_fonts:
|
||||||
|
dependency: "direct main"
|
||||||
|
description:
|
||||||
|
name: google_fonts
|
||||||
|
sha256: b1ac0fe2832c9cc95e5e88b57d627c5e68c223b9657f4b96e1487aa9098c7b82
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "6.2.1"
|
||||||
|
http:
|
||||||
|
dependency: "direct main"
|
||||||
|
description:
|
||||||
|
name: http
|
||||||
|
sha256: "761a297c042deedc1ffbb156d6e2af13886bb305c2a343a4d972504cd67dd938"
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "1.2.1"
|
||||||
|
http_parser:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: http_parser
|
||||||
|
sha256: "2aa08ce0341cc9b354a498388e30986515406668dbcc4f7c950c3e715496693b"
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "4.0.2"
|
||||||
|
intl:
|
||||||
|
dependency: "direct main"
|
||||||
|
description:
|
||||||
|
name: intl
|
||||||
|
sha256: d6f56758b7d3014a48af9701c085700aac781a92a87a62b1333b46d8879661cf
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "0.19.0"
|
||||||
|
leak_tracker:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: leak_tracker
|
||||||
|
sha256: "78eb209deea09858f5269f5a5b02be4049535f568c07b275096836f01ea323fa"
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "10.0.0"
|
||||||
|
leak_tracker_flutter_testing:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: leak_tracker_flutter_testing
|
||||||
|
sha256: b46c5e37c19120a8a01918cfaf293547f47269f7cb4b0058f21531c2465d6ef0
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "2.0.1"
|
||||||
|
leak_tracker_testing:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: leak_tracker_testing
|
||||||
|
sha256: a597f72a664dbd293f3bfc51f9ba69816f84dcd403cdac7066cb3f6003f3ab47
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "2.0.1"
|
||||||
lints:
|
lints:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: lints
|
name: lints
|
||||||
sha256: "0a217c6c989d21039f1498c3ed9f3ed71b354e69873f13a8dfc3c9fe76f1b452"
|
sha256: cbf8d4b858bb0134ef3ef87841abdf8d63bfc255c266b7bf6b39daa1085c4290
|
||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "2.1.1"
|
version: "3.0.0"
|
||||||
matcher:
|
matcher:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
@@ -95,18 +167,18 @@ packages:
|
|||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: material_color_utilities
|
name: material_color_utilities
|
||||||
sha256: "9528f2f296073ff54cb9fee677df673ace1218163c3bc7628093e7eed5203d41"
|
sha256: "0e0a020085b65b6083975e499759762399b4475f766c21668c4ecca34ea74e5a"
|
||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "0.5.0"
|
version: "0.8.0"
|
||||||
meta:
|
meta:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: meta
|
name: meta
|
||||||
sha256: "7687075e408b093f36e6bbf6c91878cc0d4cd10f409506f7bc996f68220b9136"
|
sha256: d584fa6707a52763a52446f02cc621b077888fb63b93bbcb1143a7be5a0c0c04
|
||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.12.0"
|
version: "1.11.0"
|
||||||
path:
|
path:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
@@ -115,6 +187,70 @@ packages:
|
|||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.9.0"
|
version: "1.9.0"
|
||||||
|
path_provider:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: path_provider
|
||||||
|
sha256: b27217933eeeba8ff24845c34003b003b2b22151de3c908d0e679e8fe1aa078b
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "2.1.2"
|
||||||
|
path_provider_android:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: path_provider_android
|
||||||
|
sha256: "477184d672607c0a3bf68fbbf601805f92ef79c82b64b4d6eb318cbca4c48668"
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "2.2.2"
|
||||||
|
path_provider_foundation:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: path_provider_foundation
|
||||||
|
sha256: "5a7999be66e000916500be4f15a3633ebceb8302719b47b9cc49ce924125350f"
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "2.3.2"
|
||||||
|
path_provider_linux:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: path_provider_linux
|
||||||
|
sha256: f7a1fe3a634fe7734c8d3f2766ad746ae2a2884abe22e241a8b301bf5cac3279
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "2.2.1"
|
||||||
|
path_provider_platform_interface:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: path_provider_platform_interface
|
||||||
|
sha256: "88f5779f72ba699763fa3a3b06aa4bf6de76c8e5de842cf6f29e2e06476c2334"
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "2.1.2"
|
||||||
|
path_provider_windows:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: path_provider_windows
|
||||||
|
sha256: "8bc9f22eee8690981c22aa7fc602f5c85b497a6fb2ceb35ee5a5e5ed85ad8170"
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "2.2.1"
|
||||||
|
platform:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: platform
|
||||||
|
sha256: "12220bb4b65720483f8fa9450b4332347737cf8213dd2840d8b2c823e47243ec"
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "3.1.4"
|
||||||
|
plugin_platform_interface:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: plugin_platform_interface
|
||||||
|
sha256: "4820fbfdb9478b1ebae27888254d445073732dae3d6ea81f0b7e06d5dedc3f02"
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "2.1.8"
|
||||||
sky_engine:
|
sky_engine:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description: flutter
|
description: flutter
|
||||||
@@ -152,6 +288,22 @@ packages:
|
|||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.2.0"
|
version: "1.2.0"
|
||||||
|
syncfusion_flutter_core:
|
||||||
|
dependency: "direct main"
|
||||||
|
description:
|
||||||
|
name: syncfusion_flutter_core
|
||||||
|
sha256: d098e3cf5ee0c5a37b083f2efdb7c6bdfaabf871f68758bb491b10b61b3dd0d7
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "25.1.37"
|
||||||
|
syncfusion_flutter_datagrid:
|
||||||
|
dependency: "direct main"
|
||||||
|
description:
|
||||||
|
name: syncfusion_flutter_datagrid
|
||||||
|
sha256: "4edf6a41ab6bc398a79a0a29aa67a3fca53dab492d6c844f4c28a94c030f1785"
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "25.1.37"
|
||||||
term_glyph:
|
term_glyph:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
@@ -164,10 +316,18 @@ packages:
|
|||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: test_api
|
name: test_api
|
||||||
sha256: "9955ae474176f7ac8ee4e989dadfb411a58c30415bcfb648fa04b2b8a03afa7f"
|
sha256: "5c2f730018264d276c20e4f1503fd1308dfbbae39ec8ee63c5236311ac06954b"
|
||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "0.7.0"
|
version: "0.6.1"
|
||||||
|
typed_data:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: typed_data
|
||||||
|
sha256: facc8d6582f16042dd49f2463ff1bd6e2c9ef9f3d5da3d9b087e244a7b564b3c
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "1.3.2"
|
||||||
vector_math:
|
vector_math:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
@@ -176,13 +336,38 @@ packages:
|
|||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "2.1.4"
|
version: "2.1.4"
|
||||||
|
vm_service:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: vm_service
|
||||||
|
sha256: b3d56ff4341b8f182b96aceb2fa20e3dcb336b9f867bc0eafc0de10f1048e957
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "13.0.0"
|
||||||
web:
|
web:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: web
|
name: web
|
||||||
sha256: "4188706108906f002b3a293509234588823c8c979dc83304e229ff400c996b05"
|
sha256: "97da13628db363c635202ad97068d47c5b8aa555808e7a9411963c533b449b27"
|
||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "0.4.2"
|
version: "0.5.1"
|
||||||
|
win32:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: win32
|
||||||
|
sha256: "8cb58b45c47dcb42ab3651533626161d6b67a2921917d8d429791f76972b3480"
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "5.3.0"
|
||||||
|
xdg_directories:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: xdg_directories
|
||||||
|
sha256: faea9dee56b520b55a566385b84f2e8de55e7496104adada9962e0bd11bcff1d
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "1.0.4"
|
||||||
sdks:
|
sdks:
|
||||||
dart: ">=3.2.6 <4.0.0"
|
dart: ">=3.3.0 <4.0.0"
|
||||||
|
flutter: ">=3.19.2"
|
||||||
|
|||||||
+6
-1
@@ -35,6 +35,11 @@ dependencies:
|
|||||||
# The following adds the Cupertino Icons font to your application.
|
# The following adds the Cupertino Icons font to your application.
|
||||||
# Use with the CupertinoIcons class for iOS style icons.
|
# Use with the CupertinoIcons class for iOS style icons.
|
||||||
cupertino_icons: ^1.0.2
|
cupertino_icons: ^1.0.2
|
||||||
|
http: ^1.2.0
|
||||||
|
syncfusion_flutter_datagrid: ^25.1.37
|
||||||
|
intl: ^0.19.0
|
||||||
|
syncfusion_flutter_core: ^25.1.37
|
||||||
|
google_fonts: ^6.2.1
|
||||||
|
|
||||||
dev_dependencies:
|
dev_dependencies:
|
||||||
flutter_test:
|
flutter_test:
|
||||||
@@ -45,7 +50,7 @@ dev_dependencies:
|
|||||||
# activated in the `analysis_options.yaml` file located at the root of your
|
# activated in the `analysis_options.yaml` file located at the root of your
|
||||||
# package. See that file for information about deactivating specific lint
|
# package. See that file for information about deactivating specific lint
|
||||||
# rules and activating additional ones.
|
# rules and activating additional ones.
|
||||||
flutter_lints: ^2.0.0
|
flutter_lints: ^3.0.2
|
||||||
|
|
||||||
# For information on the generic Dart part of this file, see the
|
# For information on the generic Dart part of this file, see the
|
||||||
# following page: https://dart.dev/tools/pub/pubspec
|
# following page: https://dart.dev/tools/pub/pubspec
|
||||||
|
|||||||
Reference in New Issue
Block a user