Skip to content

Commit ab6e971

Browse files
committed
Updating
1 parent fe5e559 commit ab6e971

14 files changed

+51299
-40875
lines changed

docs/assets/lib/production_line/production_line.dart

Lines changed: 10 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,7 @@
1-
import 'dart:math';
2-
31
import 'package:simdart/simdart.dart';
42

5-
/// Represents the configuration for a production line simulation algorithm.
3+
/// Production line simulation algorithm.
64
class ProductionLine {
7-
/// Creates an instance of the algorithm configuration.
85
ProductionLine({
96
required this.packerCount,
107
required this.assemblerCount,
@@ -17,15 +14,11 @@ class ProductionLine {
1714
required this.rejectionProbability,
1815
});
1916

20-
final Random _random = Random();
21-
2217
/// Metrics to track
2318
int assembledCount = 0;
2419
int packagedCount = 0;
2520
int rejectedCount = 0;
2621

27-
bool get reject => _random.nextDouble() <= rejectionProbability;
28-
2922
final int packerCount;
3023
final int assemblerCount;
3124
final int inspectorCount;
@@ -61,16 +54,17 @@ class ProductionLine {
6154
sim.resources.limited(id: 'i', capacity: inspectorCount);
6255
sim.resources.limited(id: 'a', capacity: assemblerCount);
6356

64-
for (int i = 0; i < requestedItemCount; i++) {
65-
sim.process(
66-
event: _assemblyItem,
67-
start: i * requestInterval,
68-
resourceId: 'a',
69-
name: 'assembly');
70-
}
57+
sim.repeatProcess(
58+
event: _assemblyItem,
59+
resourceId: 'a',
60+
name: 'assembly',
61+
interval: Interval.fixed(
62+
fixedInterval: requestInterval, untilCount: requestedItemCount));
7163

7264
await sim.run();
7365

66+
// Result
67+
7468
final int duration = sim.duration!;
7569

7670
final double rejectionRate =
@@ -102,7 +96,7 @@ class ProductionLine {
10296

10397
void _inspectItem(EventContext context) async {
10498
await context.wait(inspectionDuration);
105-
if (reject) {
99+
if (context.sim.random.nextDouble() <= rejectionProbability) {
106100
rejectedCount++;
107101
} else {
108102
context.sim.process(event: _packItem, name: 'pack', resourceId: 'p');

docs/assets/lib/production_line/production_line_example.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ class ProductionLineExampleState extends State<ProductionLineExample> {
2626
ValueNotifier<int> assemblyDuration = ValueNotifier(5);
2727
ValueNotifier<int> inspectionDuration = ValueNotifier(2);
2828
ValueNotifier<int> packagingDuration = ValueNotifier(3);
29-
ValueNotifier<int> rejectionProbability = ValueNotifier(20);
29+
ValueNotifier<int> rejectionProbability = ValueNotifier(10);
3030
SimulationResult? simulationResult;
3131

3232
EdgeInsets padding = EdgeInsets.fromLTRB(8, 4, 8, 4);

docs/assets/lib/production_line/production_line_page.dart

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,8 @@ class ProductionLinePage extends DemoFluPage {
66
@override
77
void buildSections(BuildContext context, PageSections sections) {
88
sections.widget((context) => ProductionLineExample());
9+
10+
sections.code('lib/production_line/production_line.dart',
11+
title: 'Simulation code:');
912
}
1013
}

docs/assets/lib/production_line/result_card.dart

Lines changed: 26 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -16,28 +16,40 @@ class ResultCard extends StatelessWidget {
1616
@override
1717
Widget build(BuildContext context) {
1818
return SizedBox(
19-
width: 200,
19+
width: 160,
20+
height: 120,
2021
child: Container(
2122
decoration: BoxDecoration(
2223
color: Colors.white,
2324
border: Border.all(color: Colors.grey[300]!)),
24-
padding: EdgeInsets.all(8),
25+
padding: EdgeInsets.all(12),
2526
child: Column(
2627
crossAxisAlignment: CrossAxisAlignment.center,
28+
mainAxisAlignment: MainAxisAlignment.center,
29+
spacing: 8,
2730
children: [
28-
Row(
29-
mainAxisSize: MainAxisSize.min,
30-
crossAxisAlignment: CrossAxisAlignment.center,
31+
// Espaço entre ícone e texto
32+
Text(value, style: TextStyle(fontSize: 34, color: textColor)),
33+
RichText(
34+
textAlign: TextAlign.center,
35+
text: TextSpan(
3136
children: [
32-
Icon(icon, color: textColor, size: 26),
33-
SizedBox(width: 8.0), // Espaço entre ícone e texto
34-
Text(value,
35-
style: TextStyle(
36-
fontSize: 28, color: textColor)), // Texto
37-
]),
38-
Text(text,
39-
textAlign: TextAlign.center,
40-
style: TextStyle(fontSize: 14, color: textColor))
37+
WidgetSpan(
38+
alignment: PlaceholderAlignment.middle,
39+
child: Icon(icon, color: textColor, size: 18),
40+
),
41+
WidgetSpan(
42+
alignment: PlaceholderAlignment.middle,
43+
child: SizedBox(
44+
width: 8.0), // Espaço entre ícone e texto
45+
),
46+
TextSpan(
47+
text: text,
48+
style: TextStyle(fontSize: 14, color: textColor),
49+
),
50+
],
51+
),
52+
)
4153
])));
4254
}
4355
}

docs/flutter_bootstrap.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/flutter_service_worker.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,23 +14,23 @@ const RESOURCES = {"canvaskit/canvaskit.js": "26eef3024dbc64886b7f48e1b6fb05cf",
1414
"canvaskit/skwasm.wasm": "828c26a0b1cc8eb1adacbdd0c5e8bcfa",
1515
"canvaskit/skwasm.worker.js": "89990e8c92bcb123999aa81f7e203b1c",
1616
"flutter.js": "4b2350e14c6650ba82871f60906437ea",
17-
"flutter_bootstrap.js": "c2fd955862b3a6c6ad9bf31aae26df4b",
17+
"flutter_bootstrap.js": "3972ab42b0db902521c82b1bda24cba0",
1818
"index.html": "bae85e2714a73d5e1cb862bea875b10c",
1919
"/": "bae85e2714a73d5e1cb862bea875b10c",
20-
"main.dart.js": "8d6098fae331817e05649bac6ff2c4f2",
20+
"main.dart.js": "772ff793127876fe0be0c1338ab1cf36",
2121
"version.json": "028df730b214ce3982bc49fb9588eed5",
22-
"assets/lib/production_line/production_line.dart": "13794107694b6c42dc20cdb97ec9184e",
23-
"assets/lib/production_line/production_line_example.dart": "74d283402f0148281c1e35ce20b0e884",
24-
"assets/lib/production_line/production_line_page.dart": "8e57bcacc4833eace8bad72bfc08439e",
22+
"assets/lib/production_line/production_line.dart": "75693091209d1c70b3fd53f5b9207aa6",
23+
"assets/lib/production_line/production_line_example.dart": "dd91c2c6a5a0dfae09bda07011b7ef63",
24+
"assets/lib/production_line/production_line_page.dart": "b4f8ee762a7b2ec8b8687f408218219b",
2525
"assets/lib/production_line/table_builder.dart": "512fede93fd8b454ad744b9be64bd041",
2626
"assets/lib/production_line/radio_button.dart": "0bd3bcfbfb47e3469c5e41533fdfdc83",
27-
"assets/lib/production_line/result_card.dart": "ce22cc291f9848968b54e2e52aa32bc6",
27+
"assets/lib/production_line/result_card.dart": "4b458826592fa65d78fc6ccfc8ca0d2b",
2828
"assets/lib/production_line/sparkline_resource.dart": "5fb8e794001b9e8d2cba1017a5baf643",
2929
"assets/packages/flex_color_picker/assets/opacity.png": "49c4f3bcb1b25364bb4c255edcaaf5b2",
3030
"assets/packages/syntax_highlight/grammars/sql.json": "957a963dfa0e8d634766e08c80e00723",
3131
"assets/packages/syntax_highlight/grammars/dart.json": "b533a238112e4038ed399e53ca050e33",
32-
"assets/packages/syntax_highlight/grammars/json.json": "e608a2cc8f3ec86a5b4af4d7025ae43f",
3332
"assets/packages/syntax_highlight/grammars/yaml.json": "7c2dfa28161c688d8e09478a461f17bf",
33+
"assets/packages/syntax_highlight/grammars/json.json": "e608a2cc8f3ec86a5b4af4d7025ae43f",
3434
"assets/packages/syntax_highlight/grammars/serverpod_protocol.json": "cc9b878a8ae5032ca4073881e5889fd5",
3535
"assets/packages/syntax_highlight/themes/dark_vs.json": "2839d5be4f19e6b315582a36a6dcd1c3",
3636
"assets/packages/syntax_highlight/themes/light_vs.json": "8025deae1ca1a4d1cb803c7b9f8528a1",
@@ -40,8 +40,8 @@ const RESOURCES = {"canvaskit/canvaskit.js": "26eef3024dbc64886b7f48e1b6fb05cf",
4040
"assets/shaders/ink_sparkle.frag": "ecc85a2e95f5e9f53123dcaf8cb9b6ce",
4141
"assets/AssetManifest.json": "543a1fe4309a3ddd918a9d5aa02f01cf",
4242
"assets/AssetManifest.bin": "6dacdf00499bf8061ebfc4fca46ff818",
43-
"assets/AssetManifest.bin.json": "4d396e585fc6c69e3a48ee790194c0b3",
4443
"assets/FontManifest.json": "7b2a36307916a9721811788013e65289",
44+
"assets/AssetManifest.bin.json": "4d396e585fc6c69e3a48ee790194c0b3",
4545
"assets/NOTICES": "3f5c9288304cbf5ab31c4d280661b9c5",
4646
"favicon.png": "5dcef449791fa27946b3d35ad8803796",
4747
"icons/Icon-192.png": "ac9a721a12bbc803b44f645561ecb1e1",

0 commit comments

Comments
 (0)